Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Didgeridrew / alexa_console_scripts.yaml
Last active December 29, 2020 16:23
Scripts for use to create Alexa Console in Home Assistant
send_alexa_command:
alias: Send Alexa command
sequence:
- service: media_player.play_media
data_template:
entity_id: 'media_player.{{ states("sensor.alexa_selector") }}'
media_content_id: "{{ states('input_text.cmd_text') }}"
media_content_type: custom
send_alexa_annoucement:
alias: Send Alexa Announcement
@Didgeridrew
Didgeridrew / alexa_selector.yaml
Last active November 23, 2022 11:30
Sensor for use with Home Assistant Lovelace Alexa Console
sensor:
- platform: template
sensors:
alexa_selector:
friendly_name: "Alexa Selector Sensor"
value_template: >
{%- set room = states("input_select.alexa_state") -%}
{%- set echo = {
'Kitchen': 'kitchen_dot',
spotify_play_playlist:
alias: spotify_play_playlist
sequence:
- service: media_player.play_media
data:
entity_id: media_player.master_room_echo_dot
media_content_type: SPOTIFY
media_content_id: spotify:user:spotify:playlist:1q2QTjl3Q3k7DXhTkGDu9Z
mode: single
@Didgeridrew
Didgeridrew / tasos_heat_on_101.yaml
Created January 1, 2021 19:10
HA heat automation help for Tasos
alias: Tasos Heat On 101
trigger:
- platform: time
at: '05:00:00'
- platform: time
at: '16:00:00'
condition:
- condition: or
conditions:
- condition: numeric_state
@Didgeridrew
Didgeridrew / sensor_30min_update.yaml
Created January 1, 2021 19:12
HA sensor last changed help
binary_sensor:
- platform: template
sensors:
sensor_30min_change:
friendly_name: "Sensor last changed > 30 minutes"
value_template: >-
{{ relative_time(states.sensor.basement_humidity.last_changed) == "31 minutes"}}
@Didgeridrew
Didgeridrew / roy_heater_ex2.yaml
Created January 1, 2021 19:13
HA heater automation help for Roy
alias: 'Proximity Heat Control'
description: Control heat based on Roy's proximity to home.
trigger:
- platform: zone
entity_id: device_tracker.roy
zone: zone.the_in_between
event: leave
action:
- choose:
- conditions:
@Didgeridrew
Didgeridrew / roy_heater_ex1.yaml
Created January 1, 2021 19:14
HA heater automation help for Roy
alias: 'Heat on when close to home'
description: Turn on heat when Roy is leaving work on his way home.
trigger:
- platform: zone
entity_id: device_tracker.roy
zone: zone.work
event: leave
condition:
- condition: state
entity_id: proximity.roy_home
@Didgeridrew
Didgeridrew / gatos_aviso_2.yaml
Created January 1, 2021 19:15
HA template sensor and automation help
binary_sensor:
- platform: template
sensors:
gatos_aviso_binary:
friendly_name: "Gatos Suelo Binary Sensor"
value_template: >-
{% if states('sensor.temperature_gatos_suelo') == 'unknown'
or states('sensor.temperature_gatos_suelo') == 'unavailable'
or (utcnow() - states.sensor.temperature_gatos_suelo.last_updated).total_seconds() | round(0) > 60 %}
off
# This is not my original work, but I have lost the source. If this code belongs to you,
# or you know the original source please let me know in the comments so I can give proper attribution
#AUTOMATION
alias: Alexa Sound effects
description: Allows sound effects to alexa via input_text
trigger:
- platform: state
# This is my variation of Alexa Media Player Broadcasting with a custom card
# (https://github.com/custom-components/alexa_media_player/wiki/Examples:-Broadcasting-with-a-custom-card)
# which requires Steve Rollason's text input row card (https://github.com/gadgetchnnel/lovelace-text-input-row)
#AUTOMATION
alias: Alexa Command
description: Allows interactive tts to alexa via input_text
trigger: