mvn23 / pyotgw

A library to interface with the OpenTherm Gateway through serial or network connection.
GNU General Public License v3.0
28 stars 16 forks source link

Separate thermostat, boiler and otgw status #20

Closed mvn23 closed 4 years ago

mvn23 commented 4 years ago

When an override is active on the gateway, there can be discrepancies between the status on the boiler side vs on the thermostat side. This causes certain status attributes to change back and forth between the different values continually. To fix, we will separate the status on the thermostat side from the status on the boiler side. While we're at it, we also split out the status attributes related to the OpenTherm Gateway itself.

Fixes #19

iamkarlson commented 4 years ago

That's super nice!!! Thanks!!!

andriej commented 4 years ago

Nicely done!

andriej commented 4 years ago

@mvn23 one question regarding the development...

I've missed that CH override was added to HA in April and (as winter comes) I've started to write my own thermostat. It's already calculating heating curve etc. just as iSense does and I'm able to override iSense calculations with my own. One thing that bugs me - is there a library/protocol way to tell boiler: please, heat?

Right now I'm calculating heating curve and bumping it when needed, but still boiler manage to stop heating in middle of the desired target temperature. I'm wondering if it's either lack of some more service or I'll have to manage it by i.e. more aggresively requesting temperature (with some bumps to high value every few minutes).

Anyway - thanks for the great library and oppoturnity for me to FINALLY have not only one floor heated properly... :-)

iamkarlson commented 4 years ago

Hi @andriej, Could you please elaborate on how are you using an integration? I would be happy to help you (and learn from your experience btw) using what I did for my house. Basically, CH (if it stands for Central Heating) is switched to override mode when you set your temperature to something different from 0.

I have a little tricky automation to sync input_number state to the boiler using the following configuration:

- id: boiler_water_set_to_the_variable_level
  alias: Update boiler setpoint
  condition: 
    - condition: state
      entity_id: input_boolean.house_heating
      state: "on"
  trigger:
    platform: time_pattern
    # This will match every 1 minutes
    minutes: "/1"
  action:
  - service: opentherm_gw.set_control_setpoint
    data_template:
      gateway_id: otgw_unit
      temperature: "{{ states('input_number.boiler_water_setpoint_input') | int }}"

These are the scripts which change the target temperature:

boiler_off:
  alias: "Switch central heating off"
  sequence:
    - service: input_number.set_value
      data:
        entity_id: input_number.boiler_water_setpoint_input
        value: 0

boiler_on:
  alias: "Switch central heating on"
  sequence:
    - service: input_number.set_value
      data:
        entity_id: input_number.boiler_water_setpoint_input
        value: 60

I.e. you need to call opentherm_gw.set_control_setpoint to set a target water temperature in order to instruct the boiler to keep it heated up. In the docs you can also find that calling this service should be enough for most of the purposes:

When overriding the control setpoint (via a set_control_setpoint service call with a value other than 0), the gateway automatically enables the central heating override to start heating.

If this is successful, you should see in the sensor "Gateway/Monitor Mode" letter G and "Thermostat Central Heating Enabled" set "On" (this is actually can jump up and down but if it jumps - this is okay).

This works pretty well for me for the past season and I'm using this approach now.

andriej commented 4 years ago

Right now I'm using the integration (and override) to recalculate heating curve for my 100% floor heating, as it's little lower temp. needed when it's 5 degrees outside and different with -20. My iSense calculations were causing some unwanted starts of boiler, while (since it's wired and fixed on wall where temperatures are higher than rest of house) - it was skipping the heating when needed, at 1st floor.

Now I override with own calculated value, but still - the room temperature sensor (which I assume can't be overriden?) was causing boiler not to heat when I wanted. So I also provide a bypass like yours and tell it to heat when there's need of heat in house with setting target temperature to value like 25-27 and when I don't need heat anymore, it sets it back to desired.

Seems to work, I'm testing this setup so far but would like to see more features implemented in library that could potentially allow to have better control over the thermostat and/or boiler. :-)

mvn23 commented 4 years ago

Seems to work, I'm testing this setup so far but would like to see more features implemented in library that could potentially allow to have better control over the thermostat and/or boiler. :-)

If there's something that you can do with serial commands but not with pyotgw then I would like to see the serial commands and related responses from the gateway. This will help implementing any missing features.