Last active
May 9, 2023 23:11
-
-
Save thejeffreystone/187e943ec5d32cba461460fdb7dbe6e6 to your computer and use it in GitHub Desktop.
State Based Template Framework - Sensor and Binary Sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template: # Not needed if you are saving this in a template.yaml. But required in configuration.yaml or a package | |
- sensor: | |
- name: sensor_1 # not required, but should be - used as entity_id and friendly_name | |
unique_id: sensor_1 # not required, but is if you want to be able to manage this via the UI | |
icon: mdi:cat # not required | |
device_class: none # Can be helpful when displaying state, if not included default is none | |
# All Device Classes -> https://www.home-assistant.io/integrations/sensor/#device-class | |
state: > # required | |
{{ states('sensor.cat_count') | int }} | |
- binary_sensor | |
- name: sensor_2 # not required, but should be - used as entity_id and friendly_name | |
unique_id: sensor_2 # not required, but is if you want to be able to manage this via the UI | |
icon: mdi:cat # not required | |
device_class: presence # Can be helpful when displaying state, if not included default is none | |
# All Binary Sensor Device Classes -> https://www.home-assistant.io/integrations/binary_sensor/#device-class | |
state: > # required, and for binary sensor neeeds to be either (off, on), (enable, disabled), (true, false) | |
{{ is_state('sensor.cat_home','home') }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment