Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Didgeridrew / amp_announce_shane.yaml
Last active February 11, 2021 22:20
Alexa announce for Shane
```
alias: Close Doors
sequence:
- service: notify.alexa_media
data_template:
target:
- media_player.player1
- media_player.player2
- media_player.player3
data:
@Didgeridrew
Didgeridrew / temp_rise_fall_for_tom.yaml
Last active February 24, 2021 23:59
Home Assistant: Using threshold and derivative for Tom
# The derivative sensor outputs positive for rising temperatures and negative for falling temperatures.
# The threshold sensor will give you a binary sensor called binary_sensor.furnace_temperature_rising
# which outputs "on" when temperatures are rising and "off" when they are falling.
# The hysteresis setting determines the ˚F/min rate necessary to switch states, limiting false positives.
# Finally, the template sensor tracks the amount of time between changes in the threshold sensor.
sensor:
- platform: derivative
source: sensor.furnace_temperature
@Didgeridrew
Didgeridrew / dumb_light_switch_smart.yaml
Created February 25, 2021 18:28
Sonoff Mini Smart switch w/ Smart bulbs ESPHOME & Home Assistant
# This is a branch of Brian Hanifin's project (https://brianhanifin.com/posts/esphome-shelly1-dumb-light-switch-smart/)
# adapted for Sonoff Mini R2 smart switches.
substitutions:
device_name: smart_switch_for_smart_bulbs
project: Sonoff Mini R2
button1_gpio: GPIO00
switch1_gpio: GPIO04
relay1_gpio: GPIO12
@Didgeridrew
Didgeridrew / 2_ledc_fade_up.yaml
Last active February 26, 2021 18:20
ESPHome script to run other scripts in sequence (sequence not working)
script:
- id: fade_up_sequence
mode: single
then:
- script.execute: fade_up_warm
- wait_until:
not:
script.is_running: fade_up_warm
- script.execute: fade_up_cool
@Didgeridrew
Didgeridrew / add_gcal_event.yaml
Last active March 9, 2021 01:28
Use a HA card to add events to Google Calendars
######## You will need to create the following Helpers ############
# input_select.select_calendar
# input_text.cal_summary_text
# input_datetime.calendar_add_event_start_time
# input_datetime.calendar_add_event_end_time
#### scripts.yaml or use the UI ######
script.add_calendar_event_fe:
@Didgeridrew
Didgeridrew / trigger_templates_as_conditions.yaml
Last active March 24, 2021 19:26
HA Automations: Example of using trigger templates as conditions in Choose actions
## Documentation for this function can be found at: https://www.home-assistant.io/docs/automation/templating/
alias: Master Bedroom Lights on at Night
description: 'Master Bedroom Lights on at Night'
trigger:
- platform: time
at: '20:00:00'
- platform: time
at: '21:45:00'
@Didgeridrew
Didgeridrew / kitty_escape_cascade.json
Created March 15, 2021 04:55
Cascading Alexa Actionable Notifications in Node Red
[{"id":"27d1895f.471eb6","type":"api-call-service","z":"6388e3c4.29e85c","name":"Ask","server":"","version":1,"debugenabled":true,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"","data":"{\"text\":\"{{payload}}\",\"event_id\":\"actionable_notification_basement_kitties_cascade1\",\"alexa_device\":\"media_player.basement_dot\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":910,"y":360,"wires":[[]]},{"id":"30fd668b.b17dda","type":"server-state-changed","z":"6388e3c4.29e85c","name":"What do you want to be the trigger","server":"","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.basement_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"25","forType":"num","forUni
@Didgeridrew
Didgeridrew / prealarm.yaml
Last active March 16, 2021 16:13
Turn on lights 15 minutes before next alarm on my phone
alias: Pre-Alarm using sensor.my_phone_next_alarm and timedelta
description: 'Turn on lights 15 minutes before next alarm on my phone'
trigger:
- platform: template
value_template: >-
{% set stamp_a = (as_timestamp(states('sensor.my_phone_next_alarm')) - timedelta(minutes=15).seconds) %}
{% set wakeup_time = stamp_a|timestamp_custom ('%H:%M, %Y-%m-%d') %}
{{ wakeup_time == states('sensor.time_date') }}
condition: []
- service: notify.alexa_media
data:
target: media_player.krista_s_echo
data:
type: tts
message: The alarm has been triggered. The police have been notified.
@Didgeridrew
Didgeridrew / test_motion_sensor_sequence.yaml
Created March 20, 2021 03:02
Using wait for trigger to executes actions from a sequence of motion sensors being tripped
alias: 'zTest: Motion sensor sequence'
description: ''
trigger:
- type: motion
platform: device
device_id: 216baa79e59311ce5959d135d14e2e40
entity_id: binary_sensor.basement_motion
domain: binary_sensor
for:
hours: 0