Improve speech. Group lights and windows

This commit is contained in:
2020-03-08 02:16:38 +02:00
parent 1ecfc9166e
commit 4daa60d782
8 changed files with 57 additions and 36 deletions
+7 -4
View File
@@ -12,12 +12,15 @@ light:
- platform: group
name: Living room all lights
entities:
- light.living_room_1
- light.living_room_2
- light.living_room_3
- light.living_room_4
- light.living_room_main_lights
- light.pc
- platform: group
name: All lights
entities:
- light.living_room_all_lights
- light.bedside_light
homeassistant:
customize:
light.living_room_1:
+8 -11
View File
@@ -4,16 +4,6 @@ input_boolean:
icon: mdi:chat
script:
talk_with_partials:
alias: Speech - Talk with combined partials
sequence:
- service: script.talk
data_template:
message: >-
{%- for partial in partials -%}
{{ partial }}{{ " " }}
{%- endfor -%}
talk:
alias: Speech - Talk
sequence:
@@ -22,7 +12,14 @@ script:
state: "off"
- service: script.say_discretely
data_template:
message: "{{ message }}"
message: >-
{%- if partials is defined -%}
{%- for partial in partials -%}
{{ partial }}
{% endfor %}
{%- else -%}
{{ message }}
{%- endif -%}
say_discretely:
alias: Speech - Say discretely
+15 -8
View File
@@ -41,15 +41,22 @@ script:
entity_id: media_player.master_bedroom
data:
volume_level: 0.5
- service: script.talk_with_partials
- service: script.talk
data_template:
partials:
- !include ../../templates/partials/greeting.yaml
- !include ../../templates/partials/time.yaml
- "Here's the current status:"
- !include ../../templates/partials/window_check.yaml
- >-
{{
[
"I'll play some music.",
"Here's some music."
] | random
}}
- delay: "00:00:02"
- service: script.talk
data_template:
message: >-
{{
[
"I'll put some music on.",
"I'll play some music.",
"Here's some music."
] | random
}}
+3 -2
View File
@@ -21,11 +21,12 @@ script:
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.3
- service: script.talk_with_partials
volume_level: 0.5
- service: script.talk
data_template:
partials:
- !include ../../templates/partials/greeting.yaml
- !include ../../templates/partials/time.yaml
- >-
{{
[
+7
View File
@@ -38,3 +38,10 @@ homeassistant:
sensor.bedroom_right_window_power:
friendly_name: Bedroom window battery
group:
all_windows:
name: "All windows"
entities:
- binary_sensor.living_room_right_window_on_off
- binary_sensor.bedroom_right_window_on_off
+5 -5
View File
@@ -1,11 +1,11 @@
>-
{%- if is_state('light.living_room_all_lights', 'on') -%}
There are
{%- if is_state('light.all_lights', 'on') -%}
There are
{%- for state in states.light if state.state == 'on' -%}
{%if loop.last %} {{ loop.index }} {% endif %}
{% if loop.last %} {{ loop.index }} {% endif %}
{%- endfor -%}
lights on right now.
lights turned on right now.
{%- else -%}
There are no lights on right now.
There are no lights turned on right now.
{%- endif -%}
+3
View File
@@ -0,0 +1,3 @@
>-
The time is {{ now().hour }} {{ "%0.02d" | format(now().strftime("%-M") | int) }}.
+9 -6
View File
@@ -1,9 +1,12 @@
>-
{%- if is_state('binary_sensor.living_room_right_window_on_off', 'on') -%}
The living room window is opened.
{%- endif -%}
{%- if is_state('binary_sensor.bedroom_right_window_on_off', 'on') -%}
The master bedroom window is opened.
{%- if is_state('group.all_windows', 'on') -%}
{%- if is_state('binary_sensor.living_room_right_window_on_off', 'on') -%}
The living room window is opened.
{%- endif -%}
{%- if is_state('binary_sensor.bedroom_right_window_on_off', 'on') -%}
The master bedroom window is opened.
{%- endif -%}
{%- else -%}
All windows are closed.
{%- endif -%}