mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-06-15 09:12:57 +00:00
Improve speech. Group lights and windows
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}}
|
||||
|
||||
@@ -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
|
||||
- >-
|
||||
{{
|
||||
[
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 -%}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
>-
|
||||
|
||||
The time is {{ now().hour }} {{ "%0.02d" | format(now().strftime("%-M") | int) }}.
|
||||
@@ -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 -%}
|
||||
|
||||
Reference in New Issue
Block a user