I created a simple sensor to identify if the temperature is going to be warmer or cooler using darksky. It returned “warmer” but does not change to “cooler”. No errors in the logs. It’s as if it only evaluated when I restarted HASSIO and won’t evaluate again. What am I doing wrong?
Eric, you have marked your own post as the solution even though you said you went with Burning’s solution.
Think about this.
Imagine a world where every single question on a forum was solved by the original poster.
“Our work here is done !”
Everyone solves their own so we don’t even need to contribute
Easy !
amaximus, VDRainer and Burning gave you ideas and all nudged the solution along.
It is customary to give the solution to the guy who you feel helped you the most.
Hi All,
I have similar issue. I have following template:
type or paste code here
sensor:
- platform: template
sensors:
dryes_watts:
value_template: '{{ states.switch.bathroom_dryer_machine.attributes["current_power_w"] | default(0) | round(2) }}'
unit_of_measurement: 'W'
binary_sensor:
- platform: template
sensors:
dryer_on:
entity_id:
- sensor.dryes_watts
- switch.bathroom_dryer_machine
value_template: >-
{% if states('sensor.dryes_watts')|float >10 %}
on
{% else %}
off
{% endif %}
Problem is that first sensor is updating value as expected, but the second on is always “off”. If I check in template editor (in HA web interface) - status is updated based on the first sensor.
Please format your code correctly, use the </> button and read the sticky at the top of the forum.
Your template (from what I can see of the text you’ve entered (I can’t be sure because of the formatting)) looks over complex try this for the template instead : -
Thanks.
This fix the issue. And I found what was the problem with my code - as the sensor is binary - value_template should return “true/false” instead of “on/off”
Yes binary sensors only have those two states, if you add a device class you can make it show ‘open’ and ‘closed’ and others also can be applied, but underneath it’s still true/false