Comparing sensor values

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

Please use code blocks and syntax highlighting.

The log says “Found malformed XML” on several files. In order to help we need to see those files…

Hi
Apologies for the delay in replying - I have spent some time upgrading HA to the latest version to see if anything changed - no

I checked my intranet and the IP addresses listed in the malformed XML messages relate to the Sky and SkyQ box that we recently had installed. I have no coding or scripting relating to these devices in my HA configuration.

I think they may be safely disregarded in the context of my enquiry.

Cheers

Allan

I also get this error for my Sky Box. I have always disregarded it.