Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # in homeassistant view devices, for aqara motion sensors find the device page
- # in the device page enable the linkquality sensor under diagnostic
- # then the below should work
- {%- for state in states.sensor
- | selectattr('attributes.linkquality', 'defined')
- | selectattr('attributes.unit_of_measurement', 'defined')
- | selectattr('attributes.state_class', 'defined')
- | selectattr('attributes.linkquality', 'is_number')
- | selectattr('attributes.unit_of_measurement', '==', 'lqi')
- | selectattr('attributes.state_class', '==', 'measurement')
- | selectattr('state', 'is_number') -%}
- {%- if state.state | int <= threshold -%}
- {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(' linkquality', '') | replace(' Linkquality', ''), state = state.state | int)] %}
- {%- endif -%}
- {%- endfor -%}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement