Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Didgeridrew / shade_predictor.yaml
Created July 5, 2024 20:13
HA - LUT w/ MAcro for alexamend shade predictor
{% set y_day_azi = {
1:
{"north": none,
"east": none,
"south": [126,207],
"west": [202,232]},
13:
{"north": none,
"east": none,
"south": [123,207],
alias: Office Wall Switch
description: ""
trigger:
- platform: state
entity_id:
- switch.office_wall_switch_1
- light.office_ceiling_light
- switch.office_wall_switch_2
- climate.office_ac
- switch.office_wall_switch_3
@Didgeridrew
Didgeridrew / wk_min_temp.yaml
Last active March 30, 2024 15:28
HA - Weekly Minimum Temp
template:
- trigger:
- platform: state
not_to:
- unknown
- unavailable
entity_id: sensor.temp
- platform: template
value_template: "{{ now().weekday() == 0 }}"
action:
@Didgeridrew
Didgeridrew / times_opened.yaml
Created February 6, 2024 16:43
HA - Times opened, like History stats but without time
template:
- trigger:
- platform: state
entity_id: input_boolean.test_bool_1
to: "on"
- platform: event
event_type: custom_reset_times_opened
- platform: event
event_type: event_template_reloaded
sensor:
@Didgeridrew
Didgeridrew / event_x_dates.yaml
Created February 1, 2024 05:11
HA - Create cloned events over multiple dates
alias: Repeat for Each date create Cal event
description: ""
fields:
summary:
required: true
name: Event Summary
description: The title/summary for the calendar events
selector:
text:
work_date_1:
@Didgeridrew
Didgeridrew / light_color_loop.yaml
Last active February 1, 2024 04:55
HA - Script Loop Light Colors
script:
color_loop_light:
alias: Color loop light
description: ""
fields:
colors:
name: Colors
description: A list of color names to set the lights to or loop through
required: true
sequence:
@Didgeridrew
Didgeridrew / random_options.yaml
Created February 1, 2024 04:39
HA - Randomize Options from a Select
# This was just a weird idea to randomize a list of values.
# Maybe it could be used for chores or activity planning?
alias: Random Option to calendar
sequence:
- variables:
option: |-
{% set options = state_attr('input_select.colors_warm', 'options')%}
{% set ns = namespace(x = options) %}
{% for i in range(ns.x|length- 1, 0, -1) %}
@Didgeridrew
Didgeridrew / nested_logical_con.yaml
Created February 1, 2024 04:29
HA - Demostrating Nested Logical Conditions
alias: Nested logical conditions
sequence:
- choose:
- alias: This works
conditions:
- condition: not
conditions:
- condition: template
value_template: false
sequence:
@Didgeridrew
Didgeridrew / process_tags.yaml
Created February 1, 2024 04:28
HA - Script to Process NFC Tag values
alias: Process Tags
fields:
reader:
description: The value read from a tag
example: "0123456789"
default: "0123456789"
sequence:
- variables:
tags:
"1234567890":
@Didgeridrew
Didgeridrew / cal_to_shopping.yaml
Created February 1, 2024 04:04
HA - Iterate over calendar events and add to Shopping list
alias: Calendar Events to Shopping List items
sequence:
- service: calendar.get_events
data:
duration:
hours: 24
minutes: 0
seconds: 0
target:
entity_id: calendar.home_assistant_events