Hi guys
i’m on the edge of going all hulk on this its doing my head in.
i’m editing my script and i have tried formatingg this so many ways and it errors no matter what i do.
tried.
service: notify.alexa_media
data:
data:
type: tts
message: "{%- if is_state('sensor.current_lights_on', '0') -%}
{{ 'There are no lights on.'}}
{%- else -%}
{{'There are currently ' + {{states.sensor.current_lights_on.state}} + ' Lights on. Which are,'}}
{%- endif -%}
{%- if is_state('light.main_bedroom_ceiling_light_2', 'on') -%}
{{ 'Main Bedroom ceiling light is on'}}
{%- endif -%}
{%- if is_state('light.bathroom_light_2','on') -%}
{{ 'Bathroom light is on' }}
{%- endif -%}
{%- if is_state('light.main_bedroom_lamp','on') -%}
{{ 'Main Bedroom lamp light is on' }}
{%- endif -%}
{%- if is_state('light.main_hallway_light','on') -%}
{{ 'Main Hallway light is on' }}
{%- endif -%}
{%- if is_state('light.kitchen_light_1_2','on') and is_state('light.kitchen_light_2_2','on') -%}
{{ 'Both Kitchen lights is on' }}
{%- elif is_state('light.kitchen_light_1_2','on') or is_state('light.kitchen_light_2_2','on') -%}
{{ ' 1 Kitchen light is on' }}
{%- endif -%}
{%- if is_state('light.lounge_room_light','on') -%}
{{ 'Lounge light is on' }}
{%- endif -%}
{%- if is_state('light.back_room_light','on') -%}
{{ 'Back room light is on' }}
{%- endif -%}
{%- if is_state('light.dinning_room_light','on') -%}
{{ 'Dining room light is on' }}
{%- endif -%}
{%- if is_state('light.front_room_light','on') -%}
{{ 'Front room light is on' }}
{%- endif -%}
{%- if is_state('light.hallway_light_2','on') -%}
{{ 'Hallway light is on' }}
{%- endif -%}
{%- if is_state('light.computer_room_light','on') -%}
{{ 'Computer room light is on' }}
{%- endif -%}
{%- if is_state('light.bedroom_light_2','on') -%}
{{ 'Bedroom light is on' }}
{%- endif -%}
{%- if is_state('switch.outside_light_switch','on') -%}
{{ 'Outside lights is on' }}
{%- endif -%}"
target: '{{ states.sensor.last_alexa.state }}'
tried
message: "{% if is_state('sensor.current_lights_on', '0') %}
There are no lights on.
{% else %}
There are currently {{states.sensor.current_lights_on.state}} Lights on. Which are,
{% endif %}
{% if is_state('light.main_bedroom_ceiling_light_2', 'on') %}
Main Bedroom ceiling light is on
{% endif %}
{% if is_state('light.bathroom_light_2','on') %}
Bathroom light is on
{% endif %}
{% if is_state('light.main_bedroom_lamp','on') %}
Main Bedroom lamp light is on
{% endif %}
{% if is_state('light.main_hallway_light','on') %}
Main Hallway light is on
{% endif %}
{% if is_state('light.kitchen_light_1_2','on') and is_state('light.kitchen_light_2_2','on') %}
Both Kitchen lights is on
{% elif is_state('light.kitchen_light_1_2','on') or is_state('light.kitchen_light_2_2','on') %}
1 Kitchen light is on
{% endif %}
{% if is_state('light.lounge_room_light','on') %}
Lounge light is on
{% endif %}
{% if is_state('light.back_room_light','on') %}
Back room light is on
{% endif %}
{% if is_state('light.dinning_room_light','on') %}
Dining room light is on
{% endif %}
{% if is_state('light.front_room_light','on') %}
Front room light is on
{% endif %}
{% if is_state('light.hallway_light_2','on') %}
Hallway light is on
{% endif %}
{% if is_state('light.computer_room_light','on') %}
Computer room light is on
{% endif %}
{% if is_state('light.bedroom_light_2','on') %}
Bedroom light is on
{% endif %}
{% if is_state('switch.outside_light_switch','on') %}
Outside lights is on
{% endif %}"
Even how it was orginally in the script yaml file
"{% if is_state('sensor.current_lights_on', '0') %}\nThere are no lights on.\n{% else %}\nThere are currently {{states.sensor.current_lights_on.state}} Lights on. Which are,\n{% if is_state('light.main_bedroom_ceiling_light_2',
\ 'on') %}\nMain Bedroom ceiling light is on\n{% endif %}\n{% if is_state('light.bathroom_light_2',\
\ 'on') %}\nBathroom light is on\n{% endif %} \n{% if is_state('light.main_bedroom_lamp',\
\ 'on') %}\nMain Bedroom lamp light is on\n{% endif %} {% if is_state('light.main_hallway_light',\
\ 'on') %}\nMain Hallway light is on\n{% endif %} {% if is_state('light.kitchen_light_1_2',\
\ 'on') %}\nKitchen light is on\n{% endif %} {% if is_state('light.lounge_room_light',\
\ 'on') %}\nLounge light is on\n{% endif %} {% if is_state('light.back_room_light',\
\ 'on') %}\nBack room light is on\n{% endif %} {% if is_state('light.dinning_room_light',\
\ 'on') %}\nDining room light is on\n{% endif %} {% if is_state('light.front_room_light',\
\ 'on') %}\nFront room light is on\n{% endif %} {% if is_state('light.hallway_light_2',\
\ 'on') %}\nHallway light is on\n{% endif %} {% if is_state('light.computer_room_light',\
\ 'on') %}\nComputer room light is on\n{% endif %} {% if is_state('light.bedroom_light_2',\
\ 'on') %}\nBedroom light is on\n{% endif %} {% if is_state('switch.outside_light_switch',\
\ 'on') %}\nOutside lights is on\n{% endif %}"
the template works fine i can get it to work in the template area in development
its just the formatting in the yaml fine i cant get it to work!
so fustrating