When it does “work” or have no errors I just keep getting a loading symbol when I check the config. I don’t understand the "expected token ‘,’,’ " part of the error.
- platform: template
sensors:
sam_bt:
friendly_name: 'Sam BT Beacon'
value_template: >
{% if is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'not_home') -%}
Home
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'kitchen') -%}
kitchen
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'bedroom') -%}
bedroom
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'living_room') -%}
Living Room
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'east_bedroom') -%}
East Bedroom
{% elif is_state('person.sam', 'not_home') and
is_state('sensor.sam_s_beacon', 'not_home') -%}
Not Home
{%- endif %}
- platform: template
sensors:
golf_cart_bt:
friendly_name: 'Golf Cart Keys'
value_template: >
{% if is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'not_home') -%}
Home
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'kitchen') -%}
kitchen
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'bedroom') -%}
bedroom
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'living_room') -%}
Living Room
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'east_bedroom') -%}
East Bedroom
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'away) and
is_state('sensor.golf_cart_key_beacon', 'not_home') -%}
Not Home
{%- endif %}
maybe someone can answer this too. Whats the difference between using individual templates like the above example and doing this? I have several of these to do and not sure if one way is better or is right or wrong. Both ways do the same thing and work. Is it more for organization and keeping sensors grouped under one template opposed to individual?
- platform: template
sensors:
sam_bt:
friendly_name: 'Sam BT Beacon'
unique_id: sam_bt_beacon
value_template: >
{% if is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'not_home') -%}
Home
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'kitchen') -%}
kitchen
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'bedroom') -%}
bedroom
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'living_room') -%}
Living Room
{% elif is_state('person.sam', 'home') and
is_state('sensor.sam_s_beacon', 'east_bedroom') -%}
East Bedroom
{% elif is_state('person.sam', 'not_home') and
is_state('sensor.sam_s_beacon', 'not_home') -%}
Not Home
{%- endif %}
golf_cart_bt:
friendly_name: 'Golf Cart BT'
unique_id: golf_cart_key_bt
value_template: >
{% if is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'not_home') -%}
Home
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'kitchen') -%}
kitchen
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'bedroom') -%}
bedroom
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'living_room') -%}
Living Room
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'home') and
is_state('sensor.golf_cart_key_beacon', 'east_bedroom') -%}
East Bedroom
{% elif is_state('device_tracker.golf_cart_keys_e2a7', 'away') and
is_state('sensor.golf_cart_key_beacon', 'not_home') -%}
Not Home
{%- endif %}
yes… they’re split up, that’s what the pictures are pointing out so i’m not sure why you keep posting the same link as if I don’t understand. Do you not see all the different files? scenes? switches? sensors? mqtt sensors? input select? etc. etc. Those are the individual files that are broken out of config.yaml
Well, why don’t you read the link ? , you might find out that i mean " Split your templates Sensors into small files ! " I.E.
/my-template-folder/
justins-room.yaml
mqtt-room.yaml
basement.yaml
Etc. Etc.
That what i link to, and mend to … so yes somehow i do get the feeling that you don’t understand, now that you mention it
The benefit of reading the link could result in you get cleaned up in you /config ( /homeassistant ) , it really looks like it’s needed
I have them split up exactly how I want and I don’t want them split up by room or into 25 different folders because, that’s ridiculous. Do you understand that?