elric91 / homeassistant_zigate

Custom components for Home Assistant
MIT License
22 stars 5 forks source link

sensor: set default_attr to ZGT_LAST_SEEN #23

Closed cmorlok closed 6 years ago

cmorlok commented 6 years ago

If no default_attr is specified, and if default_attr is set to None by default, the state will always be UNKOWN. Therefore HA's state change detection will never see changed sensor data which is hidden in attributes.

Setting the default to ZGT_LAST_SEEN will raise a state change event independently of which attribute has changed.

cmorlok commented 6 years ago

I am using a config like this:

sensor:
  - platform: zigate
    name: thermometer
    address: 'abcd01'
  - platform: template
    sensors:
      temperature:
        unit_of_measurement: '°C'
        value_template: '{{ states.sensor.thermometer.attributes.temperature | round(1) }}'
      humidity:
        unit_of_measurement: '%'
        value_template: '{{ states.sensor.thermometer.attributes.humidity | round }}'

Since thermometer has no default_attr set, its state is always UNKNOWN. The sensors temperature and humidity will therefore never get any state set, even though thermometer.attributes shows the correct values.

max5962 commented 6 years ago

Totaly Agree with that change request ! When batterie information is push to home-assistant, no push to influxDB is triggered

max5962 commented 6 years ago

is it possible to update that pull request ? :)

ISO-B commented 6 years ago

I won't have that much time to do anything for this project on summer.