diff --git a/config/automations.yaml b/config/automations.yaml new file mode 100755 index 0000000..2eef24a --- /dev/null +++ b/config/automations.yaml @@ -0,0 +1,293 @@ +- id: '1764278933071' + alias: 'Start Heating Living Room ' + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.0x54ef44100140a6a0_temperature + below: 18.5 + conditions: + - condition: device + type: is_off + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + actions: + - type: turn_on + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + mode: single +- id: '1764279246529' + alias: Notify when Boiler not starting + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.shellyplus1pm_345f452121a8_power + for: + hours: 0 + minutes: 6 + seconds: 15 + above: 200 + conditions: + - condition: device + type: is_on + device_id: 7f6eb02e6d4089ee609fc01f52641606 + entity_id: 44bc95098b0249e636dea53a3a943045 + domain: switch + actions: + - action: notify.mobile_app_brian_s_oneplus_9t + metadata: {} + data: + message: Boiler has stopped working + - action: notify.mobile_app_solveigs_oneplus + metadata: {} + data: + message: Boiler has stopped working + mode: single +- id: '1764280645105' + alias: Stop Heating Living Room + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.0x54ef44100140a6a0_temperature + above: 19.5 + conditions: + - condition: device + type: is_on + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + actions: + - type: turn_off + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + mode: single +- id: '1764351061738' + alias: Automatic Pantry Light + description: '' + triggers: + - type: occupied + device_id: c2fc163da91df4be8461c0c39ca390aa + entity_id: 06ef2a6feb3e955e5b963b897ddeb083 + domain: binary_sensor + trigger: device + conditions: + - condition: device + type: is_off + device_id: c56f8f7d84afb6e990e52e859f37177b + entity_id: 1703a72f68b34a7ef76422543af68aa0 + domain: switch + actions: + - type: turn_on + device_id: c56f8f7d84afb6e990e52e859f37177b + entity_id: 1703a72f68b34a7ef76422543af68aa0 + domain: switch + - delay: + hours: 0 + minutes: 2 + seconds: 0 + milliseconds: 0 + - type: turn_off + device_id: c56f8f7d84afb6e990e52e859f37177b + entity_id: 1703a72f68b34a7ef76422543af68aa0 + domain: switch + mode: single +- id: '1766766251998' + alias: 'Start Charging Charlie ' + description: '' + triggers: + - trigger: time + at: 00:00:00 + weekday: + - sun + conditions: + - condition: device + type: is_off + device_id: 058d238b5d8c63b38bc18870d0b6d6d1 + entity_id: baa8a9d9624af8e4e446968d9494e54e + domain: switch + actions: + - type: turn_on + device_id: 058d238b5d8c63b38bc18870d0b6d6d1 + entity_id: baa8a9d9624af8e4e446968d9494e54e + domain: switch + mode: single +- id: '1766766589349' + alias: 'Stop Charging Charlie ' + description: '' + triggers: + - trigger: time + at: 00:00:00 + weekday: + - mon + conditions: + - condition: device + type: is_on + device_id: 058d238b5d8c63b38bc18870d0b6d6d1 + entity_id: baa8a9d9624af8e4e446968d9494e54e + domain: switch + actions: + - type: turn_off + device_id: 058d238b5d8c63b38bc18870d0b6d6d1 + entity_id: baa8a9d9624af8e4e446968d9494e54e + domain: switch + mode: single +- id: '1766769308925' + alias: 'Start Heating Large Toilet ' + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.0x54ef44100140aacb_temperature + below: 18.5 + conditions: + - condition: device + type: is_off + device_id: 4c4b4a59fa12662a8dd1a0fdea4ea0b7 + entity_id: 9942e003a704392f67d147e1b4ddb263 + domain: switch + actions: + - type: turn_on + device_id: 4c4b4a59fa12662a8dd1a0fdea4ea0b7 + entity_id: 9942e003a704392f67d147e1b4ddb263 + domain: switch + mode: single +- id: '1766769445588' + alias: Stop Heating Large Toilet + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.0x54ef44100140aacb_temperature + above: 19.5 + conditions: + - condition: device + type: is_on + device_id: 4c4b4a59fa12662a8dd1a0fdea4ea0b7 + entity_id: 9942e003a704392f67d147e1b4ddb263 + domain: switch + actions: + - type: turn_off + device_id: 4c4b4a59fa12662a8dd1a0fdea4ea0b7 + entity_id: 9942e003a704392f67d147e1b4ddb263 + domain: switch + mode: single +- id: '1767475898636' + alias: Notify when tumble dryer done + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.shellyplus1pm_78ee4cc83a94_energy + for: + hours: 0 + minutes: 5 + seconds: 0 + below: 5 + conditions: [] + actions: [] + mode: single +- id: '1767476086900' + alias: Notify when washing machine is done + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.shellyplus1pm_78ee4cc71ae4_energy + for: + hours: 0 + minutes: 5 + seconds: 0 + below: 5 + conditions: [] + actions: [] + mode: single +- id: '1769720108793' + alias: 'Start Heating Bedroom ' + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.0x54ef44100140a63c_device_temperature + below: 17 + conditions: + - condition: device + type: is_off + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + actions: + - type: turn_on + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + mode: single +- id: '1769720179956' + alias: 'Stop Heating Bedroom ' + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.0x54ef44100140a63c_device_temperature + above: 18 + conditions: + - condition: device + type: is_on + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + actions: + - type: turn_off + device_id: 076897fb77d93130a149555d2840fba9 + entity_id: d7cc8f4b83bbbfa3000238face1fcc81 + domain: switch + mode: single +- id: "large_toilet_fan_control" + alias: "Fan Control - Large Toilet" + description: "Controls fan based on recent occupancy and humidity baseline" + mode: restart + trigger: + # Trigger if humidity changes + - platform: state + entity_id: sensor.0x54ef44100140aacb_humidity + # Trigger if occupancy helper changes + - platform: state + entity_id: binary_sensor.large_toilet_recently_occupied + # Trigger if the baseline itself is adjusted + - platform: state + entity_id: sensor.large_toilet_humidity_baseline + action: + - choose: + # TURN ON LOGIC + - alias: "Turn fan on" + conditions: + - condition: or + conditions: + - condition: state + entity_id: binary_sensor.large_toilet_recently_occupied + state: "on" + - condition: template + value_template: "{{ states('sensor.0x54ef44100140aacb_humidity') | float > states('sensor.large_toilet_humidity_baseline') | float }}" + sequence: + - service: fan.turn_on + target: + entity_id: fan.large_toilet_ventilator + + # TURN OFF LOGIC + - alias: "Turn fan off" + conditions: + - condition: and + conditions: + - condition: state + entity_id: binary_sensor.large_toilet_recently_occupied + state: "off" + - condition: template + value_template: "{{ states('sensor.0x54ef44100140aacb_humidity') | float <= states('sensor.large_toilet_humidity_baseline') | float }}" + sequence: + - service: fan.turn_off + target: + entity_id: fan.large_toilet_ventilator diff --git a/config/blueprints/automation/homeassistant/motion_light.yaml b/config/blueprints/automation/homeassistant/motion_light.yaml new file mode 100755 index 0000000..8f5d3f9 --- /dev/null +++ b/config/blueprints/automation/homeassistant/motion_light.yaml @@ -0,0 +1,56 @@ +blueprint: + name: Motion-activated Light + description: Turn on a light when motion is detected. + domain: automation + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml + author: Home Assistant + input: + motion_entity: + name: Motion Sensor + selector: + entity: + filter: + device_class: motion + domain: binary_sensor + light_target: + name: Light + selector: + target: + entity: + domain: light + no_motion_wait: + name: Wait time + description: Time to leave the light on after last motion is detected. + default: 120 + selector: + number: + min: 0 + max: 3600 + unit_of_measurement: seconds + +# If motion is detected within the delay, +# we restart the script. +mode: restart +max_exceeded: silent + +trigger: + platform: state + entity_id: !input motion_entity + from: "off" + to: "on" + +action: + - alias: "Turn on the light" + service: light.turn_on + target: !input light_target + - alias: "Wait until there is no motion from device" + wait_for_trigger: + platform: state + entity_id: !input motion_entity + from: "on" + to: "off" + - alias: "Wait the number of seconds that has been set" + delay: !input no_motion_wait + - alias: "Turn off the light" + service: light.turn_off + target: !input light_target diff --git a/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml b/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml new file mode 100755 index 0000000..e1e3bd5 --- /dev/null +++ b/config/blueprints/automation/homeassistant/notify_leaving_zone.yaml @@ -0,0 +1,50 @@ +blueprint: + name: Zone Notification + description: Send a notification to a device when a person leaves a specific zone. + domain: automation + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml + author: Home Assistant + input: + person_entity: + name: Person + selector: + entity: + filter: + domain: person + zone_entity: + name: Zone + selector: + entity: + filter: + domain: zone + notify_device: + name: Device to notify + description: Device needs to run the official Home Assistant app to receive notifications. + selector: + device: + filter: + integration: mobile_app + +trigger: + platform: state + entity_id: !input person_entity + +variables: + zone_entity: !input zone_entity + # This is the state of the person when it's in this zone. + zone_state: "{{ states[zone_entity].name }}" + person_entity: !input person_entity + person_name: "{{ states[person_entity].name }}" + +condition: + condition: template + # The first case handles leaving the Home zone which has a special state when zoning called 'home'. + # The second case handles leaving all other zones. + value_template: "{{ zone_entity == 'zone.home' and trigger.from_state.state == 'home' and trigger.to_state.state != 'home' or trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}" + +action: + - alias: "Notify that a person has left the zone" + domain: mobile_app + type: notify + device_id: !input notify_device + message: "{{ person_name }} has left {{ zone_state }}" diff --git a/config/blueprints/script/homeassistant/confirmable_notification.yaml b/config/blueprints/script/homeassistant/confirmable_notification.yaml new file mode 100755 index 0000000..c5f4249 --- /dev/null +++ b/config/blueprints/script/homeassistant/confirmable_notification.yaml @@ -0,0 +1,86 @@ +blueprint: + name: Confirmable Notification + description: >- + A script that sends an actionable notification with a confirmation before + running the specified action. + domain: script + source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml + author: Home Assistant + input: + notify_device: + name: Device to notify + description: Device needs to run the official Home Assistant app to receive notifications. + selector: + device: + filter: + integration: mobile_app + title: + name: "Title" + description: "The title of the button shown in the notification." + default: "" + selector: + text: + message: + name: "Message" + description: "The message body" + selector: + text: + confirm_text: + name: "Confirmation Text" + description: "Text to show on the confirmation button" + default: "Confirm" + selector: + text: + confirm_action: + name: "Confirmation Action" + description: "Action to run when notification is confirmed" + default: [] + selector: + action: + dismiss_text: + name: "Dismiss Text" + description: "Text to show on the dismiss button" + default: "Dismiss" + selector: + text: + dismiss_action: + name: "Dismiss Action" + description: "Action to run when notification is dismissed" + default: [] + selector: + action: + +mode: restart + +sequence: + - alias: "Set up variables" + variables: + action_confirm: "{{ 'CONFIRM_' ~ context.id }}" + action_dismiss: "{{ 'DISMISS_' ~ context.id }}" + - alias: "Send notification" + domain: mobile_app + type: notify + device_id: !input notify_device + title: !input title + message: !input message + data: + actions: + - action: "{{ action_confirm }}" + title: !input confirm_text + - action: "{{ action_dismiss }}" + title: !input dismiss_text + - alias: "Awaiting response" + wait_for_trigger: + - platform: event + event_type: mobile_app_notification_action + event_data: + action: "{{ action_confirm }}" + - platform: event + event_type: mobile_app_notification_action + event_data: + action: "{{ action_dismiss }}" + - choose: + - conditions: "{{ wait.trigger.event.data.action == action_confirm }}" + sequence: !input confirm_action + - conditions: "{{ wait.trigger.event.data.action == action_dismiss }}" + sequence: !input dismiss_action diff --git a/config/blueprints/template/homeassistant/inverted_binary_sensor.yaml b/config/blueprints/template/homeassistant/inverted_binary_sensor.yaml new file mode 100755 index 0000000..5be1840 --- /dev/null +++ b/config/blueprints/template/homeassistant/inverted_binary_sensor.yaml @@ -0,0 +1,27 @@ +blueprint: + name: Invert a binary sensor + description: Creates a binary_sensor which holds the inverted value of a reference binary_sensor + domain: template + source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/template/blueprints/inverted_binary_sensor.yaml + input: + reference_entity: + name: Binary sensor to be inverted + description: The binary_sensor which needs to have its value inverted + selector: + entity: + domain: binary_sensor +variables: + reference_entity: !input reference_entity +binary_sensor: + state: > + {% if states(reference_entity) == 'on' %} + off + {% elif states(reference_entity) == 'off' %} + on + {% else %} + {{ states(reference_entity) }} + {% endif %} + # delay_on: not_used in this example + # delay_off: not_used in this example + # auto_off: not_used in this example + availability: "{{ states(reference_entity) not in ('unknown', 'unavailable') }}" diff --git a/config/configuration.yaml b/config/configuration.yaml new file mode 100755 index 0000000..1dce148 --- /dev/null +++ b/config/configuration.yaml @@ -0,0 +1,27 @@ + +# Loads default set of integrations. Do not remove. +default_config: + +# Load frontend themes from the themes folder +frontend: + themes: !include_dir_merge_named themes + +automation: !include automations.yaml +script: !include scripts.yaml +scene: !include scenes.yaml +template: !include templates.yaml + +http: + use_x_forwarded_for: true + trusted_proxies: + - 10.184.20.2 + - ::1 + - 172.30.33.0/24 + +# Phillps Hue Emulator - for Amazon Echo +#emulated_hue: + # listen_port: 80 + +# Configure Recorder to use PostgreSQL +recorder: + db_url: !secret recorder_db diff --git a/config/scenes.yaml b/config/scenes.yaml new file mode 100755 index 0000000..fe51488 --- /dev/null +++ b/config/scenes.yaml @@ -0,0 +1 @@ +[] diff --git a/config/scripts.yaml b/config/scripts.yaml new file mode 100755 index 0000000..e69de29 diff --git a/config/templates.yaml b/config/templates.yaml new file mode 100755 index 0000000..b865e85 --- /dev/null +++ b/config/templates.yaml @@ -0,0 +1,10 @@ +- trigger: + - platform: state + entity_id: binary_sensor.0xd44867fffe49155d_occupancy + to: "on" + binary_sensor: + - name: "Large Toilet Recently Occupied" + unique_id: large_toilet_recently_occupied + state: "on" + auto_off: "00:15:00" + icon: mdi:run