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