Home Assistant
0.49.0
Hi all - I hope someone can point me in the right direction, I’m struggling to find a solution to subtracting one sensor value from another.
My project is to use google calendar to set up a schedule for my heating, and then based on the difference between the desired temp in the schedule and the measured temp from a generic thermostat, the heating can be switched on or off.
In configuration.yaml:
My Generic thermostat looks like this
- platform: generic_thermostat
climate.set_operation_mode: auto
name: “House Temperature”
heater: switch.heating
target_sensor: sensor.allan_office_temp
min_temp: 18
max_temp: 25
target_temp: 19
tolerance: 0.2
min_cycle_duration:
seconds: 10
keep_alive:
minutes: 3
note: I have also converted this to a float as follows:
- platform: template
sensors:
room_temp_as_float:
value_template: ‘{{states.climate.house_temperature.attributes.current_temperature | float}}’
My second sensor is from google calendar, and is also converted to a float as follows
- platform: template
sensors:
calendar_as_float:
value_template: ‘{{states.calendar.heating.attributes.message | float }}’
UP TO THIS POINT, all works perfectly as expected, I can see all the relevant values in Developer Tools <> Sates.
My problem comes when I try to work out the difference between the 2 values (states. calendar_as_float) and (states.room_temp_as_float)
All I seem to get in Developer Tools <> Sates is ‘Unknown’ when I try to subtract one from the other, or if I try an automation, the automation never triggers (I guess that’s because the value_template doesn’t seem to work)
I don’t know if this is relevant or not, but I also have the following errors in Developer Tools / Info:
2017-10-23 09:32:46 WARNING (Thread-8) [netdisco.ssdp] Found malformed XML at http://192.168.0.68:49153/description0.xml:
2017-10-23 09:32:46 WARNING (Thread-8) [netdisco.ssdp] Found malformed XML at http://192.168.0.68:49153/description1.xml:
2017-10-23 09:32:46 WARNING (Thread-8) [netdisco.ssdp] Found malformed XML at http://192.168.0.68:49153/description2.xml:
2017-10-23 09:32:46 WARNING (Thread-8) [netdisco.ssdp] Found malformed XML at http://192.168.0.68:49153/description3.xml:
2017-10-23 09:32:49 WARNING (Thread-8) [netdisco.ssdp] Found malformed XML at http://192.168.0.69:49153/description0.xml:
2017-10-23 09:32:49 WARNING (Thread-8) [netdisco.ssdp] Found malformed XML at http://192.168.0.69:49153/description1.xml:
Thanks in advance