karlc28
(Karlc28)
1
i am trying to create a binary sensor that shows “home” when connected to my home network and "away when not
binary_sensor:
- platform: template
sensors:
karl_iphone_wifi_home:
value_template: >-
{% if states('sensor.karl_s_iphone_2_ssid') == "Karl and Jackie" %}
Home
{% else %}
Away
{% endif %}
friendly_name: 'Karl'
this is what i have but it just says off when i check the binary sensor
Tinkerer
(aka DubhAd on GitHub)
2
Because binary_sensor
entities are on
or off
Use on
and off
and set the device_class
to presence
as explained here.
karlc28
(Karlc28)
3
thank you which line would i add it to
tom_l
4
binary_sensor:
- platform: template
sensors:
karl_iphone_wifi_home:
value_template: >
{{ is_state('sensor.karl_s_iphone_2_ssid', 'Karl and Jackie') }}
friendly_name: 'Karl'
device_class: presence
However for new sensors you should be using the new format (configuration.yaml):
template:
- binary_sensor:
- name: 'Karl'
state: >
{{ is_state('sensor.karl_s_iphone_2_ssid', 'Karl and Jackie') }}
device_class: presence
1 Like