@redzer_irl how does your home assistant script successfully write to the heat pump to tell it what to do? what's in the script ? not the user facing or logic bits, I mean the output side, the bit that actually "does something"? could you possibly publish your code?
I have added the UI config and the YAML config of the script here. The main part is "modbus.write_register" and the payload associated with that.
As has been said before, all responsibility for using this code lies with the user but it works for me.
alias: Boost Hot Water
sequence:
- service: modbus.write_register
data:
hub: samsung
address: 72
slave: 1
value: 1
alias: Turn Hot Water On
- service: modbus.write_register
data:
hub: samsung
address: 73
slave: 1
value: 1
alias: Set Hot Water Mode to Standard
- service: modbus.write_register
data:
hub: samsung
address: 74
slave: 1
value: 500
alias: Set Hot Water Temp to 50°C
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
alias: Delay for 30 mins
- service: modbus.write_register
data:
hub: samsung
address: 72
slave: 1
value: 0
alias: Turn Hot Water Off
- service: modbus.write_register
data:
hub: samsung
address: 73
slave: 1
value: 0
alias: Set Hot Water Mode to Eco
- service: modbus.write_register
data:
hub: samsung
address: 74
slave: 1
value: 450
alias: Set Hot Water Temp to 45°C
mode: restart
icon: tc:heat-index
One tends to find that software written by those who are solely programmers, can be complex and convoluted, possibly for several reasons.
It is commercial software, and they are the only person who can readily understand the software, which is good for their business.
Quite often programmers like to show off their 'greater' intelligence when compared to us lesser mortals.
They obviously don't fully understand the concept of KISS (Keep It Simple, Stupid), and instead prefer 'why make it simple, when you can make it more complex'.
@derek-m with regard to your app question - if you are referring to samsung - then no, not in the config that all of us have it and are testing. samsung does have a wifi/app gateway device, but its optional component, and we don't use it. without it, the system is not IP / app enabled.
homely (commercial) take the same approach. they don't use that samsung app. they wrote their own app and built their own internet/app gateway device - but their comms with the heat pump is modbus only. we're all trying to step into that same logical point in the system - modbus comms with the heat pump - to tell it what we want it to do.
One tends to find that software written by those who are solely programmers, can be complex and convoluted, possibly for several reasons.
It is commercial software, and they are the only person who can readily understand the software, which is good for their business.
Quite often programmers like to show off their 'greater' intelligence when compared to us lesser mortals.
They obviously don't fully understand the concept of KISS (Keep It Simple, Stupid), and instead prefer 'why make it simple, when you can make it more complex'.
All so very true... Obfuscation. Why use one line when you can use two hundred?
Here's my entire hourly data extracted from minute data code, based on the why make it complicated when you can make it simple principle:
The main part is "modbus.write_register" and the payload associated with that.
thank you . Big clue. thank you again. you're running these as HA commands with the modbus connected physically directly to and controlled from your HA machine? you're not using ESPHOME or ESP devices?
would you mind testing if the modbus.write_register HA command is able to succesfully change target flow temp? (register 68) ?
thank you . Big clue. thank you again. you're running these as HA commands with the modbus connected physically directly to and controlled from your HA machine? you're not using ESPHOME or ESP devices?
would you mind testing if the modbus.write_register HA command is able to succesfully change target flow temp? (register 68) ?
Did you try it with something simple like DWH temperature first? I just added the code I pasted the other day and it changed the DWH temperature successfully.
Here's the output from ESPHome logs
[10:04:06][D][number:054]: 'Set DHW Water Temperature' - Setting number value
[10:04:06][D][number:113]: New number value: 46.000000
[10:04:06][D][modbus.number:061]: Updating register: connected Sensor=Set DHW Water Temperature start address=0x48 register count=1 new value=46.00 (val=460.00)
[10:04:06][D][number:012]: 'Set DHW Water Temperature': Sending state 46.000000
[10:04:06][D][number:012]: 'Set DHW Water Temperature': Sending state 46.000000
If that works for you, then perhaps it's to do with the pump controller configuration rejecting the LWT change. I've got it set up for weather comp / water law so it doesn't let me change LWT (reg 68). I don't have time at the moment to go and change the controller settings, but I might be able to later on.
@derek-m with regard to your app question - if you are referring to samsung - then no, not in the config that all of us have it and are testing. samsung does have a wifi/app gateway device, but its optional component, and we don't use it. without it, the system is not IP / app enabled.
homely (commercial) take the same approach. they don't use that samsung app. they wrote their own app and built their own internet/app gateway device - but their comms with the heat pump is modbus. we're all trying to step into that same logical point in the system - modbus comms with the heat pump - to tell it what we want it to do.
Thank you for the clarification. I obviously should have included 'or from the HMI (Human - Machine Interface)' in my question.
I suspect that the three parameters being changed in the software at addresses 72, 73 and 74, can all be adjusted manually via the HMI. The processor within the heat pump controller, will therefore read the changes from the HMI and write the new data into the specified addresses. As the heat pump controller runs the software, it will read the data from the above addresses, but will not change it, unless instructed to do so.
The HA carries out the same function that could be done manually, but instead writes the data into the specified addresses. These particular parameters are therefore what would be described as primary 'inputs', which means that the heat pump processor will read the data during normal operation, but will not change it.
You wish to be able to change the 'target LWT', but as I stated previously, I believe that this parameter is actually an 'output', and hence cannot be changed by just writing new data at its specified address. To be able to cause changes to the 'Heat Pump Water Out Set Temperature' at address 68, it will be necessary to change an 'input' which affects this 'output'.
Try changing the 'Heat Pump Target Indoor Temperature' at address 58, though you may have to also set your system to be in room temperature control or whatever the Samsung equivalent may be called. You could also try 'Heating discharge set temperature' at address 62, or 'MCC water-out temperature' at address 67.
@steven thanks. I was wondering if your suggested "number" method was never going to work because I found this nugget in the esphome modbus controller documentation
Note
Write support is only implemented for switches and selects. However the C++ code provides the required API to write to a modbus device.
These methods can be called from a lambda.
so was starting to wonder if needs a lambda writing. however, if you've used the number method to successfully change the DHW temp, that proves that write does work for a number method from an esp. I don't have DHW configured right now but will find a way to try that out, to validate if I can get to the same place as you.
exact same thought occurred to me that the controller might be in the wrong mode so just refusing to listen.... so I RTFM'd homely's install manual yesterday, and they show it in fixed LWT mode (page 11), which I have set also. currently puzzled...
You wish to be able to change the 'target LWT', but as I stated previously, I believe that this parameter is actually an 'output', and hence cannot be changed by just writing new data at its specified address. To be able to cause changes to the 'Heat Pump Water Out Set Temperature' at address 68, it will be necessary to change an 'input' which affects this 'output'.
In Midea-speak, though I have yet to even get near to do this, I had in mind tweaking the weather comp set points to achieve this: to get a 2 degree boost in LWT, set the upper and lower end of the weather comp curve up by two degrees, to remove the boost, takes the two ends down two degrees. Register addresses 265 (PLC 40266) and 266 (PLC 40267) appear to be T1SetH1 and T1SetH2 respectively (T1 is the LWT, and T1SetH1/2 are the two set temps on the weather comp curve as shown in this diagram:
I think I am right in saying PLC 40*** addresses are holding register addresses and that they are both readable and writable.
Midea 14kW (for now...) ASHP heating both building and DHW
Write support is only implemented for switches and selects. However the C++ code provides the required API to write to a modbus device.
These methods can be called from a lambda.
so was starting to wonder if needs a lambda writing.
Complexity, dear boy, complexity! You'll be dancing with the three legged one eyed unicorn before you know it! Basic python plus minimalmodbus can do it far more simply:
import minimalmodbus
instrument = minimalmodbus.Instrument('/dev/ttyUSB1', 1) # port name, slave address (in decimal)
## read from a register address
temperature = instrument.read_register(289, 1) # Registernumber, number of decimals
print(temperature)
## write to a register address
NEW_TEMPERATURE = 95
instrument.write_register(24, NEW_TEMPERATURE, 1) # Registernumber, value, number of decimals for storage
From the documentation here. It is some of the best python documentation I have ever seen, even I can understand most of it.
You wish to be able to change the 'target LWT', but as I stated previously, I believe that this parameter is actually an 'output', and hence cannot be changed by just writing new data at its specified address. To be able to cause changes to the 'Heat Pump Water Out Set Temperature' at address 68, it will be necessary to change an 'input' which affects this 'output'.
In Midea-speak, though I have yet to even get near to do this, I had in mind tweaking the weather comp set points to achieve this: to get a 2 degree boost in LWT, set the upper and lower end of the weather comp curve up by two degrees, to remove the boost, takes the two ends down two degrees. Register addresses 265 (PLC 40266) and 266 (PLC 40267) appear to be T1SetH1 and T1SetH2 respectively (T1 is the LWT, and T1SetH1/2 are the two set temps on the weather comp curve as shown in this diagram:
I think I am right in saying PLC 40*** addresses are holding register addresses and that they are both readable and writable.
I think that would probably work, since the two parameters that you mention are 'inputs', and therefore it should be able to change them via Modbus.
To help make the setback and boost possibly more efficient, you could ramp up the temperature over several hours.
Thinking about installing a heat pump but unsure where to start? Already have one but it’s not performing as expected? Or are you locked in a frustrating dispute with an installer or manufacturer? We’re here to help.