main
Stuart Lamont 3 years ago
parent 30cad3e285
commit 1e466cf000

@ -162,3 +162,22 @@ Here is a Dad Joke.. {{ states('sensor.dad_joke_of_the_hour') }}
And a random fact.. {{ states('sensor.random_fact') }} And a random fact.. {{ states('sensor.random_fact') }}
``` ```
## Into a Script
```yaml
alias: Announce Wind Details
sequence:
- service: notify.alexa_media
data:
message: >_
The {{ state_attr( 'sensor.quote_sensor', 'category' ) }} Quote of the day is by {{ state_attr( 'sensor.quote_sensor', 'author' ) }}.
They said. {{ states('sensor.quote_sensor') }}
Here is a Dad Joke.. {{ states('sensor.dad_joke_of_the_hour') }}
And a random fact.. {{ states('sensor.random_fact') }}
- media_player.dining_room_echo_plus
mode: single
```

@ -46,4 +46,28 @@ Inside it's currently
{% for sensor, room in inside_temps.items() %} {% for sensor, room in inside_temps.items() %}
{{ states(sensor) }} °C in the {{ room }} {{ states(sensor) }} °C in the {{ room }}
{% endfor %} {% endfor %}
```
## And in a script:
```yaml
alias: Announce Inside Temperatures
sequence:
- service: notify.alexa_media
data:
message: >_
{% set inside_temps = {
'sensor.temperature_dining': 'Dining Room',
'sensor.lounge_ac_inside_temperature': 'Lounge Room',
'sensor.temperature_office': 'Office, and',
'sensor.master_bedroom_purifier_temperature': 'Master Bedroom'
} %}
Inside it's currently
{% for sensor, room in inside_temps.items() %}
{{ states(sensor) }} °C in the {{ room }}
{% endfor %}
- media_player.dining_room_echo_plus
mode: single
``` ```

@ -42,7 +42,7 @@ Let's try doing this with an Array instead
# The Dictionary Key is the `entity_id` in Home Assistant # The Dictionary Key is the `entity_id` in Home Assistant
# the Dictionary Value is what we want our Text to Speech engine to call it. # the Dictionary Value is what we want our Text to Speech engine to call it.
'update.home_assistant_operating_system_update': 'Home Assistant OS Update', 'update.home_assistant_operating_system_update': 'Home Assistant OS',
'update.home_assistant_core_update': 'Home Assistant Core', 'update.home_assistant_core_update': 'Home Assistant Core',
'update.esphome_update': 'E S P Home', 'update.esphome_update': 'E S P Home',
@ -50,7 +50,7 @@ Let's try doing this with an Array instead
{% for entity, name in entities.items() %} {% for entity, name in entities.items() %}
{% if states(entity) == 'on' %} {% if states(entity) == 'on' %}
There's a {{ name }} pending. There's a {{ name }} update pending.
The Installed version is {{ state_attr( entity, 'installed_version') }} The Installed version is {{ state_attr( entity, 'installed_version') }}
The Available version is {{ state_attr(entity, 'latest_version') }} The Available version is {{ state_attr(entity, 'latest_version') }}
{% endif %} {% endif %}

@ -108,3 +108,58 @@
{% endfor %} {% endfor %}
``` ```
## Add a Script to Home Assistant
```yaml
alias: Announce Wind Details
sequence:
- service: notify.alexa_media
data:
message: >_
{% set wind_bearing = state_attr('weather.home', 'wind_bearing') | float %}
{% set wind_speed = state_attr('weather.home','wind_speed') | float %}
{% set directions = {
(0.0, 11.25): 'North',
(11.25, 33.75): 'North North East',
(33.75, 56.25): 'North East',
(56.25, 78.75): 'East North East',
(78.75, 101.25): 'East',
(101.25, 123.75): 'East South East',
(123.75, 146.25): 'South Eeast',
(146.25, 168.75): 'South South East',
(168.75, 191.25): 'South',
(191.25, 213.75): 'South South West',
(213.75, 236.25): 'South West',
(236.25, 258.75): 'West South West',
(258.75, 281.25): 'West',
(281.25, 303.75): 'West North West',
(303.75, 326.25): 'North West',
(326.25, 348.75): 'North Nort West',
(348.75, 360.0): 'North'
} %}
{% if wind_speed > 50 %}
Its very windy outside.
{% elif 40 < wind_speed < 50 %}
It's pretty windy at the moment
{% elif 30 < wind_speed < 40 %}
Theres a strong breeze right now
{% elif 20 < wind_speed < 30 %}
It's a bit breezy outside
{% elif 10 < wind_speed < 20 %}
There's a light breeze
{% else %}
it's quite still
{% endif %}
{% for rng, direction in directions.items() %}
{% if wind_bearing >= rng[0] and wind_bearing < rng[1] %}
The wind is currently blowing from the {{ direction }} direction, at {{ wind_speed }} kilometres per hour
{% endif %}
{% endfor %}
- media_player.dining_room_echo_plus
mode: single
```

Loading…
Cancel
Save

Powered by TurnKey Linux.