File tree Expand file tree Collapse file tree
custom_components/wda_sensor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 "iot_class" : " local_polling" ,
99 "issue_tracker" : " https://github.com/sokolovs/wda-sensor/issues" ,
1010 "requirements" : [],
11- "version" : " 1.2.0 "
11+ "version" : " 1.2.1 "
1212}
Original file line number Diff line number Diff line change 55from homeassistant .helpers .entity import EntityCategory
66from homeassistant .helpers .restore_state import RestoreEntity
77
8+ from .helpers import get_config_value
89from .const import * # noqa F403
910
1011_LOGGER = logging .getLogger (__name__ )
@@ -66,8 +67,12 @@ async def async_added_to_hass(self):
6667
6768 # Set default value for first time
6869 if last_state is None or last_state .state in [STATE_UNKNOWN , STATE_UNAVAILABLE , None ]:
69- _LOGGER .info (f"Set default value for '{ self ._attr_translation_key } '" )
70- await self .async_set_native_value (value = self ._entity_config .get ("default" ))
70+ _LOGGER .info (f"Set last config (or default) value for '{ self ._attr_translation_key } '" )
71+ await self .async_set_native_value (
72+ value = get_config_value (
73+ self ._config ,
74+ self ._name ,
75+ default = self ._entity_config .get ("default" )))
7176 # Restore last state
7277 else :
7378 _LOGGER .info (f"Restoring the last state for '{ self ._attr_translation_key } '" )
You can’t perform that action at this time.
0 commit comments