I have created a thermostat for my Rinnai gas heater. The heater is totally dumb but has a remote control to switch it on and off.
The thermostat I have created uses a broadlink IR universal remote to send the on/off commands to the heater (the switch). This is combined with a room temp sensor to create the thermostat. All working fine but…
The issue is sometimes the switch state is out of sync with the actual heater state. e.g. if someone manually uses the switch on the heater. This is tricky to fix as there is no way to determine the actual state of the heater (as it is dumb and there is no way for HA to determine if it is actually on or off)
What I want to try is to get the switch to sync periodically or for HA to test/check room temp vs set temp of thermostat and reset the switch if when these are out of sync.
What kind of switch is it?
Not knowing the details if you could get the switch to go through HA then you can do what you want. There may be multiple ways to do this depending on your experience and the voltage level that the system requires for the switch.
I see. No it’s not modifiable. That’s why I have a ‘software/virtual’ switch but it can get out of sync.
I have an idea to create an automation that is triggered when room temp and the set temp of thermostat is out of sync. This automation will either trigger/toggle the switch and get it back in sync.
Here is what my heating page looks like in HA. I’m a total noobie so very pleased with it
Your Template Switch’s configuration lacks a value_template which means it is operating in optimistic mode. In other words, the Template Switch’s state isn’t a reflection of the heater’s actual state, only an optimistic assumption.
Without a physical means of confirming the heater is in the desired state, it’s a losing battle to reliably control it. The Template Switch needs feedback from the heater to confirm the heater is now in the desired state. Without that feedback, strategies that indirectly infer the heater’s state are often fragile.
FWIW, this is a common problem for any device that cannot report its actual state and there are typically no reliable workarounds unless they implement a means of detecting the device’s state.
I hesitate to suggest using a light sensor to monitor the brightness of the gas burner because any modifications to a gas appliance (or addition of unapproved RF devices in close proximity) have serious safety implications.
Thanks for your help. I thought it would be tricky for the reason you mention here but I do have an idea…
I can reliably the difference between room temp and the heater set temp. Code below…
% set gas_set_temp = state_attr ('climate.gas_heater_thermostat', 'temperature') | float %}
{% set room_temp = states ('sensor.living_room_temp_average') | float %}
{% set gas_temp_delta = ( room_temp - gas_set_temp ) | round (1) %}
So I can create a template sensor that holds this temperature delta and I can trigger automation to send the on/off command to the heater and reset the switch.
So I think all i need to do now is to periodically check the delta and reset gas heater switch to the correct state and this should bring everything into sync and switch off heater if it is on when it should be off.
Done using a couple of automations that run every 30mins and test condition of sensor and reset switch if needed. example below.
alias: Confirm Gas Heater Off
description: Resets switch and turns off heater if above target
trigger:
- platform: time_pattern
minutes: /30
condition:
- condition: numeric_state
entity_id: sensor.gas_thermostat_delta
above: 1
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.gas_heater
mode: single
If it is a Rinnai that I am thinking of it has a plug. Simply use a plug that reports energy usage. Set a automation when the energy goes above the idle ussge.