Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Trouble With Template Sensor States on Hass.io Restart
Post Body

Hey guys,

I'm having trouble with the states of my template sensors, cover templates, and other templates after restarting HassIO. I'm transitioning from SmartThings to HA, so I'm frequently restarting as I add tweak my configuration. I've seen the "Considerations" section in the HA Template Sensor configuration that says:

"If you are using the state of a platform that takes extra time to load, the Template Sensor may get an unknownstate during startup. To avoid this (and the resulting error messages in your log file), you can use is_state()function in your template. For example, you would replace {{ is_state('switch.source', 'on') }}with this equivalent that returns true/falseand never gives an unknownresult:

{{ is_state('switch.source', 'on') }}"

I've tried to mimic this, but it still seems like a get an "unknown" state, followed by an on/off , true/false, etc. state from the template. This causes entries in my logbook that make it appear that an action has occurred where there has been no action. Of specific concern is when I see "Garage Door changed to closed" when making changes and restarting remotely. I feel confident that my garage door has been closed the whole time, but it is still unnerving to see these messages.

As an example, my garage door cover template sensor is looks like:

- platform: template

covers:

garage_door:

friendly_name: "Garage Door"

value_template: "{{is_state('sensor.garage_door_zwave_sensor_alarm_level', '255')}}"

open_cover:

service_template: >

{% if is_state('sensor.garage_door_zwave_sensor_alarm_level', '0') %}

switch.turn_on

{% endif %}

entity_id: switch.garage_door_switch

close_cover:

service_template: >

{% if is_state('sensor.garage_door_zwave_sensor_alarm_level', '255') %}

switch.turn_on

{% endif %}

entity_id: switch.garage_door_switch

stop_cover:

service: switch.turn_on

data:

entity_id: switch.garage_door_switch

icon_template: >-

{% if is_state('sensor.garage_door_zwave_sensor_alarm_level', '255') %}

mdi:garage-open

{% else %}

mdi:garage

{% endif %}

But, every time I restart, The state history shows that it was open during reboot, and the logbook shows "Home Assistant started" followed by "Garage Door changed to closed".

Anyone have a solution? Can post any other information that is needed to debug.

Author
Account Strength
90%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,061
Link Karma
249
Comment Karma
794
Profile updated: 2 days ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 years ago