commit b6e5bf47fee407c6de3e5753359f8a4a171298a6 Author: Joshua Date: Tue Jun 24 12:12:01 2025 -0400 initial commmit diff --git a/.HA_VERSION b/.HA_VERSION new file mode 100644 index 0000000..7dc2a51 --- /dev/null +++ b/.HA_VERSION @@ -0,0 +1 @@ +2025.6.3 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05f5447 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Database files +*.db +*.db-shm +*.db-wal + +# Storage directory +.storage/ +ms365_storage/ +image/ +.cloud/ +www/ +esphome/ +custom_components/ + +# Logs +*.log +*.log.1 +*.log.fault + +## Sensitive stuff +secrets.yaml diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..8592bde --- /dev/null +++ b/automations.yaml @@ -0,0 +1,1201 @@ +- id: '1738951431044' + alias: Turn off living room lights + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.living_room_temp_sensor_occupancy + to: 'off' + for: + hours: 0 + minutes: 1 + seconds: 0 + conditions: + - condition: time + after: '19:00:00' + before: 06:00:00 + weekday: + - sun + - mon + - tue + - wed + - thu + - fri + - sat + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: 77092d966014d6eb6222928cce911caf + - type: turn_off + device_id: 77092d966014d6eb6222928cce911caf + entity_id: af55f6e7e0ffa642407923fc6e8cdaf3 + domain: light + - type: turn_off + device_id: f94b4f4c1b2239789d2c19db7650947d + entity_id: 90375df689a68fe43b63994ae5457d46 + domain: switch + mode: single +- id: '1739061820991' + alias: Turn off washing machine when leak sensed + description: '' + triggers: + - type: moist + device_id: 84e0d8044eb13e64c899357f840dcacb + entity_id: 2f41825acbe754ebfa788a77c197138c + domain: binary_sensor + trigger: device + conditions: [] + actions: + - type: turn_off + device_id: 613a1b8ef47539c9d0ebe6a87b13ca26 + entity_id: 721e7dd29be7dbcb6e634ec5d505c5f4 + domain: switch + - action: notify.notify + metadata: {} + data: + message: Washing Machine Leak Sensor has been triggered - please check! + mode: single +- id: '1739826648241' + alias: Turn on Living room lights motion sense + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.living_room_temp_sensor_motion_2 + to: 'on' + conditions: + - condition: and + conditions: + - condition: sun + after: sunset + - condition: time + before: '23:59:00' + actions: + - action: light.turn_on + metadata: {} + data: + kelvin: 3701 + brightness_pct: 78 + target: + entity_id: + - light.living_room_lamp_1 + - light.living_room_lamp_2 + mode: single +- id: '1739831095321' + alias: Turn Off Living Room Light + description: '' + triggers: + - type: not_occupied + device_id: 6490580c401b733f92ab18ab70c5ed6c + entity_id: 6f20ea0b998c4f901d523bdcd3e5cfc5 + domain: binary_sensor + trigger: device + conditions: + - condition: time + after: '20:00:00' + before: 05:00:00 + weekday: + - sat + - fri + - thu + - wed + - tue + - mon + - sun + actions: + - type: turn_off + device_id: c248988685c61331586bda48ab8469f4 + entity_id: 746fb1f656fcbf25a3614cb6d941c883 + domain: light + - type: turn_off + device_id: 77092d966014d6eb6222928cce911caf + entity_id: af55f6e7e0ffa642407923fc6e8cdaf3 + domain: light + mode: single +- id: '1739835025769' + alias: Turn on bedroom lights with motion + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.master_bedroom_smart_sensor_motion + to: 'on' + conditions: + - condition: time + after: '17:00:00' + before: '22:00:00' + weekday: + - sun + - mon + - tue + - wed + - thu + - fri + - sat + actions: + - type: turn_on + device_id: a8b108e7836eeb9c66cd0169afc4a486 + entity_id: d48390b30da2add2f866a8cec5dc2726 + domain: switch + - type: turn_on + device_id: d371342d65df3ddbd28fb841b6ce0a13 + entity_id: 7df615008eff2c537a1d6ac4be76def4 + domain: switch + - delay: 00:10:00 + mode: single +- id: '1739840523909' + alias: Turn off bedside lights in the evening + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.master_bedroom_smart_sensor_occupancy + to: 'off' + for: + hours: 0 + minutes: 1 + seconds: 0 + conditions: + - condition: time + after: '16:00:00' + before: '20:00:00' + weekday: + - sun + - mon + - tue + - wed + - thu + - fri + - sat + actions: + - type: turn_off + device_id: a8b108e7836eeb9c66cd0169afc4a486 + entity_id: d48390b30da2add2f866a8cec5dc2726 + domain: switch + - type: turn_off + device_id: d371342d65df3ddbd28fb841b6ce0a13 + entity_id: 7df615008eff2c537a1d6ac4be76def4 + domain: switch + mode: single +- id: '1739841110645' + alias: Turn on family room in the morning + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.meat_heater_motion + to: 'on' + conditions: + - condition: time + after: 06:30:00 + before: 07:45:00 + weekday: + - sun + - mon + - tue + - wed + - thu + - fri + - sat + actions: + - action: light.turn_on + metadata: {} + data: + brightness_pct: 24 + kelvin: 5375 + target: + device_id: + - ebe5b855306e22fa875326c566ba8024 + - 6f341a97517eecd7e4befd4633bb0c3a + - type: turn_on + device_id: 389d36aa5a0ecfd3eb2e1ec8795464d0 + entity_id: 0ae75b98556682467fedf0ff441346ef + domain: light + brightness_pct: 20 + enabled: false + mode: single +- id: '1739841729184' + alias: Declan’s Closet Open Notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.declans_closet_door_door + to: 'on' + conditions: + - condition: time + after: '21:00:00' + before: 07:00:00 + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Declan’s Closet is Open + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Declan’s Closet is Open + mode: single +- id: '1739841929885' + alias: Jordyn’s Door Open Notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.jordyns_door_door + to: 'on' + conditions: + - condition: time + after: '19:45:00' + before: 07:45:00 + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Jordyn’s door is open + mode: single +- id: '1739842035606' + alias: Declan’s Door Closed Notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.declans_closet_door_door + to: 'off' + conditions: + - condition: time + after: '21:00:00' + before: 07:00:00 + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Declan’s Closet is Closed + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Declan’s Closet is Closed + mode: single +- id: '1739932866970' + alias: Washing Machine Leak Sensor Battery Low Notification + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.washing_machine_water_sensor_battery + below: 25 + conditions: [] + actions: + - action: notify.persistent_notification + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + mode: single +- id: '1739932945304' + alias: Jordyn's Door Sensor Low Battery Notification + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.jordyns_door_battery + below: 25 + conditions: [] + actions: + - action: notify.persistent_notification + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + mode: single +- id: '1739932994321' + alias: Declan's Closet Door Low Battery Notification + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.declans_closet_door_battery + below: 25 + conditions: [] + actions: + - action: notify.persistent_notification + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + mode: single +- id: '1739933032829' + alias: Deep Freezer Low Battery Notification + description: '' + triggers: + - trigger: numeric_state + entity_id: + - sensor.deep_freezer_battery + below: 25 + conditions: [] + actions: + - action: notify.persistent_notification + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Please change washing machine leak sensor battery soon! + mode: single +- id: '1739933290261' + alias: Deep Freezer Left Open Notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.deep_freezer_door + to: 'on' + for: + hours: 0 + minutes: 2 + seconds: 0 + conditions: [] + actions: + - action: notify.html5 + metadata: {} + data: + message: Deep freezer has been left open - please check. + - action: notify.persistent_notification + metadata: {} + data: + message: Deep freezer has been left open - please check. + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Deep freezer has been left open - please check. + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Deep freezer has been left open - please check. + mode: single +- id: '1739970708082' + alias: Lights On Before Sunrise + description: '' + triggers: + - trigger: sun + event: sunrise + offset: -00:56:00 + conditions: [] + actions: + - type: turn_on + device_id: 00ce230936f351558f177d5ed229759b + entity_id: 9ef15fb77ca7e81bcb6c7551329f50aa + domain: switch + enabled: false + - type: turn_on + device_id: c58fc0103836dffe365aeb33056cee71 + entity_id: 37852e5f667fe36826f2ac1ae9f2376a + domain: switch + - type: turn_on + device_id: 7ed0dde2b0b802820f57f3f9f515adfe + entity_id: de439b7d82897ca4cf67b8aeb53b4eee + domain: switch + - type: turn_on + device_id: a7651ad6e84b4221d2cd4bd5fb8abcc0 + entity_id: 3bbb3cf1cfab7424cc1538c0f89af9f8 + domain: switch + - type: turn_on + device_id: 389d36aa5a0ecfd3eb2e1ec8795464d0 + entity_id: 0ae75b98556682467fedf0ff441346ef + domain: light + mode: single +- id: '1739970910638' + alias: 10PM Turn Jordyn's Lamp Off + description: '' + triggers: + - trigger: time + at: '22:00:00' + conditions: [] + actions: + - type: turn_off + device_id: ef731a5e6e666bf4fc20cc321f596029 + entity_id: 9629035816fddf7de8926e4e4c29aa34 + domain: switch + - type: turn_off + device_id: a7651ad6e84b4221d2cd4bd5fb8abcc0 + entity_id: 3bbb3cf1cfab7424cc1538c0f89af9f8 + domain: switch + mode: single +- id: '1739971192633' + alias: Turn On Lights in Evening + description: '' + triggers: + - trigger: sun + event: sunset + offset: '-01: 30:00' + conditions: [] + actions: + - action: light.turn_on + metadata: {} + data: + brightness_pct: 87 + target: + device_id: + - 6f341a97517eecd7e4befd4633bb0c3a + - 77092d966014d6eb6222928cce911caf + - c248988685c61331586bda48ab8469f4 + - type: turn_on + device_id: e04306aa947ba9901108c363d8109ca0 + entity_id: 12662d2294935b2a21500e3f6d69ba15 + domain: switch + - type: turn_on + device_id: e2343a74462cc1434c4acfa2e32d1364 + entity_id: ea84e174f0fa3316b9923c4254454a37 + domain: switch + - type: turn_on + device_id: c0de273e40c6f4f1cafe4db27e5a6782 + entity_id: e6f4af2d9bc05634f994af34bad9a477 + domain: switch + - type: turn_on + device_id: 270d941ca2262626ddf2e4d122bef688 + entity_id: 773c4281d88f27a8b270d4cc62e60c41 + domain: switch + - type: turn_on + device_id: ebe5b855306e22fa875326c566ba8024 + entity_id: 921d709eb7937eff5935783d7fbea451 + domain: light + brightness_pct: 75 + - type: turn_on + device_id: 389d36aa5a0ecfd3eb2e1ec8795464d0 + entity_id: 0ae75b98556682467fedf0ff441346ef + domain: light + brightness_pct: 50 + - type: turn_on + device_id: 7ed0dde2b0b802820f57f3f9f515adfe + entity_id: de439b7d82897ca4cf67b8aeb53b4eee + domain: switch + mode: single +- id: '1739971331649' + alias: Master Bedroom On At 8PM + description: '' + triggers: + - trigger: time + at: '20:00:00' + conditions: [] + actions: + - type: turn_on + device_id: a8b108e7836eeb9c66cd0169afc4a486 + entity_id: d48390b30da2add2f866a8cec5dc2726 + domain: switch + - type: turn_on + device_id: d371342d65df3ddbd28fb841b6ce0a13 + entity_id: 7df615008eff2c537a1d6ac4be76def4 + domain: switch + - type: turn_on + device_id: 8b5cc6f6d2e727522ad3069656e2020f + entity_id: ff7e86ebc87458f60b69d1599ff06d13 + domain: fan + mode: single +- id: '1739980877023' + alias: Downstairs Lights off at 9AM + description: '' + triggers: + - trigger: time + at: 08:30:00 + conditions: [] + actions: + - type: turn_off + device_id: 8b5cc6f6d2e727522ad3069656e2020f + entity_id: ff7e86ebc87458f60b69d1599ff06d13 + domain: fan + mode: single +- id: '1739997032502' + alias: Echo Plug Power Toggle Automation + description: '' + triggers: + - trigger: time + at: '20:00:00' + conditions: [] + actions: + - type: turn_off + device_id: 31d67bb445f5c8920a1dc076d0d71e76 + entity_id: 6c1fd91e0ff15419f7bdb6b9e233cffc + domain: switch + mode: single +- id: '1740099961116' + alias: Office Lights on with Motion + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.office_smart_sensor_motion + to: 'on' + conditions: [] + actions: + - action: light.turn_on + metadata: {} + data: + brightness_pct: 100 + kelvin: 6500 + target: + device_id: + - 42b9a4c3e4edfd663f2b8a0a95c3997c + - 889b4b9e38814db0249b94d2dea4ae43 + - type: turn_on + device_id: 397d7f06bfbbeaf3014d989a1e32ce07 + entity_id: 92505d68c2d00ef59e8ba61c3e3db32b + domain: switch + - type: turn_on + device_id: e2b7cf374f656d6ffbca52e988ef6ddb + entity_id: 5a8a6ccbe11b22be7e4c2709f647e45d + domain: switch + - type: turn_on + device_id: 2f3691954f1df23a46c2e56507bc15f8 + entity_id: fe769568dfbe1d9497732147552bcdb5 + domain: switch + - type: turn_on + device_id: 3bab21ce27cd2063e2a783fdec386573 + entity_id: 3bd3f6e27efa6dd483510529f3faeb16 + domain: switch + mode: single +- id: '1740100159283' + alias: Turn off lights when no one is in office + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.office_smart_sensor_occupancy + to: 'off' + for: + hours: 1 + minutes: 0 + seconds: 0 + conditions: [] + actions: + - action: light.turn_off + metadata: {} + data: {} + target: + device_id: + - 42b9a4c3e4edfd663f2b8a0a95c3997c + - 889b4b9e38814db0249b94d2dea4ae43 + - type: turn_off + device_id: 397d7f06bfbbeaf3014d989a1e32ce07 + entity_id: 92505d68c2d00ef59e8ba61c3e3db32b + domain: switch + - type: turn_off + device_id: e2b7cf374f656d6ffbca52e988ef6ddb + entity_id: 5a8a6ccbe11b22be7e4c2709f647e45d + domain: switch + - type: turn_off + device_id: 2f3691954f1df23a46c2e56507bc15f8 + entity_id: fe769568dfbe1d9497732147552bcdb5 + domain: switch + - type: turn_off + device_id: 3bab21ce27cd2063e2a783fdec386573 + entity_id: 3bd3f6e27efa6dd483510529f3faeb16 + domain: switch + mode: single +- id: '1740144203014' + alias: 'Office Echo On ' + description: '' + triggers: + - trigger: time + at: 08:00:00 + conditions: [] + actions: + - type: turn_on + device_id: 31d67bb445f5c8920a1dc076d0d71e76 + entity_id: 6c1fd91e0ff15419f7bdb6b9e233cffc + domain: switch + mode: single +- id: '1740144319171' + alias: Living Room Tv On + description: '' + triggers: + - trigger: time + at: 08:00:00 + conditions: [] + actions: + - type: turn_on + device_id: f94b4f4c1b2239789d2c19db7650947d + entity_id: 90375df689a68fe43b63994ae5457d46 + domain: switch + mode: single +- id: '1740929956187' + alias: Turn off Family room when no one is in it. + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.meat_heater_occupancy + to: 'off' + for: + hours: 0 + minutes: 5 + seconds: 0 + conditions: + - condition: or + conditions: + - condition: time + after: '20:00:00' + before: 02:00:00 + weekday: + - sat + - fri + - thu + - wed + - tue + - mon + - sun + - condition: time + after: 09:00:00 + before: '18:00:00' + weekday: + - sat + - fri + - thu + - wed + - tue + - mon + - sun + actions: + - type: turn_off + device_id: ebe5b855306e22fa875326c566ba8024 + entity_id: 921d709eb7937eff5935783d7fbea451 + domain: light + - type: turn_off + device_id: 6f341a97517eecd7e4befd4633bb0c3a + entity_id: 4b21efa79430d63e813137d08a8df60e + domain: light + - type: turn_off + device_id: 389d36aa5a0ecfd3eb2e1ec8795464d0 + entity_id: 0ae75b98556682467fedf0ff441346ef + domain: light + - type: turn_off + device_id: 7ed0dde2b0b802820f57f3f9f515adfe + entity_id: de439b7d82897ca4cf67b8aeb53b4eee + domain: switch + - type: turn_off + device_id: 389d36aa5a0ecfd3eb2e1ec8795464d0 + entity_id: 0ae75b98556682467fedf0ff441346ef + domain: light + mode: single +- id: '1742155095704' + alias: Arm cameras if Joshua leaves + description: '' + triggers: + - trigger: zone + entity_id: device_tracker.joshuas_iphone_of_pain + zone: zone.home + event: leave + conditions: + - condition: not + conditions: + - condition: zone + entity_id: device_tracker.pollys_iphone + zone: zone.home + actions: + - action: camera.enable_motion_detection + metadata: {} + data: {} + target: + device_id: + - 0c13483d761efe3b85e534fadd323fe3 + - 5aa158596e48441ea606dd881a34402d + - 3df00a0796efe006e4ea349a9752faba + - d045a0a68c3c4d52a7beb2a28fdf6993 + - 044c43ea05ceff58b1209f6441c24183 + mode: single +- id: '1742155153966' + alias: Arms Inside Cameras when Polly Leaves + description: '' + triggers: + - trigger: zone + entity_id: device_tracker.pollys_iphone + zone: zone.home + event: leave + conditions: + - condition: not + conditions: + - condition: zone + entity_id: device_tracker.joshuas_iphone_of_pain + zone: zone.home + actions: + - action: camera.enable_motion_detection + metadata: {} + data: {} + target: + device_id: + - 0c13483d761efe3b85e534fadd323fe3 + - 5aa158596e48441ea606dd881a34402d + - 3df00a0796efe006e4ea349a9752faba + - d045a0a68c3c4d52a7beb2a28fdf6993 + - 044c43ea05ceff58b1209f6441c24183 + mode: single +- id: '1742155298923' + alias: Disarm cameras when Joshua comes home + description: '' + triggers: + - trigger: zone + entity_id: device_tracker.joshuas_iphone_of_pain + zone: zone.home + event: enter + conditions: [] + actions: + - action: camera.disable_motion_detection + metadata: {} + data: {} + target: + device_id: + - 3df00a0796efe006e4ea349a9752faba + - 0c13483d761efe3b85e534fadd323fe3 + - 5aa158596e48441ea606dd881a34402d + - d045a0a68c3c4d52a7beb2a28fdf6993 + - 044c43ea05ceff58b1209f6441c24183 + mode: single +- id: '1742155338014' + alias: Disable Cameras when Polly comes home + description: '' + triggers: + - trigger: zone + entity_id: device_tracker.pollys_iphone + zone: zone.home + event: enter + conditions: [] + actions: + - action: camera.disable_motion_detection + metadata: {} + data: {} + target: + device_id: + - 3df00a0796efe006e4ea349a9752faba + - 0c13483d761efe3b85e534fadd323fe3 + - 5aa158596e48441ea606dd881a34402d + - d045a0a68c3c4d52a7beb2a28fdf6993 + - 044c43ea05ceff58b1209f6441c24183 + mode: single +- id: '1742155540986' + alias: 'Garage Floodlight Low Battery Notification ' + description: '' + triggers: + - type: bat_low + device_id: 23f70a816f5dfa9db380cd9d8466bfe1 + entity_id: cb810c9f3ff6177feb2c8d3e98c46f56 + domain: binary_sensor + trigger: device + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Garage floodlight batteries low + mode: single +- id: '1742691391008' + alias: Turn on office echo + description: '' + triggers: + - trigger: time + at: '21:00:00' + conditions: [] + actions: + - type: turn_on + device_id: 31d67bb445f5c8920a1dc076d0d71e76 + entity_id: 6c1fd91e0ff15419f7bdb6b9e233cffc + domain: switch + mode: single +- id: '1742691696852' + alias: Family Room Off at Midnight + description: '' + triggers: + - trigger: time + at: 00:00:00 + conditions: [] + actions: + - type: turn_off + device_id: ebe5b855306e22fa875326c566ba8024 + entity_id: 921d709eb7937eff5935783d7fbea451 + domain: light + - type: turn_off + device_id: 389d36aa5a0ecfd3eb2e1ec8795464d0 + entity_id: 0ae75b98556682467fedf0ff441346ef + domain: light + - type: turn_off + device_id: 6f341a97517eecd7e4befd4633bb0c3a + entity_id: 4b21efa79430d63e813137d08a8df60e + domain: light + - type: turn_off + device_id: 7ed0dde2b0b802820f57f3f9f515adfe + entity_id: de439b7d82897ca4cf67b8aeb53b4eee + domain: switch + mode: single +- id: '1742841280696' + alias: Triple Threat Anti-Stink Juice Empty + description: '' + triggers: + - trigger: state + entity_id: + - sensor.triple_threat_spray_deodorant_liquid + enabled: true + to: '0' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Triple Threat's Anti-Stinky Juice is Empty + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Triple Threat's Anti-Stinky Juice is Empty + - action: notify.mailgun_smtp + metadata: {} + data: + message: Triple Threat's Anti-Stinky Juice is Empty + title: Triple Threat's Anti-Stinky Juice is Empty + target: joshua@cnjmail.com polly@cnjmail.com + mode: single +- id: '1742841650033' + alias: The Deuce Litter Level + description: '' + triggers: + - trigger: state + entity_id: + - sensor.the_deuce_litter_level + enabled: true + to: '65' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: The Deuce's Litter is Low + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: The Deuce's Litter is Low + - action: notify.mailgun_smtp + metadata: {} + data: + message: The Deuce's Litter is Low + title: The Deuce's Litter is Low + target: joshua@cnjmail.com + enabled: false + mode: single +- id: '1742841709247' + alias: Triple Threat Litter Level Notification + description: '' + triggers: + - trigger: state + entity_id: + - sensor.triple_threat_litter_level + enabled: true + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Triple Threat's Litter is Low + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Triple Threat's Litter is Low + - action: notify.mailgun_smtp + metadata: {} + data: + message: Triple Threat's Litter is Low + title: Triple Threat's Litter is Low + target: joshua@cnjmail.com + enabled: false + mode: single +- id: '1742841764585' + alias: Cat Crapper 3000 Low Litter Level Notification + description: '' + triggers: + - trigger: state + entity_id: + - sensor.cat_crapper_3000_litter_level + enabled: true + to: '65' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Cat Crapper 3000's Litter is Low + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Cat Crapper 3000's Litter is Low + mode: single +- id: '1742841838536' + alias: Poop Box Low Litter Level Notification + description: '' + triggers: + - trigger: state + entity_id: + - sensor.poop_box_litter_level + enabled: true + to: '65' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Poop Box's Litter is Low + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Poop Box's Litter is Low + - action: notify.mailgun_smtp + metadata: {} + data: + message: Poop Box's Litter is Low + title: Poop Box's Litter is Low + target: joshua@cnjmail.com + enabled: falsef + mode: single +- id: '1742842192548' + alias: Cat Crapper 3000 is full of crap notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.cat_crapper_3000_wastebin_filled + enabled: true + to: 'on' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Cat Crapper 3000 is full of crap + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Cat Crapper 3000 is full of crap + - action: notify.mailgun_smtp + metadata: {} + data: + message: Cat Crapper 3000 is full of crap + title: CLEAN Cat Crapper 3000 - it's full of crap + target: joshua@cnjmail.com + enabled: false + mode: single +- id: '1742842261527' + alias: The Deuce is full of deuces notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.the_deuce_wastebin_filled + enabled: true + to: 'on' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: The Deuce is full of deuces + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: The Deuce is full of deuces + - action: notify.mailgun_smtp + metadata: {} + data: + message: The Deuce is full of deuces + title: Too many dueces have been dropped! + target: joshua@cnjmail.com + enabled: false + mode: single +- id: '1742842372471' + alias: The Poop Box has runneth over Notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.poop_box_wastebin_filled + enabled: true + to: 'on' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: The Poop Box has runneth over + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: The Poop Box has runneth over + - action: notify.mailgun_smtp + metadata: {} + data: + message: The poop box has too many presents! + title: The poop box is bursting!! + target: joshua@cnjmail.com + enabled: false + mode: single +- id: '1742842458817' + alias: Triple Threat Full Notification + description: '' + triggers: + - trigger: state + entity_id: + - binary_sensor.triple_threat_wastebin_filled + enabled: true + to: 'on' + conditions: [] + actions: + - action: notify.mobile_app_joshuas_iphone_of_pain + metadata: {} + data: + message: Triple Threat can't take no more! + - action: notify.mobile_app_pollys_iphone + metadata: {} + data: + message: Triple Threat can't take no more! + - action: notify.mailgun_smtp + metadata: {} + data: + message: The Triple Threat is down for the count! + title: Triple Threat can't take no more! + target: joshua@cnjmail.com + enabled: false + mode: single +- id: '1743176311797' + alias: Bambu Lab - Spaghetti Detection + description: '' + use_blueprint: + path: nberktumer/spaghetti_detection.yaml + input: + home_assistant_host: http://192.168.1.189:8123 + obico_host: http://192.168.1.85:3333 + obico_auth_token: 5b3dd0ff-7e41-47f4-9027-9e609813ae66 + printer_current_stage_sensor: sensor.p1s_01p09c470102673_current_stage + printer_print_status_sensor: sensor.p1s_01p09c470102673_print_status + printer_camera: camera.p1s_01p09c470102673_camera + printer_pause_button: button.p1s_01p09c470102673_pause_printing + printer_resume_button: button.p1s_01p09c470102673_resume_printing + printer_stop_button: button.p1s_01p09c470102673_stop_printing + printer_chamber_light: light.p1s_01p09c470102673_chamber_light + detection_frequency: /30 + notification_settings: critical + notification_service: notify.mobile_app_joshuas_iphone_of_pain +- id: '1743380000904' + alias: Jordyn-Bedtime-Snack-Notification-Weekend + description: Triggers an Alexa notification at 7:30 PM if the M365 Calendar event + is 'Girls at Home' + triggers: + - at: '20:00:00' + trigger: time + enabled: true + conditions: + - condition: state + entity_id: calendar.m365_family_events + state: 'on' + - condition: template + value_template: '{{ state_attr(''calendar.m365_family_events'', ''message'') == + ''Girls at Home'' }}' + actions: + - data: + message: Jordyn, time to put away screens and get a bedtime snack. + action: notify.alexa_media_living_room + mode: single +- id: '1743381226135' + alias: Jordyn-Bedtime-Snack-Notification + description: '' + triggers: + - trigger: time + at: '20:00:00' + conditions: + - condition: and + conditions: + - condition: time + enabled: true + before: '19:45:00' + after: '19:00:00' + weekday: + - mon + - tue + actions: + - action: notify.alexa_media_living_room + metadata: {} + data: + message: Jordyn, time to put away screens and get a bedtime snack. + mode: single +- id: '1743385356527' + alias: Jordyn’s Light on at 7PM + description: '' + triggers: + - trigger: time + at: '19:00:00' + conditions: + - condition: time + weekday: + - mon + - tue + actions: + - type: turn_on + device_id: ef731a5e6e666bf4fc20cc321f596029 + entity_id: 9629035816fddf7de8926e4e4c29aa34 + domain: switch + mode: single +- id: '1743385432089' + alias: Jordyn’s light on weekend + description: '' + triggers: + - trigger: time + at: '19:00:00' + conditions: + - condition: and + conditions: + - condition: time + weekday: + - fri + - sat + - sun + - condition: template + value_template: '{{ now().strftime(''%U'') | int % 2 == 1 }}' + actions: + - type: turn_on + device_id: ef731a5e6e666bf4fc20cc321f596029 + entity_id: 9629035816fddf7de8926e4e4c29aa34 + domain: switch + mode: single +- id: '1744560941050' + alias: Jordyn’s Lamp on at 730 + description: '' + triggers: + - trigger: time + at: '19:30:00' + conditions: [] + actions: + - type: turn_on + device_id: ef731a5e6e666bf4fc20cc321f596029 + entity_id: 9629035816fddf7de8926e4e4c29aa34 + domain: switch + mode: single diff --git a/blueprints/automation/homeassistant/motion_light.yaml b/blueprints/automation/homeassistant/motion_light.yaml new file mode 100644 index 0000000..1190070 --- /dev/null +++ b/blueprints/automation/homeassistant/motion_light.yaml @@ -0,0 +1,58 @@ +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: occupancy + domain: binary_sensor + - 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 + +triggers: + trigger: state + entity_id: !input motion_entity + from: "off" + to: "on" + +actions: + - alias: "Turn on the light" + action: light.turn_on + target: !input light_target + - alias: "Wait until there is no motion from device" + wait_for_trigger: + trigger: 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" + action: light.turn_off + target: !input light_target diff --git a/blueprints/automation/homeassistant/notify_leaving_zone.yaml b/blueprints/automation/homeassistant/notify_leaving_zone.yaml new file mode 100644 index 0000000..e072aad --- /dev/null +++ b/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 + +triggers: + trigger: 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 }}" + +conditions: + 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 }}" + +actions: + - 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/blueprints/automation/nberktumer/spaghetti_detection.yaml b/blueprints/automation/nberktumer/spaghetti_detection.yaml new file mode 100644 index 0000000..570f1d0 --- /dev/null +++ b/blueprints/automation/nberktumer/spaghetti_detection.yaml @@ -0,0 +1,514 @@ +blueprint: + name: Bambu Lab - Spaghetti Detection + description: Bambu Lab - Spaghetti Detection + domain: automation + input: + home_assistant_host: + name: Home Assistant Host + description: Home Assistant host + default: http://192.168.1.123:8123 + obico_host: + name: Obico ML API Host + description: Obico ML API host + default: http://192.168.1.123:3333 + obico_auth_token: + name: Obico ML API Auth Token + description: Obico ML API authentication token + default: obico_api_secret + detection_frequency: + name: Detection Frequency + description: The detection algorithm will run in every defined seconds + default: /5 + selector: + select: + options: + - label: Every second + value: /1 + - label: Every 5 seconds + value: /5 + - label: Every 10 seconds + value: /10 + - label: Every 30 seconds + value: /30 + - label: Every 60 seconds + value: /59 + multiple: false + mode: dropdown + sort: false + custom_value: false + auto_turn_on_light: + name: Automatically Turn On Printer Lights + description: Turns on printer lights before spaghetti detection operation + default: true + selector: + boolean: {} + notification_settings: + name: Notification Settings + description: Type of notification to send after detecting a failure + default: standard + selector: + select: + mode: dropdown + options: + - label: Critical Notification + value: critical + - label: Standard Notification + value: standard + - label: None + value: none + sort: false + multiple: false + custom_value: false + failure_action: + name: On Failure Action + description: What to do after detecting a failure + default: pause + selector: + select: + mode: dropdown + options: + - label: Pause + value: pause + - label: Stop + value: stop + - label: Warn + value: warn + sort: false + multiple: false + custom_value: false + notification_service: + name: Mobile devices notification service + description: The notification service for mobile devices (eg. notify.mobile_app_). + You can provide both a notify group or a single notify device here. + default: notify.notify + selector: + text: {} + printer_print_status_sensor: + name: Printer Print Status Sensor + description: Bambu Lab printer print status sensor + selector: + entity: + filter: + - integration: bambu_lab + domain: + - sensor + device_class: + - enum + multiple: false + printer_current_stage_sensor: + name: Printer Current Stage Sensor + description: Bambu Lab printer current stage sensor + selector: + entity: + filter: + - integration: bambu_lab + domain: + - sensor + device_class: + - enum + multiple: false + printer_camera: + name: Printer Camera Entity + description: Bambu Lab printer camera entity + selector: + entity: + filter: + - domain: + - camera + multiple: false + printer_pause_button: + name: Printer Pause Button Entity + description: Bambu Lab printer pause button entity + selector: + entity: + filter: + - integration: bambu_lab + domain: + - button + multiple: false + printer_resume_button: + name: Printer Resume Button Entity + description: Bambu Lab printer resume button entity + selector: + entity: + filter: + - integration: bambu_lab + domain: + - button + multiple: false + printer_stop_button: + name: Printer Stop Button Entity + description: Bambu Lab printer stop button entity + selector: + entity: + filter: + - integration: bambu_lab + domain: + - button + multiple: false + printer_chamber_light: + name: Printer Chamber Light + description: Bambu Lab printer chamber light + selector: + entity: + filter: + - integration: bambu_lab + domain: + - light + multiple: false + source_url: https://github.com/nberktumer/ha-bambu-lab-p1-spaghetti-detection/blob/main/blueprints/spaghetti_detection.yaml +variables: + HOME_ASSISTANT_HOST_VAR: !input home_assistant_host + PRINTER_CAMERA_VAR: !input printer_camera + FAILURE_ACTION_VAR: !input failure_action + NOTIFICATION_SETTINGS_VAR: !input notification_settings + DETECTION_FREQUENCY_VAR: !input detection_frequency +mode: single +max_exceeded: silent +trigger: +- platform: state + entity_id: + - !input printer_current_stage_sensor + to: printing + id: BAMBU_LAB_PRINTER_STAGE_CHANGE +- platform: event + event_type: mobile_app_notification_action + id: BAMBU_LAB_PAUSE_PRINTING + event_data: + action: BAMBU_LAB_PAUSE_PRINTING +- platform: event + event_type: mobile_app_notification_action + id: BAMBU_LAB_RESUME_PRINTING + event_data: + action: BAMBU_LAB_RESUME_PRINTING +- platform: event + event_type: mobile_app_notification_action + id: BAMBU_LAB_STOP_PRINTING + event_data: + action: BAMBU_LAB_STOP_PRINTING +- trigger: time_pattern + id: BAMBU_LAB_DETECTION_TRIGGER + seconds: !input detection_frequency +condition: [] +action: +- choose: + - conditions: + - condition: trigger + id: BAMBU_LAB_PRINTER_STAGE_CHANGE + sequence: + - service: number.set_value + data: + value: 0 + target: + entity_id: + - number.bambu_lab_p1_spaghetti_detection_current_frame_number + - number.bambu_lab_p1_spaghetti_detection_ewm_mean + - number.bambu_lab_p1_spaghetti_detection_rolling_mean_short + - number.bambu_lab_p1_spaghetti_detection_rolling_mean_long + - number.bambu_lab_p1_spaghetti_detection_normalized_p + - number.bambu_lab_p1_spaghetti_detection_adjusted_ewm_mean + - number.bambu_lab_p1_spaghetti_detection_p_sum + - if: + - condition: and + conditions: + - condition: state + entity_id: !input printer_chamber_light + state: 'off' + - condition: template + value_template: !input auto_turn_on_light + then: + - service: light.turn_on + target: + entity_id: + - !input printer_chamber_light + - conditions: + - condition: trigger + id: + - BAMBU_LAB_PAUSE_PRINTING + - BAMBU_LAB_RESUME_PRINTING + - BAMBU_LAB_STOP_PRINTING + sequence: + - choose: + - conditions: + - condition: trigger + id: + - BAMBU_LAB_PAUSE_PRINTING + sequence: + - service: button.press + data: {} + target: + entity_id: !input printer_pause_button + - conditions: + - condition: trigger + id: BAMBU_LAB_RESUME_PRINTING + sequence: + - service: button.press + data: {} + target: + entity_id: !input printer_resume_button + - conditions: + - condition: trigger + id: BAMBU_LAB_STOP_PRINTING + sequence: + - service: button.press + data: {} + target: + entity_id: !input printer_stop_button + - conditions: + - condition: trigger + id: BAMBU_LAB_DETECTION_TRIGGER + sequence: + - if: + - condition: not + conditions: + - condition: state + entity_id: !input printer_print_status_sensor + state: running + then: + - stop: '' + - if: + - condition: template + value_template: '{{ now().second % DETECTION_FREQUENCY_VAR > 0 }}' + then: + - stop: '' + - if: + - condition: and + conditions: + - condition: state + entity_id: !input printer_chamber_light + state: 'off' + - condition: template + value_template: !input auto_turn_on_light + then: + - service: light.turn_on + target: + entity_id: + - !input printer_chamber_light + - service: bambu_lab_p1_spaghetti_detection.predict + data: + obico_host: !input obico_host + obico_auth_token: !input obico_auth_token + image_url: '{{ HOME_ASSISTANT_HOST_VAR }}{{ state_attr(PRINTER_CAMERA_VAR, + ''entity_picture'') }}' + response_variable: result + - service: number.set_value + data: + value: '{{ result.result.detections | map(attribute=1) | sum | float }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_p_sum + - service: number.set_value + data: + value: '{{ states(''number.bambu_lab_p1_spaghetti_detection_current_frame_number'') + | float + 1 }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_current_frame_number + - service: number.set_value + data: + value: '{{ states(''number.bambu_lab_p1_spaghetti_detection_lifetime_frame_number'') + | float + 1 }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_lifetime_frame_number + - service: number.set_value + data: + value: '{{ (states(''number.bambu_lab_p1_spaghetti_detection_p_sum'') | float) + * (2 / (12 + 1)) + (states(''number.bambu_lab_p1_spaghetti_detection_ewm_mean'') + | float) * (1 - (2 / (12 + 1))) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_ewm_mean + - service: number.set_value + data: + value: '{{ (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_short'') + | float) + ((states(''number.bambu_lab_p1_spaghetti_detection_p_sum'') | + float) - (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_short'') + | float)) / (310 if 310 <= (states(''number.bambu_lab_p1_spaghetti_detection_current_frame_number'') + | float) else (states(''number.bambu_lab_p1_spaghetti_detection_current_frame_number'') + | float) + 1) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_rolling_mean_short + - service: number.set_value + data: + value: '{{ (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_long'') + | float) + ((states(''number.bambu_lab_p1_spaghetti_detection_p_sum'') | + float) - (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_long'') + | float)) / (7200 if 7200 <= (states(''number.bambu_lab_p1_spaghetti_detection_lifetime_frame_number'') + | float) else (states(''number.bambu_lab_p1_spaghetti_detection_lifetime_frame_number'') + | float) + 1) }}' + entity_id: number.bambu_lab_p1_spaghetti_detection_rolling_mean_long + - if: + - condition: numeric_state + entity_id: number.bambu_lab_p1_spaghetti_detection_current_frame_number + below: 30 + then: + - stop: '' + alias: if current_frame_num < 30 + - service: number.set_value + data: + value: '{{ (states(''number.bambu_lab_p1_spaghetti_detection_ewm_mean'') | + float) - (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_long'') + | float) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_adjusted_ewm_mean + - service: number.set_value + data: + value: '{{ ((states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_short'') + | float) - (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_long'') + | float)) * 3.8 }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_rolling_mean_diff + - service: number.set_value + data: + value: '{{ min(0.78, max(0.33, (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_diff'') + | float))) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_thresh_warning + - service: number.set_value + data: + value: '{{ (states(''number.bambu_lab_p1_spaghetti_detection_thresh_warning'') + | float) * 1.75 }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_thresh_failure + - service: number.set_value + data: + value: '{{ (states(''number.bambu_lab_p1_spaghetti_detection_ewm_mean'') | + float) - (states(''number.bambu_lab_p1_spaghetti_detection_rolling_mean_long'') + | float) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_p + - choose: + - conditions: + - condition: numeric_state + entity_id: number.bambu_lab_p1_spaghetti_detection_p + above: number.bambu_lab_p1_spaghetti_detection_thresh_failure + sequence: + - service: number.set_value + data: + value: '{{ min(1.0, max(2.0 / 3.0, ((((states(''number.bambu_lab_p1_spaghetti_detection_p'') + | float) - (states(''number.bambu_lab_p1_spaghetti_detection_thresh_failure'') + | float)) * (1.0 - 2.0 / 3.0)) / ((states(''number.bambu_lab_p1_spaghetti_detection_thresh_failure'') + | float) * 1.5 - (states(''number.bambu_lab_p1_spaghetti_detection_thresh_failure'') + | float))) + 2.0 / 3.0)) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_normalized_p + - conditions: + - condition: numeric_state + entity_id: number.bambu_lab_p1_spaghetti_detection_p + above: number.bambu_lab_p1_spaghetti_detection_thresh_warning + sequence: + - service: number.set_value + data: + value: '{{ min(2.0 / 3.0, max(1.0 / 3.0, ((((states(''number.bambu_lab_p1_spaghetti_detection_p'') + | float) - (states(''number.bambu_lab_p1_spaghetti_detection_thresh_warning'') + | float)) * (2.0 / 3.0 - 1.0 / 3.0)) / ((states(''number.bambu_lab_p1_spaghetti_detection_thresh_failure'') + | float) - (states(''number.bambu_lab_p1_spaghetti_detection_thresh_warning'') + | float))) + 1.0 / 3.0)) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_normalized_p + default: + - service: number.set_value + data: + value: '{{ min(1.0 / 3.0, max(0, ((states(''number.bambu_lab_p1_spaghetti_detection_p'') + | float) * 1.0 / 3.0) / (states(''number.bambu_lab_p1_spaghetti_detection_thresh_warning'') + | float))) }}' + target: + entity_id: number.bambu_lab_p1_spaghetti_detection_normalized_p + - if: + - condition: numeric_state + entity_id: number.bambu_lab_p1_spaghetti_detection_adjusted_ewm_mean + below: 0.38 + then: + - stop: '' + - if: + - condition: and + conditions: + - condition: numeric_state + entity_id: number.bambu_lab_p1_spaghetti_detection_adjusted_ewm_mean + below: 0.78 + - condition: numeric_state + entity_id: number.bambu_lab_p1_spaghetti_detection_adjusted_ewm_mean + below: number.bambu_lab_p1_spaghetti_detection_rolling_mean_diff + then: + - stop: '' + - if: + - condition: template + value_template: '{{ now() - states(''datetime.bambu_lab_p1_spaghetti_detection_last_notify_time'') + | as_datetime | as_local < timedelta(minutes=1) }}' + then: + - stop: '' + alias: if now() - last_notify_time < 1min + - choose: + - conditions: + - condition: template + value_template: '{{ FAILURE_ACTION_VAR == ''pause'' }}' + sequence: + - service: button.press + data: {} + target: + entity_id: !input printer_pause_button + - conditions: + - condition: template + value_template: '{{ FAILURE_ACTION_VAR == ''stop'' }}' + sequence: + - service: button.press + data: {} + target: + entity_id: !input printer_stop_button + - choose: + - conditions: + - condition: template + value_template: '{{ NOTIFICATION_SETTINGS_VAR == ''critical'' }}' + sequence: + - service: !input notification_service + data: + title: Bambu Lab - Spaghetti Detected + message: 'Confidence: {{ (states(''number.bambu_lab_p1_spaghetti_detection_normalized_p'') + | float * 100) | int }}%' + data: + image: '{{ HOME_ASSISTANT_HOST_VAR }}{{ state_attr(PRINTER_CAMERA_VAR, + ''entity_picture'') }}' + ttl: 0 + priority: high + channel: alarm_stream + push: + sound: + name: default + critical: 1 + volume: 0.75 + actions: + - action: BAMBU_LAB_RESUME_PRINTING + title: Resume Printing + - action: BAMBU_LAB_STOP_PRINTING + title: Stop Printing + - conditions: + - condition: template + value_template: '{{ NOTIFICATION_SETTINGS_VAR == ''standard'' }}' + sequence: + - service: !input notification_service + data: + title: Bambu Lab - Spaghetti Detected + message: 'Confidence: {{ (states(''number.bambu_lab_p1_spaghetti_detection_normalized_p'') + | float * 100) | int }}%' + data: + image: '{{ HOME_ASSISTANT_HOST_VAR }}{{ state_attr(PRINTER_CAMERA_VAR, + ''entity_picture'') }}' + actions: + - action: BAMBU_LAB_RESUME_PRINTING + title: Resume Printing + - action: BAMBU_LAB_STOP_PRINTING + title: Stop Printing + - service: number.set_value + data: + value: 0 + target: + entity_id: + - number.bambu_lab_p1_spaghetti_detection_current_frame_number + - number.bambu_lab_p1_spaghetti_detection_ewm_mean + - number.bambu_lab_p1_spaghetti_detection_rolling_mean_short + - number.bambu_lab_p1_spaghetti_detection_rolling_mean_long + - number.bambu_lab_p1_spaghetti_detection_normalized_p + - number.bambu_lab_p1_spaghetti_detection_adjusted_ewm_mean + - number.bambu_lab_p1_spaghetti_detection_p_sum + - service: datetime.set_value + data: + datetime: '{{ now() }}' + target: + entity_id: datetime.bambu_lab_p1_spaghetti_detection_last_notify_time diff --git a/blueprints/script/homeassistant/confirmable_notification.yaml b/blueprints/script/homeassistant/confirmable_notification.yaml new file mode 100644 index 0000000..c5f4249 --- /dev/null +++ b/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/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..efbcba6 --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,38 @@ + +# 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 +http: + use_x_frame_options: false + use_x_forwarded_for: true + trusted_proxies: + - 192.168.1.180 + - 192.168.1.1 + - 192.168.1.62 + - 192.168.1.210 +### SMTP +notify: + - name: "mailgun_smtp" + platform: smtp + server: "smtp.mailgun.org" + port: 587 + timeout: 15 + sender: "nukamail@vault983.com" + encryption: starttls + username: "nukamail@mail.vault983.com" + password: !secret email_password + recipient: + - "joshua@cnjmail.com" + - "polly@cnjmail.com" + sender_name: "Vault 983 Home Assistant" + - name: dakboard_json + platform: file + filename: /config/www/status.json + timestamp: false \ No newline at end of file diff --git a/html5_push_registrations.conf b/html5_push_registrations.conf new file mode 100644 index 0000000..6733b39 --- /dev/null +++ b/html5_push_registrations.conf @@ -0,0 +1,13 @@ +{ + "nukahome": { + "subscription": { + "endpoint": "https://fcm.googleapis.com/fcm/send/dOIj42E2m5c:APA91bElVAor8OXkkIMZei5Mc5pbqhC5yO7mXvev3hIghsqoH4yFvhvgeuzVEJUAAADx35cKhng7QdcFreX2R-vyB6Al2_0kGwMDoKDeNXGaArnW6u_NGbA4QI4Jmvi0SI0z3EmpL196", + "expirationTime": null, + "keys": { + "p256dh": "BIhL4UpI-egHRd_zV9LSnRuLEWs1kTuaDtmGYpUbbaJkMjupWDSMFRcWlrty_656xHYzmfXLPnnUrvvj2hPlP8k", + "auth": "aF2Qqs6VDhogobRO3zbP4A" + } + }, + "browser": "chrome" + } +} \ No newline at end of file diff --git a/scenes.yaml b/scenes.yaml new file mode 100644 index 0000000..e69de29 diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 0000000..e69de29 diff --git a/scripts/update_dakboard.sh b/scripts/update_dakboard.sh new file mode 100755 index 0000000..e69de29