Skip to content

Commit

Permalink
Merge pull request #31 from gjohansson-ST/gj-20250105-07
Browse files Browse the repository at this point in the history
Add missing translation keys in config flow
  • Loading branch information
gjohansson-ST authored Jan 5, 2025
2 parents b75ab1f + 36d2c80 commit cf21b34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions custom_components/attribute_as_sensor/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@
vol.Optional(CONF_ICON): selector.IconSelector(),
vol.Optional(CONF_DEVICE_CLASS): selector.SelectSelector(
selector.SelectSelectorConfig(
options=DEVICE_CLASSES, mode=selector.SelectSelectorMode.DROPDOWN
options=DEVICE_CLASSES,
mode=selector.SelectSelectorMode.DROPDOWN,
translation_key="device_class",
)
),
vol.Optional(CONF_STATE_CLASS): selector.SelectSelector(
selector.SelectSelectorConfig(
options=STATE_CLASSES, mode=selector.SelectSelectorMode.DROPDOWN
options=STATE_CLASSES,
mode=selector.SelectSelectorMode.DROPDOWN,
translation_key="state_class",
)
),
vol.Optional(CONF_UNIT_OF_MEASUREMENT): selector.SelectSelector(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/attribute_as_sensor/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _async_attribute_sensor_state_listener(
self._attr_native_value = STATE_UNAVAILABLE
self.async_write_ha_state()
return

self._has_logged = False
if new_state and self._attribute in new_state.attributes:
_LOGGER.debug("State attributes: %s", new_state.attributes)
Expand Down

0 comments on commit cf21b34

Please sign in to comment.