diff options
| author | root <root@smartpi.suren.me> | 2023-01-10 07:45:02 +0400 | 
|---|---|---|
| committer | root <root@smartpi.suren.me> | 2023-01-10 07:45:02 +0400 | 
| commit | 2c0c331eb7b7a03152309bbbd4e0fee157e8d86c (patch) | |
| tree | 03391160212b39c4597ecc26010f2ba1235a65e3 | |
| download | hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.gz hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.bz2 hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.xz hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.zip  | |
Initial configuration
46 files changed, 5321 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee8a9f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +.HA_VERSION +secrets.yaml +keys +backups +custom_components +*\.log +*\.log\.* +*\.db +*\.db-* +themes +www + +.storage/auth +.storage/auth_module.totp +.storage/auth_provider.homeassistant +.storage/core.analytics +.storage/core.entity_registry +.storage/core.restore_state +.storage/core.uuid +.storage/frontend.user_data_31a296cc30a243089f121cef93b46cc0 +.storage/frontend.user_data_fc5071ef5c3c441ea15903aa679e796f +.storage/hacs.critical +.storage/hacs.hacs +.storage/hacs.repositories +.storage/homekit_controller-entity-map +.storage/http +.storage/http.auth +.storage/mobile_app +.storage/onboarding +.storage/trace.saved_traces + +# This is part of config (but may contain security entities) +.storage/core.config_entries +.storage/core.device_registry +.storage/sonoff/ diff --git a/.storage/core.area_registry b/.storage/core.area_registry new file mode 100644 index 0000000..4225896 --- /dev/null +++ b/.storage/core.area_registry @@ -0,0 +1,49 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "core.area_registry", +    "data": { +        "areas": [ +            { +                "name": "Living Room", +                "id": "living_room", +                "picture": null +            }, +            { +                "name": "Kitchen", +                "id": "kitchen", +                "picture": null +            }, +            { +                "name": "Bedroom", +                "id": "bedroom", +                "picture": null +            }, +            { +                "name": "Hall", +                "id": "hall", +                "picture": null +            }, +            { +                "name": "Virtual", +                "id": "virtual", +                "picture": null +            }, +            { +                "name": "Bathroom", +                "id": "bathroom", +                "picture": null +            }, +            { +                "name": "Portable", +                "id": "portable", +                "picture": null +            }, +            { +                "name": "Guestroom", +                "id": "guestroom", +                "picture": null +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/core.config b/.storage/core.config new file mode 100644 index 0000000..40052c9 --- /dev/null +++ b/.storage/core.config @@ -0,0 +1,16 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "core.config", +    "data": { +        "latitude": 40.20199333859466, +        "longitude": 44.48050969769397, +        "elevation": 1050, +        "unit_system": "metric", +        "location_name": "Halabyan24", +        "time_zone": "Asia/Yerevan", +        "external_url": null, +        "internal_url": null, +        "currency": "EUR" +    } +}
\ No newline at end of file diff --git a/.storage/energy b/.storage/energy new file mode 100644 index 0000000..5f2fb7e --- /dev/null +++ b/.storage/energy @@ -0,0 +1,140 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "energy", +    "data": { +        "energy_sources": [ +            { +                "type": "grid", +                "flow_from": [ +                    { +                        "stat_energy_from": "sensor.living_office_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.living_office_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.kitchen_oven_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.kitchen_oven_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.kitchen_wash_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.kitchen_wash_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.kitchen_teatable_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.kitchen_teatable_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.bedroom_aircon_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.bedroom_aircon_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.bedroom_roof_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.bedroom_roof_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.hall_camera_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.hall_camera_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.kitchen_ledlights_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.kitchen_ledlights_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.living_tablelamp_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.living_tablelamp_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.bedroom_tablelamp_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.bedroom_tablelamp_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    }, +                    { +                        "stat_energy_from": "sensor.bedroom_bedsidelampsocket_energy", +                        "stat_cost": null, +                        "entity_energy_from": "sensor.bedroom_bedsidelampsocket_energy", +                        "entity_energy_price": null, +                        "number_energy_price": null +                    } +                ], +                "flow_to": [], +                "cost_adjustment_day": 0.0 +            } +        ], +        "device_consumption": [ +            { +                "stat_consumption": "sensor.kitchen_oven_energy" +            }, +            { +                "stat_consumption": "sensor.kitchen_wash_energy" +            }, +            { +                "stat_consumption": "sensor.kitchen_teatable_energy" +            }, +            { +                "stat_consumption": "sensor.bedroom_aircon_energy" +            }, +            { +                "stat_consumption": "sensor.office_aircon_energy" +            }, +            { +                "stat_consumption": "sensor.living_office_energy" +            }, +            { +                "stat_consumption": "sensor.office_shelfbottom_energy" +            }, +            { +                "stat_consumption": "sensor.office_shelftop_energy" +            }, +            { +                "stat_consumption": "sensor.office_table_energy" +            }, +            { +                "stat_consumption": "sensor.bedroom_roof_energy" +            }, +            { +                "stat_consumption": "sensor.hall_camera_energy" +            }, +            { +                "stat_consumption": "sensor.kitchen_ledlights_energy" +            }, +            { +                "stat_consumption": "sensor.bedroom_bedsidelampsocket_energy" +            }, +            { +                "stat_consumption": "sensor.bedroom_tablelamp_energy" +            }, +            { +                "stat_consumption": "sensor.living_tablelamp_energy" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/input_boolean b/.storage/input_boolean new file mode 100644 index 0000000..ea55fac --- /dev/null +++ b/.storage/input_boolean @@ -0,0 +1,46 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "input_boolean", +    "data": { +        "items": [ +            { +                "name": "Mode Away", +                "id": "away_mode" +            }, +            { +                "name": "State Office Button Pressed", +                "icon": "mdi:state-machine", +                "id": "office_button_pressed" +            }, +            { +                "name": "Mode Guests", +                "id": "mode_guests" +            }, +            { +                "name": "Mode Alone", +                "id": "mode_alone" +            }, +            { +                "name": "Mode Production", +                "id": "mode_production" +            }, +            { +                "name": "State Office Knob Pressed", +                "id": "state_office_knob_pressed" +            }, +            { +                "name": "Mode House Sleep", +                "id": "mode_house_sleep" +            }, +            { +                "name": "Mode House Hibernate", +                "id": "mode_house_hibernate" +            }, +            { +                "name": "Mode Bright", +                "id": "mode_bright" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/input_button b/.storage/input_button new file mode 100644 index 0000000..f93f6f1 --- /dev/null +++ b/.storage/input_button @@ -0,0 +1,21 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "input_button", +    "data": { +        "items": [ +            { +                "name": "Button Confirm", +                "id": "button_confirm" +            }, +            { +                "name": "Button Ring or Warn", +                "id": "button_ring_or_warn" +            }, +            { +                "name": "Button Alert", +                "id": "button_alert" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/input_datetime b/.storage/input_datetime new file mode 100644 index 0000000..3a5d0f2 --- /dev/null +++ b/.storage/input_datetime @@ -0,0 +1,8 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "input_datetime", +    "data": { +        "items": [] +    } +}
\ No newline at end of file diff --git a/.storage/input_number b/.storage/input_number new file mode 100644 index 0000000..b5a1496 --- /dev/null +++ b/.storage/input_number @@ -0,0 +1,8 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "input_number", +    "data": { +        "items": [] +    } +}
\ No newline at end of file diff --git a/.storage/lovelace.lovelace_climate b/.storage/lovelace.lovelace_climate new file mode 100644 index 0000000..b17f2fd --- /dev/null +++ b/.storage/lovelace.lovelace_climate @@ -0,0 +1,164 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace.lovelace_climate", +    "data": { +        "config": { +            "views": [ +                { +                    "title": "Home", +                    "cards": [ +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "entities", +                                    "title": "Office Climate", +                                    "entities": [ +                                        { +                                            "entity": "sensor.ble_temperature_a4c138bfa169" +                                        }, +                                        { +                                            "entity": "sensor.ble_humidity_a4c138bfa169" +                                        } +                                    ] +                                }, +                                { +                                    "type": "entities", +                                    "title": "Office Climate Control", +                                    "entities": [ +                                        { +                                            "entity": "switch.smart_power_strip_pro_socket_2" +                                        }, +                                        { +                                            "entity": "scene.lg_aircon_cool_18" +                                        }, +                                        { +                                            "entity": "scene.lg_aircon_warm_25" +                                        }, +                                        { +                                            "entity": "scene.lg_aircon_power_off" +                                        } +                                    ] +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "sensor.ble_temperature_a4c138bfa169" +                                        }, +                                        { +                                            "entity": "sensor.ble_humidity_a4c138bfa169" +                                        } +                                    ], +                                    "title": "Office Progress", +                                    "hours_to_show": 2 +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "entities", +                                    "title": "Bedroom Climate", +                                    "entities": [ +                                        { +                                            "entity": "sensor.bedroom_temp_temperature" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_temp_humidity" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_temp_pressure" +                                        } +                                    ] +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "switch.bedroom_aircon" +                                        }, +                                        { +                                            "entity": "scene.hyundai_aircon_cool_18" +                                        }, +                                        { +                                            "entity": "scene.hyundai_aircon_warm_28" +                                        }, +                                        { +                                            "entity": "scene.hyundai_aircon_off" +                                        } +                                    ], +                                    "title": "Bedroom Climate Control" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "sensor.bedroom_temp_temperature" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_temp_humidity" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_temp_pressure" +                                        } +                                    ], +                                    "title": "Bedroom Progress", +                                    "hours_to_show": 2 +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "sensor.hall_smoke_temperature" +                                        } +                                    ], +                                    "title": "Hall Climate" +                                }, +                                { +                                    "show_current": true, +                                    "show_forecast": true, +                                    "type": "weather-forecast", +                                    "entity": "weather.halabyan24", +                                    "name": "Yerevan" +                                }, +                                { +                                    "type": "history-graph", +                                    "title": "Trends", +                                    "hours_to_show": 72, +                                    "entities": [ +                                        { +                                            "entity": "sensor.bedroom_temp_temperature" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_temp_humidity" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_temp_pressure" +                                        }, +                                        { +                                            "entity": "sensor.ble_temperature_a4c138bfa169" +                                        }, +                                        { +                                            "entity": "sensor.ble_humidity_a4c138bfa169" +                                        }, +                                        { +                                            "entity": "sensor.hall_smoke_temperature" +                                        } +                                    ] +                                } +                            ] +                        } +                    ] +                } +            ] +        } +    } +}
\ No newline at end of file diff --git a/.storage/lovelace.lovelace_control b/.storage/lovelace.lovelace_control new file mode 100644 index 0000000..6e87b1c --- /dev/null +++ b/.storage/lovelace.lovelace_control @@ -0,0 +1,366 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace.lovelace_control", +    "data": { +        "config": { +            "views": [ +                { +                    "title": "Control", +                    "cards": [ +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "custom:restriction-card", +                                    "restrictions": { +                                        "confirm": { +                                            "exemptions": null +                                        } +                                    }, +                                    "card": { +                                        "type": "entities", +                                        "entities": [ +                                            { +                                                "entity": "input_boolean.mode_away", +                                                "name": "Away" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_production", +                                                "name": "Loud" +                                            }, +                                            { +                                                "type": "divider" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_house_sleep", +                                                "name": "House Sleep" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_house_hibernate", +                                                "name": "House Hibernate" +                                            }, +                                            { +                                                "type": "divider" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_bright", +                                                "name": "Bright" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_alone", +                                                "name": "Alone" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_guests", +                                                "name": "Guests" +                                            } +                                        ], +                                        "title": "Modes" +                                    } +                                }, +                                { +                                    "type": "custom:restriction-card", +                                    "restrictions": { +                                        "block": { +                                            "exemptions": null +                                        } +                                    }, +                                    "card": { +                                        "type": "entities", +                                        "entities": [ +                                            { +                                                "entity": "switch.bedroom_roof", +                                                "name": "Roof" +                                            }, +                                            { +                                                "entity": "switch.living_office", +                                                "name": "Office" +                                            }, +                                            { +                                                "entity": "switch.smart_power_strip_pro_usb_1", +                                                "name": "SmartPI" +                                            }, +                                            { +                                                "entity": "switch.hall_camera", +                                                "name": "Camera" +                                            } +                                        ], +                                        "title": "Infrastructure" +                                    } +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "switch.entrance_lights_left", +                                            "name": "Toilet" +                                        }, +                                        { +                                            "entity": "switch.entrance_lights_center", +                                            "name": "Entrance" +                                        }, +                                        { +                                            "entity": "switch.hall_lights_left", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "switch.bathroom_lights_left", +                                            "name": "Bathroom" +                                        }, +                                        { +                                            "entity": "switch.bathroom_lights_center", +                                            "name": "Sauna" +                                        }, +                                        { +                                            "entity": "light.aqara_hub_m1s_426c", +                                            "name": "M1S" +                                        } +                                    ], +                                    "title": "Lights" +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "square": true, +                                    "columns": 2, +                                    "type": "grid", +                                    "cards": [ +                                        { +                                            "type": "light", +                                            "entity": "light.yeelight_color_0x7caaf86", +                                            "name": "Office Bulb" +                                        }, +                                        { +                                            "type": "light", +                                            "entity": "light.smart_light", +                                            "name": "Bedroom Bulb" +                                        } +                                    ] +                                }, +                                { +                                    "type": "media-control", +                                    "entity": "media_player.smartpi" +                                }, +                                { +                                    "square": true, +                                    "columns": 2, +                                    "type": "grid", +                                    "cards": [ +                                        { +                                            "type": "entities", +                                            "entities": [ +                                                { +                                                    "entity": "switch.living_lights_left", +                                                    "name": "Lustre-1" +                                                }, +                                                { +                                                    "entity": "switch.living_lights_center", +                                                    "name": "Lustre-2" +                                                }, +                                                { +                                                    "entity": "light.yeelight_color_0x7caaf86", +                                                    "name": "Bulb" +                                                }, +                                                { +                                                    "entity": "switch.living_tablelamp", +                                                    "name": "DeskLamp" +                                                } +                                            ], +                                            "title": "Living Lights" +                                        }, +                                        { +                                            "type": "vertical-stack", +                                            "cards": [ +                                                { +                                                    "type": "entities", +                                                    "entities": [ +                                                        { +                                                            "entity": "switch.smart_power_strip_pro_socket_2", +                                                            "name": "AirCon" +                                                        }, +                                                        { +                                                            "entity": "switch.office_aircon", +                                                            "name": "Power" +                                                        } +                                                    ], +                                                    "title": "Living Plugs" +                                                }, +                                                { +                                                    "type": "custom:restriction-card", +                                                    "restrictions": { +                                                        "confirm": { +                                                            "exemptions": null +                                                        } +                                                    }, +                                                    "card": { +                                                        "type": "entities", +                                                        "entities": [ +                                                            { +                                                                "entity": "switch.smart_power_strip_pro_socket_1", +                                                                "name": "Table" +                                                            }, +                                                            { +                                                                "entity": "switch.office_table", +                                                                "name": "Power" +                                                            }, +                                                            { +                                                                "entity": "switch.smart_power_strip_pro_socket_4", +                                                                "name": "Top" +                                                            }, +                                                            { +                                                                "entity": "switch.office_shelftop", +                                                                "name": "Power" +                                                            }, +                                                            { +                                                                "entity": "switch.smart_power_strip_pro_socket_3", +                                                                "name": "Bottom" +                                                            }, +                                                            { +                                                                "entity": "switch.office_shelfbottom", +                                                                "name": "Power" +                                                            } +                                                        ], +                                                        "title": "Office Plugs" +                                                    } +                                                } +                                            ] +                                        } +                                    ] +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "square": true, +                                    "columns": 2, +                                    "type": "grid", +                                    "cards": [ +                                        { +                                            "type": "entities", +                                            "entities": [ +                                                { +                                                    "entity": "switch.bedroom_lights_left", +                                                    "name": "Lustre-1" +                                                }, +                                                { +                                                    "entity": "switch.bedroom_lights_center", +                                                    "name": "Lustre-2" +                                                }, +                                                { +                                                    "entity": "light.smart_light", +                                                    "name": "Bulb" +                                                }, +                                                { +                                                    "entity": "switch.bedroom_tablelamp", +                                                    "name": "DeskLamp" +                                                }, +                                                { +                                                    "entity": "binary_sensor.bedroom_bedsidelamp", +                                                    "name": "BedLED" +                                                } +                                            ], +                                            "title": "Bedroom Lights" +                                        }, +                                        { +                                            "type": "entities", +                                            "entities": [ +                                                { +                                                    "entity": "switch.bedroom_aircon", +                                                    "name": "AirCon" +                                                }, +                                                { +                                                    "entity": "switch.bedroom_bedsidelampsocket", +                                                    "name": "BedLamp" +                                                } +                                            ], +                                            "title": "Bedroom Plugs" +                                        } +                                    ] +                                }, +                                { +                                    "square": true, +                                    "columns": 2, +                                    "type": "grid", +                                    "cards": [ +                                        { +                                            "type": "entities", +                                            "entities": [ +                                                { +                                                    "entity": "switch.kitchen_lights_left", +                                                    "name": "Lustre" +                                                }, +                                                { +                                                    "entity": "switch.kitchen_ledlights", +                                                    "name": "LED" +                                                } +                                            ], +                                            "title": "Kitchen Lights" +                                        }, +                                        { +                                            "type": "custom:restriction-card", +                                            "restrictions": { +                                                "confirm": { +                                                    "exemptions": null +                                                } +                                            }, +                                            "card": { +                                                "type": "entities", +                                                "entities": [ +                                                    { +                                                        "entity": "switch.kitchen_oven", +                                                        "name": "Oven" +                                                    }, +                                                    { +                                                        "entity": "switch.kitchen_wash", +                                                        "title": "Wash" +                                                    }, +                                                    { +                                                        "entity": "switch.kitchen_teatable", +                                                        "title": "Table" +                                                    } +                                                ], +                                                "title": "Kitchen Plugs" +                                            } +                                        } +                                    ] +                                }, +                                { +                                    "square": true, +                                    "columns": 2, +                                    "type": "grid", +                                    "cards": [ +                                        { +                                            "type": "entities", +                                            "entities": [ +                                                { +                                                    "entity": "switch.guestroom_lights_left", +                                                    "name": "Lustre-1" +                                                }, +                                                { +                                                    "entity": "switch.guestroom_lights_right", +                                                    "name": "Lustre-2" +                                                } +                                            ], +                                            "title": "Guest Lights" +                                        }, +                                        { +                                            "type": "entities", +                                            "entities": [], +                                            "title": "Guest Plugs" +                                        } +                                    ] +                                } +                            ] +                        } +                    ] +                } +            ] +        } +    } +}
\ No newline at end of file diff --git a/.storage/lovelace.lovelace_power b/.storage/lovelace.lovelace_power new file mode 100644 index 0000000..b50b8ab --- /dev/null +++ b/.storage/lovelace.lovelace_power @@ -0,0 +1,266 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace.lovelace_power", +    "data": { +        "config": { +            "views": [ +                { +                    "theme": "Backend-selected", +                    "title": "Home", +                    "type": "custom:grid-layout", +                    "layout": { +                        "max_cols": 4, +                        "grid-template-columns": "25% 25% 25% 25%", +                        "grid-template-rows": "auto", +                        "mediaquery": { +                            "(max-width: 600px)": { +                                "grid-template-columns": "100%" +                            }, +                            "(max-width: 1200px)": { +                                "grid-template-columns": "50% 50%" +                            } +                        } +                    }, +                    "badges": [], +                    "cards": [ +                        { +                            "type": "entities", +                            "title": "Infrastructure", +                            "entities": [ +                                { +                                    "entity": "sensor.bedroom_roof_power" +                                }, +                                { +                                    "entity": "sensor.hall_camera_power" +                                }, +                                { +                                    "entity": "sensor.power_smartpi" +                                } +                            ] +                        }, +                        { +                            "type": "entities", +                            "title": "Office", +                            "entities": [ +                                { +                                    "entity": "sensor.living_office_power" +                                }, +                                { +                                    "entity": "sensor.office_shelfbottom_power" +                                }, +                                { +                                    "entity": "sensor.office_shelftop_power" +                                }, +                                { +                                    "entity": "sensor.office_table_power" +                                } +                            ] +                        }, +                        { +                            "type": "entities", +                            "title": "Appliances", +                            "entities": [ +                                { +                                    "entity": "sensor.kitchen_oven_power" +                                }, +                                { +                                    "entity": "sensor.kitchen_wash_power" +                                }, +                                { +                                    "entity": "sensor.kitchen_teatable_power" +                                }, +                                { +                                    "entity": "sensor.office_aircon_power" +                                }, +                                { +                                    "entity": "sensor.bedroom_aircon_power" +                                } +                            ] +                        }, +                        { +                            "type": "entities", +                            "title": "Lights", +                            "entities": [ +                                { +                                    "entity": "sensor.kitchen_ledlights_power" +                                }, +                                { +                                    "entity": "sensor.bedroom_bedsidelampsocket_power" +                                }, +                                { +                                    "entity": "sensor.bedroom_tablelamp_power" +                                }, +                                { +                                    "entity": "sensor.living_tablelamp_power" +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "sensor.bedroom_roof_power" +                                        }, +                                        { +                                            "entity": "sensor.hall_camera_power" +                                        } +                                    ], +                                    "hours_to_show": 24, +                                    "title": "Infrastructure (24h)" +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.bedroom_roof_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.hall_camera_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.power_smartpi", +                                    "detail": 2 +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "sensor.office_shelfbottom_power" +                                        }, +                                        { +                                            "entity": "sensor.office_shelftop_power" +                                        }, +                                        { +                                            "entity": "sensor.office_table_power" +                                        } +                                    ], +                                    "hours_to_show": 24, +                                    "title": "Office (24h)" +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.living_office_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.office_shelfbottom_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.office_shelftop_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.office_table_power", +                                    "detail": 2 +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "sensor.kitchen_oven_power" +                                        }, +                                        { +                                            "entity": "sensor.kitchen_wash_power" +                                        }, +                                        { +                                            "entity": "sensor.kitchen_teatable_power" +                                        } +                                    ], +                                    "hours_to_show": 24, +                                    "title": "Kitchen (24h)" +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.kitchen_oven_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.kitchen_wash_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.kitchen_teatable_power", +                                    "detail": 2 +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "sensor.office_aircon_power" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_aircon_power" +                                        } +                                    ], +                                    "hours_to_show": 24, +                                    "title": "Climate (24h)" +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.office_aircon_power", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 24, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.bedroom_aircon_power", +                                    "detail": 2 +                                } +                            ] +                        } +                    ] +                } +            ] +        } +    } +}
\ No newline at end of file diff --git a/.storage/lovelace.lovelace_research b/.storage/lovelace.lovelace_research new file mode 100644 index 0000000..dffc4a1 --- /dev/null +++ b/.storage/lovelace.lovelace_research @@ -0,0 +1,185 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace.lovelace_research", +    "data": { +        "config": { +            "views": [ +                { +                    "title": "Home", +                    "cards": [ +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "custom:restriction-card", +                                    "restrictions": { +                                        "confirm": { +                                            "exemptions": null +                                        } +                                    }, +                                    "card": { +                                        "type": "entities", +                                        "entities": [ +                                            { +                                                "entity": "input_boolean.mode_away" +                                            }, +                                            { +                                                "entity": "input_boolean.mode_production" +                                            }, +                                            { +                                                "entity": "select.entrance_vibrations_sensitivity" +                                            } +                                        ], +                                        "title": "Mode" +                                    } +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.entrance_door_contact" +                                        }, +                                        { +                                            "entity": "sensor.entrance_vibrations_action" +                                        }, +                                        { +                                            "entity": "binary_sensor.motions_all" +                                        }, +                                        { +                                            "entity": "switch.lights_all" +                                        } +                                    ], +                                    "title": "Intrusion" +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_smoke_smoke" +                                        }, +                                        { +                                            "entity": "sensor.kitchen_gas_carbon_monoxide" +                                        }, +                                        { +                                            "entity": "binary_sensor.bathroom_leak_water_leak" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_door_contact" +                                        }, +                                        { +                                            "entity": "sensor.living_office_device_temperature" +                                        } +                                    ], +                                    "title": "Safety" +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_smoke_smoke", +                                            "name": "Smoke" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_gas", +                                            "name": "Gas (CO)" +                                        }, +                                        { +                                            "entity": "binary_sensor.bathroom_leak_water_leak", +                                            "name": "Water Leak" +                                        } +                                    ], +                                    "hours_to_show": 48, +                                    "title": "Safety (Last 48 hours)" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.entrance_door_contact", +                                            "name": "Entrance Door" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_door_contact", +                                            "name": "Kitchen Door" +                                        }, +                                        { +                                            "entity": "binary_sensor.entrance_vibrations_vibration", +                                            "name": "Vibrations" +                                        }, +                                        { +                                            "entity": "sensor.entrance_vibrations_strength", +                                            "name": "Strength" +                                        }, +                                        { +                                            "entity": "sensor.hall_motions_illuminance_lux", +                                            "name": "Illumination Hall" +                                        }, +                                        { +                                            "entity": "switch.lights_all", +                                            "name": "All Lights" +                                        } +                                    ], +                                    "hours_to_show": 48, +                                    "title": "Intrusion (Last 48 hours)" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Living" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Kitchen" +                                        } +                                    ], +                                    "hours_to_show": 48, +                                    "title": "Motions (Last 48 hours)" +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "picture-entity", +                                    "entity": "camera.192_168_50_51" +                                }, +                                { +                                    "type": "logbook", +                                    "entities": [ +                                        "binary_sensor.entrance_door_contact", +                                        "sensor.entrance_vibrations_strength", +                                        "binary_sensor.hall_motions_occupancy", +                                        "sensor.entrance_vibrations_action" +                                    ], +                                    "hours_to_show": 24, +                                    "title": "Logs" +                                } +                            ] +                        } +                    ] +                } +            ] +        } +    } +}
\ No newline at end of file diff --git a/.storage/lovelace.lovelace_status b/.storage/lovelace.lovelace_status new file mode 100644 index 0000000..a5ea896 --- /dev/null +++ b/.storage/lovelace.lovelace_status @@ -0,0 +1,256 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace.lovelace_status", +    "data": { +        "config": { +            "views": [ +                { +                    "title": "Home", +                    "cards": [ +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "custom:restriction-card", +                                    "restrictions": { +                                        "block": { +                                            "exemptions": null +                                        } +                                    }, +                                    "card": { +                                        "type": "entities", +                                        "title": "Plugs", +                                        "entities": [ +                                            { +                                                "entity": "switch.plugs_infrastructure", +                                                "name": "Infrastructure" +                                            }, +                                            { +                                                "entity": "switch.plugs_manual", +                                                "name": "Manual Sockets" +                                            }, +                                            { +                                                "entity": "switch.plugs_controlled", +                                                "name": "Controlled Sockets" +                                            }, +                                            { +                                                "entity": "switch.plugs_office", +                                                "name": "Office Sockets" +                                            } +                                        ] +                                    } +                                }, +                                { +                                    "type": "custom:restriction-card", +                                    "restrictions": { +                                        "confirm": { +                                            "exemptions": null +                                        } +                                    }, +                                    "card": { +                                        "type": "entities", +                                        "title": "Manual Plugs", +                                        "entities": [ +                                            { +                                                "entity": "switch.plugs_kitchen", +                                                "name": "Kitchen" +                                            }, +                                            { +                                                "entity": "switch.plugs_office", +                                                "name": "Office All" +                                            }, +                                            { +                                                "entity": "switch.smart_power_strip_pro_socket_1", +                                                "name": "Office Desk" +                                            }, +                                            { +                                                "entity": "switch.bedroom_bedsidelampsocket", +                                                "name": "Bedside" +                                            } +                                        ] +                                    } +                                }, +                                { +                                    "type": "entities", +                                    "title": "Lights", +                                    "entities": [ +                                        { +                                            "entity": "switch.lights_living", +                                            "name": "Living Room" +                                        }, +                                        { +                                            "entity": "switch.lights_bedroom", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_bedsidelamp", +                                            "name": "Bedside LED" +                                        }, +                                        { +                                            "entity": "switch.lights_guest", +                                            "name": "Guestroom" +                                        }, +                                        { +                                            "entity": "switch.lights_kitchen", +                                            "name": "Kitchen" +                                        }, +                                        { +                                            "entity": "switch.lights_bathroom", +                                            "name": "Bathroom/Toilet" +                                        }, +                                        { +                                            "entity": "switch.lights_hall", +                                            "name": "Hall" +                                        } +                                    ] +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Living" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Kitchen" +                                        } +                                    ], +                                    "title": "Motions" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Living" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Kitchen" +                                        } +                                    ], +                                    "hours_to_show": 2, +                                    "title": "2 hours" +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "sensor.192_168_50_1_devices_connected", +                                            "name": "Asgard clients" +                                        }, +                                        { +                                            "entity": "device_tracker.legion8", +                                            "name": "Legion8/Asgard" +                                        }, +                                        { +                                            "entity": "device_tracker.lm_g810", +                                            "name": "Legion8/Hass" +                                        }, +                                        { +                                            "entity": "device_tracker.nyx", +                                            "name": "Nyx/Asgard" +                                        } +                                    ] +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "title": "Power (24h -> 2h)", +                                    "entities": [ +                                        { +                                            "entity": "sensor.power_infrastructure" +                                        }, +                                        { +                                            "entity": "sensor.power_office" +                                        }, +                                        { +                                            "entity": "sensor.power_kitchen" +                                        }, +                                        { +                                            "entity": "sensor.power_climate" +                                        }, +                                        { +                                            "entity": "sensor.power_lights" +                                        } +                                    ], +                                    "hours_to_show": 24 +                                }, +                                { +                                    "hours_to_show": 2, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.power_infrastructure", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 2, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.power_office", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 2, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.power_kitchen", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 2, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.power_climate", +                                    "detail": 2 +                                }, +                                { +                                    "hours_to_show": 2, +                                    "graph": "line", +                                    "type": "sensor", +                                    "entity": "sensor.power_lights", +                                    "detail": 2 +                                } +                            ] +                        } +                    ] +                } +            ] +        } +    } +}
\ No newline at end of file diff --git a/.storage/lovelace.lovelace_test b/.storage/lovelace.lovelace_test new file mode 100644 index 0000000..d9477fe --- /dev/null +++ b/.storage/lovelace.lovelace_test @@ -0,0 +1,402 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace.lovelace_test", +    "data": { +        "config": { +            "views": [ +                { +                    "theme": "Backend-selected", +                    "title": "Home", +                    "type": "custom:grid-layout", +                    "layout": { +                        "max_cols": 4, +                        "grid-template-columns": "25% 25% 25% 25%", +                        "grid-template-rows": "auto", +                        "mediaquery": { +                            "(max-width: 600px)": { +                                "grid-template-columns": "100%" +                            }, +                            "(max-width: 1200px)": { +                                "grid-template-columns": "50% 50%" +                            }, +                            "(max-width: 1800px)": { +                                "grid-template-columns": "33% 33% 33%" +                            } +                        } +                    }, +                    "badges": [], +                    "cards": [ +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.entrance_door_contact", +                                            "name": "Contact" +                                        }, +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Motions" +                                        }, +                                        { +                                            "entity": "binary_sensor.entrance_vibrations_vibration", +                                            "name": "Vibration" +                                        }, +                                        { +                                            "entity": "sensor.entrance_vibrations_strength", +                                            "name": "Strength" +                                        } +                                    ], +                                    "hours_to_show": 1, +                                    "title": "Vibration Sensor (1h)" +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Living" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Kitchen" +                                        } +                                    ], +                                    "title": "Motions" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Living" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Kitchen" +                                        } +                                    ], +                                    "hours_to_show": 1, +                                    "title": "Motion Sensors (1h)" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Hall" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Living" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Bedroom" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Kitchen" +                                        } +                                    ], +                                    "hours_to_show": 12, +                                    "title": "Motion Sensors (12h)" +                                }, +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "group.master_phones", +                                            "name": "Phones" +                                        }, +                                        { +                                            "entity": "group.master_laptops", +                                            "name": "Laptops" +                                        }, +                                        { +                                            "entity": "sensor.192_168_50_1_devices_connected", +                                            "name": "Asgard clients" +                                        }, +                                        { +                                            "type": "divider" +                                        }, +                                        { +                                            "entity": "device_tracker.legion8", +                                            "name": "Legion8/Asgard" +                                        }, +                                        { +                                            "entity": "device_tracker.lm_g810", +                                            "name": "Legion8/Hass" +                                        }, +                                        { +                                            "entity": "device_tracker.nyx", +                                            "name": "Nyx/Asgard" +                                        } +                                    ] +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "group.master_phones", +                                            "name": "Phones" +                                        }, +                                        { +                                            "entity": "group.master_laptops", +                                            "name": "Laptops" +                                        }, +                                        { +                                            "entity": "device_tracker.legion8", +                                            "name": "Legion8/Asgard" +                                        }, +                                        { +                                            "entity": "device_tracker.lm_g810", +                                            "name": "Legion8/Hass" +                                        }, +                                        { +                                            "entity": "device_tracker.nyx", +                                            "name": "Nyx/Asgard" +                                        }, +                                        { +                                            "entity": "sensor.192_168_50_1_devices_connected", +                                            "name": "Asgard clients" +                                        } +                                    ], +                                    "hours_to_show": 12 +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "switch.living_lights_left", +                                            "name": "Lustre 1" +                                        }, +                                        { +                                            "entity": "switch.living_lights_center", +                                            "name": "Lustre 2" +                                        }, +                                        { +                                            "entity": "switch.living_lights_right", +                                            "name": "Smart Bulb" +                                        }, +                                        { +                                            "entity": "switch.living_tablelamp", +                                            "name": "DeskLamp" +                                        }, +                                        { +                                            "entity": "binary_sensor.living_motions_occupancy", +                                            "name": "Room Motions" +                                        }, +                                        { +                                            "entity": "sensor.living_motions_illuminance_lux", +                                            "name": "Room Lux" +                                        }, +                                        { +                                            "entity": "binary_sensor.office_motions_occupancy", +                                            "name": "Office Motions" +                                        }, +                                        { +                                            "entity": "sensor.office_motions_illuminance_lux", +                                            "name": "Office Lux" +                                        } +                                    ], +                                    "hours_to_show": 1, +                                    "title": "Living Illuminance (1h)" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "switch.hall_lights_left", +                                            "name": "Hall Light" +                                        }, +                                        { +                                            "entity": "switch.entrance_lights_left", +                                            "name": "Entrance Light" +                                        }, +                                        { +                                            "entity": "binary_sensor.hall_motions_occupancy", +                                            "name": "Motions" +                                        }, +                                        { +                                            "entity": "sensor.hall_motions_illuminance_lux", +                                            "name": "Lux" +                                        } +                                    ], +                                    "hours_to_show": 1, +                                    "title": "Hall Illuminance (1h)" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "switch.kitchen_lights_left", +                                            "name": "Lustre" +                                        }, +                                        { +                                            "entity": "switch.kitchen_lights_center", +                                            "name": "LED" +                                        }, +                                        { +                                            "entity": "binary_sensor.kitchen_motions_occupancy", +                                            "name": "Motions" +                                        }, +                                        { +                                            "entity": "sensor.kitchen_motions_illuminance_lux", +                                            "name": "Lux" +                                        } +                                    ], +                                    "hours_to_show": 1, +                                    "title": "Kitchen Illuminance (1h)" +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "switch.bedroom_lights_left", +                                            "name": "Lustre 1" +                                        }, +                                        { +                                            "entity": "switch.bedroom_lights_center", +                                            "name": "Lustre 2" +                                        }, +                                        { +                                            "entity": "switch.bedroom_lights_right", +                                            "name": "Smart Bulb" +                                        }, +                                        { +                                            "entity": "switch.bedroom_tablelamp", +                                            "name": "DeskLamp" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_bedsidelamp", +                                            "name": "BedLamp" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Motions" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_motions_illuminance_lux", +                                            "name": "Lux" +                                        } +                                    ], +                                    "hours_to_show": 1, +                                    "title": "Bedroom Illuminance (1h)" +                                }, +                                { +                                    "type": "history-graph", +                                    "entities": [ +                                        { +                                            "entity": "switch.bedroom_lights_left", +                                            "name": "Lustre 1" +                                        }, +                                        { +                                            "entity": "switch.bedroom_lights_center", +                                            "name": "Lustre 2" +                                        }, +                                        { +                                            "entity": "switch.bedroom_lights_right", +                                            "name": "Smart Bulb" +                                        }, +                                        { +                                            "entity": "switch.bedroom_tablelamp", +                                            "name": "DeskLamp" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_bedsidelamp", +                                            "name": "BedLamp" +                                        }, +                                        { +                                            "entity": "binary_sensor.bedroom_motions_occupancy", +                                            "name": "Motions" +                                        }, +                                        { +                                            "entity": "sensor.bedroom_motions_illuminance_lux", +                                            "name": "Lux" +                                        } +                                    ], +                                    "hours_to_show": 12, +                                    "title": "Bedroom Illuminance (12h)" +                                } +                            ] +                        }, +                        { +                            "type": "vertical-stack", +                            "cards": [ +                                { +                                    "type": "entities", +                                    "entities": [ +                                        { +                                            "entity": "input_number.knob_office_current" +                                        }, +                                        { +                                            "entity": "input_number.knob_office_brightness0" +                                        }, +                                        { +                                            "entity": "input_number.knob_office_temperature0" +                                        }, +                                        { +                                            "entity": "input_number.knob_office_hue0" +                                        }, +                                        { +                                            "entity": "input_number.knob_office_brightness1" +                                        }, +                                        { +                                            "entity": "input_number.knob_office_temperature1" +                                        }, +                                        { +                                            "entity": "input_number.knob_office_hue1" +                                        } +                                    ], +                                    "title": "Knob Control" +                                } +                            ] +                        } +                    ] +                } +            ] +        } +    } +}
\ No newline at end of file diff --git a/.storage/lovelace_dashboards b/.storage/lovelace_dashboards new file mode 100644 index 0000000..4e4a887 --- /dev/null +++ b/.storage/lovelace_dashboards @@ -0,0 +1,63 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace_dashboards", +    "data": { +        "items": [ +            { +                "show_in_sidebar": true, +                "title": "Security", +                "require_admin": false, +                "mode": "storage", +                "url_path": "lovelace-research", +                "id": "lovelace_research", +                "icon": "mdi:security" +            }, +            { +                "show_in_sidebar": true, +                "icon": "mdi:lamps", +                "title": "Status", +                "require_admin": false, +                "mode": "storage", +                "url_path": "lovelace-status", +                "id": "lovelace_status" +            }, +            { +                "show_in_sidebar": true, +                "icon": "mdi:air-conditioner", +                "title": "Climate", +                "require_admin": false, +                "mode": "storage", +                "url_path": "lovelace-climate", +                "id": "lovelace_climate" +            }, +            { +                "show_in_sidebar": true, +                "icon": "mdi:gesture-tap", +                "title": "Control", +                "require_admin": false, +                "mode": "storage", +                "url_path": "lovelace-control", +                "id": "lovelace_control" +            }, +            { +                "show_in_sidebar": true, +                "icon": "mdi:sine-wave", +                "title": "Power", +                "require_admin": false, +                "mode": "storage", +                "url_path": "lovelace-power", +                "id": "lovelace_power" +            }, +            { +                "show_in_sidebar": true, +                "icon": "mdi:flask-outline", +                "title": "Research", +                "require_admin": false, +                "mode": "storage", +                "url_path": "lovelace-test", +                "id": "lovelace_test" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/lovelace_resources b/.storage/lovelace_resources new file mode 100644 index 0000000..e468e69 --- /dev/null +++ b/.storage/lovelace_resources @@ -0,0 +1,19 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "lovelace_resources", +    "data": { +        "items": [ +            { +                "url": "/local/community/lovelace-layout-card/layout-card.js", +                "type": "module", +                "id": "1ff60dcd5dcd4490bc7f3f0c5a2fcdbc" +            }, +            { +                "url": "/local/community/restriction-card/restriction-card.js?hacstag=215633404127", +                "type": "module", +                "id": "85c450ddee1d420e973dbe6346afe952" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/person b/.storage/person new file mode 100644 index 0000000..4ed5236 --- /dev/null +++ b/.storage/person @@ -0,0 +1,17 @@ +{ +    "version": 2, +    "minor_version": 1, +    "key": "person", +    "data": { +        "items": [ +            { +                "name": "Suren A. Chilingaryan", +                "user_id": "31a296cc30a243089f121cef93b46cc0", +                "device_trackers": [ +                    "device_tracker.lm_g810" +                ], +                "id": "suren_a_chilingaryan" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/tag b/.storage/tag new file mode 100644 index 0000000..1436d47 --- /dev/null +++ b/.storage/tag @@ -0,0 +1,15 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "tag", +    "data": { +        "items": [ +            { +                "tag_id": "8acfd2d9-0f48-425a-94ab-fb466db77c30", +                "name": "Test", +                "id": "8acfd2d9-0f48-425a-94ab-fb466db77c30", +                "last_scanned": "2023-01-09T02:09:31.722141+00:00" +            } +        ] +    } +}
\ No newline at end of file diff --git a/.storage/zone b/.storage/zone new file mode 100644 index 0000000..11b7a98 --- /dev/null +++ b/.storage/zone @@ -0,0 +1,18 @@ +{ +    "version": 1, +    "minor_version": 1, +    "key": "zone", +    "data": { +        "items": [ +            { +                "latitude": 40.20070712833234, +                "longitude": 44.47609064687973, +                "name": "HomeHalabyanExtended", +                "icon": "mdi:map-marker", +                "passive": false, +                "radius": 856.0, +                "id": "homehalabyan" +            } +        ] +    } +}
\ No newline at end of file diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..3e183c3 --- /dev/null +++ b/automations.yaml @@ -0,0 +1,1057 @@ +- id: '1654820574086' +  alias: 'Motions: Hall-based' +  description: '' +  trigger: +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 0 +      minutes: 0 +      seconds: 10 +    id: Short +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 0 +      minutes: 20 +      seconds: 0 +    id: Toilet +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 1 +      minutes: 0 +      seconds: 0 +    id: Long +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 20 +      minutes: 0 +      seconds: 0 +    id: Away +  condition: [] +  action: +  - choose: +    - conditions: +      - condition: trigger +        id: Short +      sequence: +      - type: turn_off +        device_id: 87071fc9d8fb9ebbccb145f5642c7404 +        entity_id: light.aqara_hub_m1s_426c +        domain: light +      - type: turn_off +        device_id: 5c1c363a6825ad5a006f3bb84bb104ce +        entity_id: switch.hall_lights_left +        domain: switch +      - type: turn_off +        device_id: 07b7086cf34752386c82a5109311ac6e +        entity_id: switch.entrance_lights_center +        domain: switch +    - conditions: +      - condition: trigger +        id: Toilet +      sequence: +      - type: turn_off +        device_id: 07b7086cf34752386c82a5109311ac6e +        entity_id: switch.entrance_lights_left +        domain: switch +    - conditions: +      - condition: trigger +        id: Long +      sequence: +      - type: turn_off +        device_id: 04c6f563c006599ed7754aba652654ae +        entity_id: switch.bathroom_lights_left +        domain: switch +      - type: turn_off +        device_id: 04c6f563c006599ed7754aba652654ae +        entity_id: switch.bathroom_lights_center +        domain: switch +      - type: turn_off +        device_id: 558ce3c924f9478aad68cb5b98f05ecc +        entity_id: switch.kitchen_lights_left +        domain: switch +      - type: turn_off +        device_id: 558ce3c924f9478aad68cb5b98f05ecc +        entity_id: switch.kitchen_lights_center +        domain: switch +    default: [] +  mode: single +- id: '1654901560778' +  alias: 'Living: Office Light' +  description: '' +  use_blueprint: +    path: lights/light_switch.yaml +    input: +      switch: switch.living_lights_right +      light: light.yeelight_color_0x7caaf86 +      dblclick: +      - parallel: +        - service: script.sleep_and_wake +          data: +            mode: hibernate +            target: office +        - service: switch.turn_off +          data: {} +          target: +            entity_id: switch.lights_living +- id: '1654986053564' +  alias: 'Hall: Kitchen LED' +  description: '' +  use_blueprint: +    path: lights/light_switch.yaml +    input: +      switch: switch.kitchen_lights_center +      light: switch.kitchen_ledlights +- id: '1654986378177' +  alias: 'Bedroom: Bulb' +  description: '' +  use_blueprint: +    path: lights/light_switch.yaml +    input: +      switch: switch.bedroom_lights_right +      light: light.smart_light +      dblclick: +      - service: script.turn_off_bedroom_lights +        data: {} +      - type: turn_off +        device_id: bf45f1d630db6e2aa1307866603f548a +        entity_id: light.smart_light +        domain: light +      off_click: +      - type: turn_off +        device_id: 4ca2827c57a086e0da4d63756b15261b +        entity_id: switch.bedroom_tablelamp +        domain: switch +- id: '1654994043723' +  alias: Aqara Sounds +  description: '' +  trigger: +  - platform: state +    entity_id: +    - input_button.button_alert +    - input_button.button_confirm +    - input_button.button_ring +  condition: [] +  action: +  - choose: +    - conditions: +      - condition: template +        value_template: '{{ trigger.entity_id == ''input_button.button_confirm'' }}' +      sequence: +      - service: alarm_control_panel.alarm_arm_night +        data: {} +        target: +          entity_id: alarm_control_panel.aqara_hub_m1s_426c +    - conditions: +      - condition: template +        value_template: '{{ trigger.entity_id == ''input_button.button_ring'' }}' +      sequence: +      - service: alarm_control_panel.alarm_arm_home +        data: {} +        target: +          entity_id: alarm_control_panel.aqara_hub_m1s_426c +      - delay: +          hours: 0 +          minutes: 0 +          seconds: 5 +          milliseconds: 0 +    - conditions: +      - condition: template +        value_template: '{{ trigger.entity_id == ''input_button.button_alert'' }}' +      sequence: +      - if: +        - condition: state +          entity_id: input_boolean.mode_production +          state: 'on' +        then: +        - service: alarm_control_panel.alarm_arm_away +          target: +            entity_id: alarm_control_panel.aqara_hub_m1s_426c +        - delay: +            hours: 0 +            minutes: 0 +            seconds: 15 +            milliseconds: 0 +        else: +        - service: alarm_control_panel.alarm_arm_home +          target: +            entity_id: alarm_control_panel.aqara_hub_m1s_426c +        - delay: +            hours: 0 +            minutes: 0 +            seconds: 5 +            milliseconds: 0 +    default: [] +  - delay: +      hours: 0 +      minutes: 0 +      seconds: 5 +      milliseconds: 0 +  - service: alarm_control_panel.alarm_disarm +    data: {} +    target: +      entity_id: alarm_control_panel.aqara_hub_m1s_426c +  mode: single +- id: '1654996443007' +  alias: 'Bedroom: BedSwitch' +  description: '' +  trigger: +  - platform: device +    domain: mqtt +    device_id: f7f321e14489d5f5ef9e332f06055769 +    type: action +    subtype: single_left +    discovery_id: 0x54ef4410001b175a action_single_left +    id: left +  - platform: device +    domain: mqtt +    device_id: f7f321e14489d5f5ef9e332f06055769 +    type: action +    subtype: single_right +    discovery_id: 0x54ef4410001b175a action_single_right +    id: right +  - platform: device +    domain: mqtt +    device_id: f7f321e14489d5f5ef9e332f06055769 +    type: action +    subtype: double_right +    discovery_id: 0x54ef4410001b175a action_double_right +    id: right_dbl +  - platform: device +    domain: mqtt +    device_id: f7f321e14489d5f5ef9e332f06055769 +    type: action +    subtype: double_left +    discovery_id: 0x54ef4410001b175a action_double_left +    id: left_dbl +  - platform: device +    domain: mqtt +    device_id: f7f321e14489d5f5ef9e332f06055769 +    type: action +    subtype: hold_right +    discovery_id: 0x54ef4410001b175a action_hold_right +    id: right_hold +  - platform: device +    domain: mqtt +    device_id: f7f321e14489d5f5ef9e332f06055769 +    type: action +    subtype: hold_left +    discovery_id: 0x54ef4410001b175a action_hold_left +    id: left_hold +  condition: [] +  action: +  - choose: +    - conditions: +      - condition: trigger +        id: left +      sequence: +      - if: +        - condition: and +          conditions: +          - condition: state +            entity_id: switch.lights_bedroom +            state: 'off' +          - condition: numeric_state +            entity_id: sensor.bedroom_bedsidelampsocket_power +            below: '2' +        then: +        - parallel: +          - type: turn_on +            device_id: 4ca2827c57a086e0da4d63756b15261b +            entity_id: switch.bedroom_tablelamp +            domain: switch +        else: +        - parallel: +          - service: script.turn_off_bedroom_lights +            data: {} +    - conditions: +      - condition: trigger +        id: left_dbl +      sequence: +      - if: +        - condition: state +          entity_id: input_boolean.mode_alone +          state: 'off' +        then: +        - parallel: +          - service: script.sleep_and_wake +            data: +              mode: sleep +              target: office +        else: +        - parallel: +          - service: switch.turn_off +            data: {} +            target: +              entity_id: +              - switch.lights_living +              - switch.lights_guest +              - switch.lights_temporary +          - service: script.sleep_and_wake +            data: +              mode: hibernate +              target: office +      - service: input_button.press +        data: {} +        target: +          entity_id: input_button.button_confirm +    - conditions: +      - condition: trigger +        id: left_hold +      sequence: +      - service: input_button.press +        data: {} +        target: +          entity_id: input_button.button_ring +        enabled: false +      - service: media_player.play_media +        target: +          entity_id: media_player.smartpi +        data: +          media_content_id: media-source://dlna_dms/asgard/:64$0$5$1$0$0 +          media_content_type: audio/mpeg +        metadata: +          title: Wish I Had An Angel +          thumbnail: +          media_class: music +          children_media_class: +          navigateIds: +          - {} +          - media_content_type: app +            media_content_id: media-source://dlna_dms +          - media_content_type: channel +            media_content_id: media-source://dlna_dms/asgard/:0 +          - media_content_type: object.container.storageFolder +            media_content_id: media-source://dlna_dms/asgard/:64 +          - media_content_type: object.container.storageFolder +            media_content_id: media-source://dlna_dms/asgard/:64$0 +          - media_content_type: object.container.storageFolder +            media_content_id: media-source://dlna_dms/asgard/:64$0$5 +          - media_content_type: object.container.storageFolder +            media_content_id: media-source://dlna_dms/asgard/:64$0$5$1 +          - media_content_type: object.container.storageFolder +            media_content_id: media-source://dlna_dms/asgard/:64$0$5$1$0 +    - conditions: +      - condition: trigger +        id: right +      sequence: +      - service: script.bedroom_aircon +        data: {} +    default: +    - service: input_button.press +      data: {} +      target: +        entity_id: input_button.button_confirm +  mode: restart +- id: '1655029337428' +  alias: 'Alarms: Safety' +  description: '' +  trigger: +  - type: moist +    platform: device +    device_id: 62b0726b0781074264bd1ba3a69de306 +    entity_id: binary_sensor.bathroom_leak_water_leak +    domain: binary_sensor +  - platform: device +    type: turned_on +    device_id: d070cf57873fde4d4eeeed45e0e72f4a +    entity_id: switch.hall_smoke_alarm +    domain: switch +  - type: unsafe +    platform: device +    device_id: a40e83403ac69c75db53e21c88afd53b +    entity_id: binary_sensor.kitchen_gas +    domain: binary_sensor +  condition: [] +  action: +  - service: input_button.press +    data: {} +    target: +      entity_id: input_button.button_alert +  - service: notify.mobile_app_lm_g810 +    data: +      title: SmartPI Alarm +      message: Safety incidient +  - service: notify.smartpi +    data: +      message: Safety incidient +  mode: single +- id: '1655032416924' +  alias: 'Alarms: Wine Notification' +  description: '' +  trigger: +  - type: opened +    platform: device +    device_id: 1ac71f2a54426da15458e5b5090f7603 +    entity_id: binary_sensor.kitchen_door_contact +    domain: binary_sensor +  condition: [] +  action: +  - service: input_button.press +    data: {} +    target: +      entity_id: input_button.button_ring +  mode: single +- id: '1655037280868' +  alias: 'Alarms: Door-knock' +  description: '' +  trigger: +  - platform: device +    domain: mqtt +    device_id: 65b9dbde95854b17f5e0e31545962734 +    type: action +    subtype: vibration +    discovery_id: 0x00158d0002b310d2 action_vibration +  condition: +  - type: is_no_motion +    condition: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +  - type: is_not_open +    condition: device +    device_id: b45b5a514dd669f9f4bb8ebdaa396998 +    entity_id: binary_sensor.entrance_door_contact +    domain: binary_sensor +  action: +  - service: input_button.press +    data: {} +    target: +      entity_id: input_button.button_ring +  mode: single +- id: '1655084794489' +  alias: Telegram +  description: '' +  trigger: +  - platform: event +    event_type: telegram_command +  condition: [] +  action: +  - choose: +    - conditions: +      - condition: template +        value_template: '{{ trigger.event.data.command == "/office_light" }} ' +      sequence: +      - type: toggle +        device_id: 95931a9049849e575f2de543adf111eb +        entity_id: light.yeelight_color_0x7caaf86 +        domain: light +    - conditions: +      - condition: template +        value_template: '{{ trigger.event.data.command == "/switch" }} ' +      sequence: +      - if: +        - condition: template +          value_template: '{{ trigger.event.data.args|length == 1 }}' +        - condition: template +          value_template: '{{ states(trigger.event.data.args[0]) in ["on", "off", +            "true", "false" ] }}' +        then: +        - service: notify.smartpi +          data: +            message: Toggling entity {{ trigger.event.data.args[0] }} from the current +              state "{{ states(trigger.event.data.args[0]) }}" +        - service: homeassistant.toggle +          target: +            entity_id: '{{ trigger.event.data.args }}' +        else: +          choose: +          - conditions: +            - condition: template +              value_template: '{{ trigger.event.data.args|length != 1 }}' +            sequence: +            - service: notify.smartpi +              data: +                message: 'Wrong number of arguments for /switch command: {{ trigger.event.data.args +                  | length }}' +          - conditions: +            - condition: template +              value_template: '{{ states(trigger.event.data.args[0]) in ["unknown"] +                }}' +            sequence: +            - service: notify.smartpi +              data: +                message: 'Unknown entity: {{ trigger.event.data.args[0] }}' +          default: +          - service: notify.smartpi +            data: +              message: 'Entity {{ trigger.event.data.args[0] }} is in unsupported +                state: {{ states(trigger.event.data.args) }}' +    - conditions: +      - condition: template +        value_template: '{{ trigger.event.data.command == "/camera" }} ' +      sequence: +      - service: telegram_bot.send_photo +        data: +          disable_notification: true +          caption: AubergineView +          url: http://smartpi:8123{{ state_attr("camera.192_168_50_51", "entity_picture") +            }} +    default: +    - service: notify.smartpi +      data: +        message: 'Unsupported command: {{ trigger.event.data.command }} with params: +          {{ trigger.event.data.args }}' +  mode: single +- id: '1672608894803' +  alias: 'Hall: Camera Switch' +  description: '' +  use_blueprint: +    path: lights/light_switch.yaml +    input: +      switch: switch.hall_lights_center +      light: switch.hall_camera +- id: '1672624569107' +  alias: 'Hall: Entrance Combo' +  description: '' +  use_blueprint: +    path: lights/light_switch_combo.yaml +    input: +      switch: switch.entrance_lights_right +      master: switch.hall_lights_left +      on_click: [] +      off_click: [] +      dblclick: +      - service: script.sleep_and_wake +        data: +          mode: sleep +          target: house +      - service: input_button.press +        data: {} +        target: +          entity_id: input_button.button_confirm +        enabled: false +- id: '1672627582279' +  alias: 'Hall: Kitchen Combo' +  description: '' +  use_blueprint: +    path: lights/light_switch_combo.yaml +    input: +      switch: switch.kitchen_lights_right +      master: switch.hall_lights_left +      on_click: [] +      off_click: +      - service: switch.turn_off +        data: {} +        target: +          entity_id: +          - switch.entrance_lights_center +      dblclick: +      - service: switch.toggle +        target: +          entity_id: +          - switch.entrance_lights_center +        data: {} +- id: '1672629824242' +  alias: 'Hall: Away/Security Mode Switch' +  description: '' +  use_blueprint: +    path: lights/light_switch.yaml +    input: +      switch: switch.hall_lights_right +      light: input_boolean.mode_away +      delay: 0 +      on_click: +      - service: switch.turn_on +        target: +          entity_id: switch.hall_lights_center +      - service: input_button.press +        data: {} +        target: +          entity_id: input_button.button_confirm +      post_action: [] +- id: '1672638756112' +  alias: 'Alarms: Intrusion' +  description: '' +  use_blueprint: +    path: camera/intrusion.yaml +    input: +      mode: input_boolean.mode_away +      arm_delay: 15 +      disarm_delay: 5 +      sensors: +      - binary_sensor.entrance_door_contact +      - binary_sensor.hall_motions_occupancy +      - switch.lights_bedroom +      - switch.lights_living +      camera_script: +      - service: script.1672637427937 +        data: {} +      script: +      - parallel: +        - service: input_button.press +          data: {} +          target: +            entity_id: input_button.button_alert +        - service: notify.mobile_app_lm_g810 +          data: +            title: SmartPI Alarm +            message: Intrusion detected +        - service: notify.smartpi +          data: +            message: Intrusion detected +- id: '1672677604586' +  alias: 'Guestroom: Mode switch' +  description: '' +  use_blueprint: +    path: lights/light_switch.yaml +    input: +      switch: switch.guestroom_lights_right +      light: input_boolean.mode_guests +      on_click: +      - service: input_button.press +        data: {} +        target: +          entity_id: input_button.button_confirm +- id: '1672972431474' +  alias: Knob Office Bulb Control +  description: '' +  use_blueprint: +    path: lights/knob-bulb-control.yaml +    input: +      light: light.yeelight_color_0x7caaf86 +      knob: sensor.office_knob_action +      toggle: +      - type: toggle +        device_id: 32787706a8ff87380633b7c817057935 +        entity_id: switch.living_tablelamp +        domain: switch +      brightness: input_number.knob_office_brightness0 +      temperature: input_number.knob_office_temperature0 +      hue: input_number.knob_office_hue0 +      state: input_boolean.state_office_knob_pressed +- id: '1672979291802' +  alias: Knob Multi-Bulb Control +  description: '' +  use_blueprint: +    path: lights/knob-multi-bulb-control.yaml +    input: +      knob: sensor.office_knob_action +      lights: +      - light.yeelight_color_0x7caaf86 +      - light.smart_light +- id: '1672987670623' +  alias: 'Office: Dimming Button' +  description: '' +  use_blueprint: +    path: lights/light_button.yaml +    input: +      button: sensor.office_button_action +      light: light.yeelight_color_0x7caaf86 +      on_click: +      - service: homeassistant.turn_off +        data: {} +        target: +          entity_id: switch.lights_living_lustre +      dblclick: +      - if: +        - condition: state +          entity_id: switch.lights_living_lustre +          state: 'on' +        then: +        - type: turn_off +          device_id: 32787706a8ff87380633b7c817057935 +          entity_id: switch.living_tablelamp +          domain: switch +      - service: homeassistant.toggle +        data: {} +        target: +          entity_id: switch.lights_living_lustre +      hold_delay: 500 +      state: input_boolean.state_office_button_pressed +      hold: +      - device_id: 95931a9049849e575f2de543adf111eb +        domain: light +        entity_id: light.yeelight_color_0x7caaf86 +        type: brightness_decrease +- id: '1672989606410' +  alias: 'Office: Button' +  description: '' +  use_blueprint: +    path: lights/light_button.yaml +    input: +      button: sensor.office_button_action +      light: light.yeelight_color_0x7caaf86 +      on_click: +      - if: +        - condition: state +          entity_id: switch.smart_power_strip_pro_socket_1 +          state: 'off' +        then: +        - service: script.sleep_and_wake +          data: +            mode: wake +            target: office +      - service: homeassistant.turn_off +        data: {} +        target: +          entity_id: switch.lights_living_lustre +      dblclick: +      - if: +        - condition: state +          entity_id: switch.lights_living_lustre +          state: 'on' +        then: +        - type: turn_off +          device_id: 32787706a8ff87380633b7c817057935 +          entity_id: switch.living_tablelamp +          domain: switch +      - service: homeassistant.toggle +        data: {} +        target: +          entity_id: switch.lights_living_lustre +      hold_delay: 500 +      hold: [] +      longclick: +      - if: +        - condition: state +          entity_id: switch.smart_power_strip_pro_socket_1 +          state: 'off' +        then: +        - service: script.sleep_and_wake +          data: +            mode: wake +            target: office +        else: +        - parallel: +          - service: switch.turn_off +            data: {} +            target: +              entity_id: switch.lights_temporary +          - if: +            - condition: state +              entity_id: input_boolean.mode_alone +              state: 'on' +            then: +            - service: script.turn_off_bedroom_lights +              data: {} +          - if: +            - condition: state +              entity_id: input_boolean.mode_guests +              state: 'off' +            then: +            - service: switch.turn_off +              data: {} +              target: +                entity_id: switch.lights_guest +        - service: input_button.press +          target: +            entity_id: input_button.button_confirm +          data: {} +- id: '1672991247298' +  alias: 'Living: Light Sync' +  description: '' +  use_blueprint: +    path: lights/light_sync.yaml +    input: +      master: switch.living_lights_left +      slave: switch.living_lights_center +- id: '1672991298090' +  alias: 'Bedroom: Light Sync' +  description: '' +  use_blueprint: +    path: lights/light_sync.yaml +    input: +      master: switch.bedroom_lights_left +      slave: switch.bedroom_lights_center +- id: '1673021522642' +  alias: 'Motions: Kitchen' +  description: '' +  use_blueprint: +    path: motion/motion_switch.yaml +    input: +      light_target: +      - switch.kitchen_lights_left +      - switch.kitchen_lights_center +      motion_entity: binary_sensor.kitchen_motions_occupancy +      illumination_test: sensor +      illuminance_entity: sensor.kitchen_motions_illuminance_lux +      lux_threshold: 30 +- id: '1673037015865' +  alias: 'Motions: Night Light' +  description: '' +  use_blueprint: +    path: motion/motion_switch.yaml +    input: +      light_target: [] +      motion_entity: binary_sensor.hall_motions_occupancy +      illumination_test: sun +      illuminance_entity: sensor.hall_motions_illuminance_lux +      lux_threshold: 30 +      no_motion_wait: 5 +      on_click: +      - if: +        - condition: state +          entity_id: input_boolean.mode_away +          state: 'off' +        - condition: state +          entity_id: input_boolean.mode_alone +          state: 'on' +        - condition: state +          entity_id: input_boolean.mode_bright +          state: 'on' +        then: +        - type: turn_on +          device_id: 5c1c363a6825ad5a006f3bb84bb104ce +          entity_id: switch.hall_lights_left +          domain: switch +        else: +        - type: turn_on +          device_id: 87071fc9d8fb9ebbccb145f5642c7404 +          entity_id: light.aqara_hub_m1s_426c +          domain: light +          brightness_pct: 100 +      off_click: +      - parallel: +        - type: turn_off +          device_id: 5c1c363a6825ad5a006f3bb84bb104ce +          entity_id: switch.hall_lights_left +          domain: switch +        - type: turn_off +          device_id: 87071fc9d8fb9ebbccb145f5642c7404 +          entity_id: light.aqara_hub_m1s_426c +          domain: light +          brightness_pct: 100 +- id: '1673153262822' +  alias: 'Motions: Global ' +  description: '' +  trigger: +  - platform: state +    id: home +    entity_id: +    - group.master_phones +    from: not_home +    to: home +    for: +      hours: 0 +      minutes: 1 +      seconds: 0 +  - platform: state +    id: away +    entity_id: +    - group.master_phones +    from: home +    to: not_home +    for: +      hours: 1 +      minutes: 0 +      seconds: 0 +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 24 +      minutes: 0 +      seconds: 0 +    id: empty_day +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 120 +      minutes: 0 +      seconds: 0 +    id: empty_week +  - type: motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 0 +      minutes: 1 +      seconds: 0 +    id: motions +  - platform: state +    entity_id: +    - input_boolean.mode_away +    from: 'on' +    to: 'off' +    id: away_gone +  condition: [] +  action: +  - choose: +    - conditions: +      - condition: state +        entity_id: input_boolean.mode_house_sleep +        state: 'off' +      - condition: or +        conditions: +        - condition: trigger +          id: empty_day +        - condition: and +          conditions: +          - condition: trigger +            id: away +          - condition: state +            entity_id: input_boolean.mode_single +            state: 'on' +          - condition: state +            entity_id: binary_sensor.hall_motions_occupancy +            state: 'off' +            for: +              hours: 2 +              minutes: 0 +              seconds: 0 +      sequence: +      - service: script.sleep_and_wake +        data: +          mode: sleep +          target: house +      - service: input_boolean.turn_on +        data: {} +        target: +          entity_id: input_boolean.mode_house_sleep +    - conditions: +      - condition: trigger +        id: empty_week +      - condition: state +        entity_id: input_boolean.mode_house_hibernate +        state: 'off' +      sequence: +      - service: script.sleep_and_wake +        data: +          mode: hibernate +          target: house +      - service: input_boolean.turn_on +        data: {} +        target: +          entity_id: input_boolean.mode_house_hibernate +    - conditions: +      - condition: trigger +        id: home +      sequence: +      - service: input_boolean.turn_off +        data: {} +        target: +          entity_id: input_boolean.mode_away +    - conditions: +      - condition: or +        conditions: +        - condition: state +          entity_id: input_boolean.mode_house_sleep +          state: 'on' +        - condition: state +          entity_id: input_boolean.mode_house_hibernate +          state: 'on' +      - condition: or +        conditions: +        - condition: and +          conditions: +          - condition: trigger +            id: motions +          - condition: state +            entity_id: input_boolean.mode_away +            state: 'off' +        - condition: and +          conditions: +          - condition: trigger +            id: away_gone +          - type: is_motion +            condition: device +            device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +            entity_id: binary_sensor.hall_motions_occupancy +            domain: binary_sensor +      sequence: +      - if: +        - condition: state +          entity_id: input_boolean.mode_house_hibernate +          state: 'on' +        then: +        - service: script.sleep_and_wake +          data: +            mode: wake +            target: house +      - service: input_boolean.turn_off +        data: {} +        target: +          entity_id: +          - input_boolean.mode_house_sleep +          - input_boolean.mode_house_hibernate +    default: [] +  mode: single +- id: '1673156009695' +  alias: 'Motions: Office' +  description: '' +  trigger: +  - type: no_motion +    platform: device +    device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +    entity_id: binary_sensor.hall_motions_occupancy +    domain: binary_sensor +    for: +      hours: 2 +      minutes: 0 +      seconds: 0 +    id: sleep +  condition: [] +  action: +  - choose: +    - conditions: +      - condition: trigger +        id: sleep +      - condition: state +        entity_id: switch.smart_power_strip_pro_socket_1 +        state: 'on' +      sequence: +      - service: script.sleep_and_wake +        data: +          mode: sleep +          target: office +    default: [] +  mode: single +- id: '1673156130994' +  alias: 'Hall: Kitchen Sync' +  description: '' +  trigger: +  - platform: device +    type: turned_off +    device_id: 558ce3c924f9478aad68cb5b98f05ecc +    entity_id: switch.kitchen_lights_left +    domain: switch +  condition: [] +  action: +  - type: turn_off +    device_id: 558ce3c924f9478aad68cb5b98f05ecc +    entity_id: switch.kitchen_lights_center +    domain: switch +  mode: single +- id: '1673212686198' +  alias: 'Office: Sven' +  description: '' +  trigger: +  - platform: state +    entity_id: +    - switch.smart_power_strip_pro_socket_4 +    from: 'off' +    to: 'on' +    for: +      hours: 0 +      minutes: 0 +      seconds: 4 +  condition: [] +  action: +  - service: scene.turn_on +    data: {} +    target: +      entity_id: scene.sven_power_switch +  mode: single diff --git a/blueprints/automation/camera/intrusion.yaml b/blueprints/automation/camera/intrusion.yaml new file mode 100644 index 0000000..4d2b62c --- /dev/null +++ b/blueprints/automation/camera/intrusion.yaml @@ -0,0 +1,91 @@ +blueprint: +  name: Intrusion +  description: Script to execute in case of intrusion, e.g. streaming photos from Security Camera +  domain: automation +  input: +    sensors: +      name: Sensors +      description: Trigger on motion, open doors, etc. +      default: [] +      selector: +        entity: +          multiple: true +          domain: [ binary_sensor, light, switch ] +    mode: +      name: Mode +      description: Switch enabling/disabling shooting +      selector: +        entity: +          domain: input_boolean +    arm_delay: +      name: Arm Delay +      description: Delay before 'Away' mode activated and intrusion detection is operational (to allow you leaving the flat) +      default: 15 +      selector: +        number: +          min: 0 +          max: 60 +          unit_of_measurement: m +    disarm_delay: +      name: Disarm Delay +      description: Delay before alarms triggered after motion is detected (to allow disarm on arrival), camera shots are made without delay +      default: 5 +      selector: +        number: +          min: 0 +          max: 60 +          unit_of_measurement: m +    camera_script: +      name: camera_script +      description: Streaming Script for Security Camera +      default: [] +      selector: +        action: +    script: +      name: script +      description: Alarming scipt to issue notifications once intrusion is confirmed +      default: [] +      selector: +        action: + +trigger: +  - platform: state +    entity_id: !input "sensors" +    to: 'on' + +condition: +  - condition: state +    entity_id: !input "mode" +    state: 'on' +    enabled: true +    for: +      hours: 0 +      minutes: !input arm_delay +      seconds: 0 + +variables: +  disarm_delay: !input disarm_delay +  disarm_delay_seconds: '{{ (( disarm_delay * 60 )) }}' + +mode: single +action: +  - parallel: +    - choose: [] +      default: !input "camera_script" +    - sequence: +      - service: input_button.press +        target: +          entity_id: input_button.button_confirm +      - wait_for_trigger: +        - platform: state +          entity_id: !input mode +          to: 'off' +        timeout: '{{ disarm_delay_seconds }}' +        continue_on_timeout: true + +      - if: +        - condition: template +          value_template: '{{ wait.trigger == None }}' +        then: +        - choose: [] +          default: !input "script" diff --git a/blueprints/automation/homeassistant/motion_light.yaml b/blueprints/automation/homeassistant/motion_light.yaml new file mode 100644 index 0000000..54a4a4f --- /dev/null +++ b/blueprints/automation/homeassistant/motion_light.yaml @@ -0,0 +1,54 @@ +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 +  input: +    motion_entity: +      name: Motion Sensor +      selector: +        entity: +          domain: binary_sensor +          device_class: motion +    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/blueprints/automation/homeassistant/notify_leaving_zone.yaml b/blueprints/automation/homeassistant/notify_leaving_zone.yaml new file mode 100644 index 0000000..1dc8a0e --- /dev/null +++ b/blueprints/automation/homeassistant/notify_leaving_zone.yaml @@ -0,0 +1,46 @@ +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 +  input: +    person_entity: +      name: Person +      selector: +        entity: +          domain: person +    zone_entity: +      name: Zone +      selector: +        entity: +          domain: zone +    notify_device: +      name: Device to notify +      description: Device needs to run the official Home Assistant app to receive notifications. +      selector: +        device: +          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/blueprints/automation/lights/knob-bulb-control.yaml b/blueprints/automation/lights/knob-bulb-control.yaml new file mode 100644 index 0000000..5b6c3c7 --- /dev/null +++ b/blueprints/automation/lights/knob-bulb-control.yaml @@ -0,0 +1,271 @@ +blueprint: +  name: Knob Bulb Control +  description: Knob (clicking/rotating) to control bulb (or LED band) brightness, color temperature, and hue +  domain: automation +  input: +    knob: +      name: knob +      description: controller (select _action entity) +      selector: +        entity: +          domain: sensor +    light: +      name: Bulb +      description: smart bulb or power socket +      selector: +        entity: +          multiple: true +          domain: light +    toggle: +      name: toggle +      description: Script to run on clicking knob button (e.g. turn-of bulb power on/off) +      default: [] +      selector: +        action: + +    brightness: +      name: Brightness +      description: Current brightness of the bulb +      selector:  +        entity: +          domain: input_number +    temperature: +      name: Temperature +      description: Current color temperature of the bulb +      selector:  +        entity: +          domain: input_number +    hue: +      name: Hue +      description: Current hue of the bulb +      selector:  +        entity: +          domain: input_number +    state: +      name: State +      description: Indicates if button is pressed and we currently changing the hue  +      selector:  +        entity: +          domain: input_boolean + +    brightness_step: +      name: Brightness Step +      description: Increment/Decrement of brightness +      default: 50 +      selector: +        number: +          min: 10 +          max: 100 +    hue_delay: +      name: Hue Delay +      description: Delay between hue changes +      default: 500 +      selector: +        number: +          min: 100 +          max: 10000 + +# Light is triggering when bulb is controlled by other means. So, I think it is better to follow 'multi' way  +# and just store knob settings for the bulb ignoring how it is changed in other ways (in the end use-cases differ also) +trigger: +  - platform: state +    id: knob +    entity_id: !input "knob" +    to: +      - "toggle" +      - "brightness_step_up" +      - "brightness_step_down" +      - "color_temperature_step_up" +      - "color_temperature_step_down" +      - "hue_move" + +  - platform: state +    id: brightness_change +    entity_id: !input light +    attribute: brightness +#  - platform: state +#    id: hue_move +#    entity_id: !input state +#    to: 'on' + +variables: +  light: !input light +  brightness: !input brightness +  temperature: !input temperature +  hue: !input hue + +  brightness_step: !input brightness_step +  hue_delay: !input hue_delay + +mode: queued +action: +- choose: +  - conditions: +    - condition: trigger +      id: knob +    sequence: +    - choose: +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "brightness_step_up" }}' +        sequence: +        - service: light.turn_on +          data: +            brightness_step: '{{ brightness_step }}' +          target: +            entity_id: !input light  +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "brightness_step_down" }}' +        sequence: +        - service: light.turn_on +          data: +            brightness_step: '-{{ brightness_step }}' +          target: +            entity_id: !input light +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "color_temperature_step_up" }}' +        sequence: +        - service: input_number.increment +          target: +            entity_id: !input temperature +        - service: light.turn_on +          data: +            kelvin: '{{ states(temperature) }}' +          target: +            entity_id: !input light +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "color_temperature_step_down" }}' +        sequence: +        - service: input_number.decrement +          data: {} +          target: +            entity_id: !input temperature +        - service: light.turn_on +          data: +            kelvin: '{{ states(temperature) }}' +          target: +            entity_id: !input light +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "hue_move" }}' +        sequence: +        - service: input_boolean.turn_on +          target: +            entity_id: !input state +        - repeat: +            until: +#            - condition: state +#              entity_id: !input state +#              state: 'off' +            - condition: template +              value_template: '{{ wait.trigger != None }}' +            sequence: +            - if: +              - condition: template +                value_template: '{{ states(hue) | float < 359 }}' +              then: +              - service: input_number.increment +                data: {} +                target: +                  entity_id: !input hue +              else: +              - service: input_number.set_value +                data: +                  value: 0 +                target: +                  entity_id: !input hue +            - service: light.turn_on +              data: +                hs_color: '{{ states(hue) }}, 100' +              target: +                entity_id: !input light +            - wait_for_trigger: +              - platform: state +                entity_id: !input knob +                to: 'hue_stop' +              timeout: +                milliseconds: !input hue_delay +              continue_on_timeout: true +        - service: input_boolean.turn_off +          target: +            entity_id: !input state +#      - conditions: +#        - condition: template +#          value_template: '{{ trigger.to_state.state == "hue_stop" }}' +#        sequence: +#        - service: input_boolean.turn_off +#          target: +#            entity_id: !input state +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "toggle" }}' +        sequence: +        - choose: [] +          default: !input "toggle" + +  - conditions: +    - condition: trigger +      id: brightness_change +    - condition: state +      entity_id: !input light +      state: 'on' +    sequence: +    - service: input_number.set_value +      data: +        value: '{{ state_attr(light, ''brightness'') }}' +      target: +        entity_id: !input brightness + +#  - conditions: +#    - condition: trigger +#      id: hue_move +#    sequence: +#    - repeat: +#        until: +#        - condition: state +#          entity_id: !input state +#          state: 'off' +#        - condition: template +#          value_template: '{{ wait.trigger != None }}' +#        sequence: +#        - if: +#          - condition: template +#            value_template: '{{ states(hue) | float < 359 }}' +#          then: +#          - service: input_number.increment +#            data: {} +#            target: +#              entity_id: !input hue +#          else: +#          - service: input_number.set_value +#            data: +#              value: 0 +#            target: +#              entity_id: !input hue +#        - service: light.turn_on +#          data: +#            hs_color: '{{ states(hue) }}, 100' +#          target: +#            entity_id: !input light +# +#        - wait_for_trigger: +#          - platform: state +#            entity_id: !input knob +#            to: 'hue_stop' +#          timeout: +#            milliseconds: !input hue_delay +#          continue_on_timeout: true +# +#        - if: +#          - condition: template +#            value_template: '{{ wait.trigger != None }}' +#          then: +#            - service: input_boolean.turn_off +#              target: +#                entity_id: !input state +#            - delay: +#                timeout: +#                  milliseconds: !input hue_delay diff --git a/blueprints/automation/lights/knob-multi-bulb-control.yaml b/blueprints/automation/lights/knob-multi-bulb-control.yaml new file mode 100644 index 0000000..412ce3d --- /dev/null +++ b/blueprints/automation/lights/knob-multi-bulb-control.yaml @@ -0,0 +1,191 @@ +blueprint: +  name: Knob Multi-Bulb Control +  description: Knob (clicking/rotating) to control bulb (or LED band) brightness, color temperature, and hue +  domain: automation +  input: +    knob: +      name: knob +      description: controller (select _action entity) +      selector: +        entity: +          domain: sensor +    lights: +      name: Bulb +      description: smart bulb or power socket +      selector: +        entity: +          multiple: true +          domain: light +    toggle: +      name: toggle +      description: Script to run on clicking knob button (e.g. turn-of bulb power on/off) +      default: [] +      selector: +        action: + +    name: +      name: name +      description: Name of variables tracking bulb parameters (should include ***_current, ***_brighness0, ***_temperature0, ***_hue0 +      default: knob_office + +    hue_delay: +      name: Hue Delay +      description: Delay between hue changes +      default: 500 +      selector: +        number: +          min: 100 +          max: 10000 + +trigger: +  - platform: state +    id: knob +    entity_id: !input "knob" +    to: +      - "toggle" +      - "brightness_step_up" +      - "brightness_step_down" +      - "color_temperature_step_up" +      - "color_temperature_step_down" +      - "hue_move" + +variables: +  name: !input name +  current: 'input_number.{{ name + "_current"  }}' +  brightness: 'input_number.{{ name + "_brightness" }}{{ states(current) | int }}' +  temperature: 'input_number.{{ name + "_temperature" }}{{ states(current) | int }}' +  hue: 'input_number.{{ name + "_hue" }}{{ states(current) | int }}' + +  lights: !input lights +  light: '{{ lights[states(current) | int] }}' + +  hue_delay: !input hue_delay + +mode: queued +action: +- choose: +  - conditions: +    - condition: trigger +      id: knob +    sequence: +    - choose: +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "brightness_step_up" }}' +        sequence: +        - service: input_number.increment +          target: +            entity_id: '{{ brightness }}' +        - service: light.turn_on +          data: +            brightness: '{{ states(brightness) }}' +          target: +            entity_id: '{{ light }}' +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "brightness_step_down" }}' +        sequence: +        - service: input_number.decrement +          data: {} +          target: +            entity_id: '{{ brightness }}' +        - service: light.turn_on +          data: +            brightness: '{{ states(brightness) }}' +          target: +            entity_id: '{{ light }}' +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "color_temperature_step_up" }}' +        sequence: +        - service: input_number.increment +          target: +            entity_id: '{{ temperature }}' +        - service: light.turn_on +          data: +            kelvin: '{{ states(temperature) }}' +          target: +            entity_id: '{{ light }}' +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "color_temperature_step_down" }}' +        sequence: +        - service: input_number.decrement +          target: +            entity_id: '{{ temperature }}' +        - service: light.turn_on +          data: +            kelvin: '{{ states(temperature) }}' +          target: +            entity_id: '{{ light }}' +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "hue_move" }}' +        sequence: +        - repeat: +            until: +            - condition: template +              value_template: '{{ wait.trigger != None }}' +            sequence: +            - if: +              - condition: template +                value_template: '{{ states(hue) | float < 359 }}' +              then: +              - service: input_number.increment +                data: {} +                target: +                  entity_id: '{{ hue }}' +              else: +              - service: input_number.set_value +                data: +                  value: 0 +                target: +                  entity_id: '{{ hue }}' +            - service: light.turn_on +              data: +                hs_color: '{{ states(hue) }}, 100' +              target: +                entity_id: '{{ light }}' +            - wait_for_trigger: +              - platform: state +                entity_id: !input knob +                to: 'hue_stop' +              timeout: +                milliseconds: !input hue_delay +              continue_on_timeout: true +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "toggle" }}' +        sequence: +          - if: +              - condition: template +                value_template: '{{ toggle | length > 0 }}' +            then: +            - choose: [] +              default: !input "toggle" +            else: +            - service: input_number.increment +              target: +                entity_id: '{{ current }}' +            - if: +              - condition: template +                value_template: '{{ states(current) | float == (lights | length) }}' +              then: +              - service: input_number.set_value +                data: +                  value: 0 +                target: +                  entity_id: '{{ current }}' + +            - service: light.turn_off +              target: +                entity_id: '{{ lights[states(current) | int] }}' +            - delay: +                seconds: 1 +            - service: light.turn_on +              data: +                kelvin: '{{ states("input_number." + name + "_temperature" + (states(current) | int | string)) }}' +                brightness: '{{ states("input_number." + name + "_brightness" + (states(current) | int | string)) }}' +#                hs_color: '{{ states("input_number." + name + "_hue" + (states(current) | int | string)) }}, 100' +              target: +                entity_id: '{{ lights[states(current) | int] }}' diff --git a/blueprints/automation/lights/light_button.yaml b/blueprints/automation/lights/light_button.yaml new file mode 100644 index 0000000..7aeb0ab --- /dev/null +++ b/blueprints/automation/lights/light_button.yaml @@ -0,0 +1,171 @@ +blueprint: +  name: Light Button +  description: Button to control smart bulb and perform other actions when bulb turns on/off, plus additional actions on double-click and long-press (select *_action entity) +  domain: automation +  input: +    button: +      name: button +      description: controller +      selector: +        entity: +          domain: sensor +    light: +      name: light +      description: another switch, smart bulb, or power socket +      selector: +        entity: +          domain: light +    temperature: +      name: Temperature +      description: Color Temperature +      default: 6500 +      selector: +        number: +          min: 2000 +          max: 6500 +    on_click: +      name: on_click +      description: Additional actions to perform while turning on master light +      default: [] +      selector: +        action: +    off_click: +      name: off_click +      description: Additional actions to perform while turning off master light +      default: [] +      selector: +        action: +    dblclick: +      name: dblclick +      description: Actions to perform on double click +      default: [] +      selector: +        action: +    longclick: +      name: longclick +      description: Actions to perform on long-press (single action) +      default: [] +      selector: +        action: +    hold: +      name: hold +      description: Actions to perform on hold (iterative until released) +      default: [] +      selector: +        action: +    hold_delay: +      name: Hold Delay +      description: Delay between calling hold actions (milliseconds) +      default: 500 +      selector: +        number: +          min: 100 +          max: 10000 + +    state: +      name: State +      description: Indicates if button is pressed and we currently changing the brightness +      default: None +      selector:  +        entity: +          domain: input_boolean + +trigger: +  - platform: state +    id: button +    entity_id: !input "button" +    to: +      - "single" +      - "double" +      - "hold" + + +variables: +   state: !input state +   hold: !input hold + +# Can't do 'restart' since it will break wait_for_trigger +mode: single + +action: +- choose: +  - conditions: +    - condition: trigger +      id: button +    sequence: +    - choose: +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "single" }}' +        sequence: +          - if: +              - condition: state +                entity_id: !input light +                state: 'on' +            then: +              - parallel: +                - service: light.turn_off +                  target: +                    entity_id: !input light +                - choose: [] +                  default: !input "off_click" +            else: +              - parallel: +                - service: light.turn_on +                  data: +                    brightness_pct: 100 +                    kelvin: !input temperature +                  target: +                    entity_id: !input light +                - choose: [] +                  default: !input "on_click" + +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "double" }}' +        sequence: +          - choose: [] +            default: !input "dblclick" + +      - conditions: +        - condition: template +          value_template: '{{ trigger.to_state.state == "hold" }}' +        sequence: +          - choose: [] +            default: !input "longclick" + +          - if: +              - condition: template +                value_template: '{{ hold | length > 0 }}' +            then: +              - if: +                  - condition: template +                    value_template: '{{ state }}' +                then: +                  - service: input_boolean.turn_on +                    target: +                      entity_id: !input state + +              - repeat: +                  until: +                    - condition: template +                      value_template: '{{ wait.trigger != None }}' +                  sequence: +                  - choose: [] +                    default: !input "hold" + +                  - wait_for_trigger: +                      - platform: state +                        entity_id: !input button +                        to: 'release' +                    timeout:  +                      milliseconds: !input hold_delay +                    continue_on_timeout: true + +              - if: +                  - condition: template +                    value_template: '{{ state }}' +                then: +                  - service: input_boolean.turn_off +                    target: +                      entity_id: !input state diff --git a/blueprints/automation/lights/light_switch.yaml b/blueprints/automation/lights/light_switch.yaml new file mode 100644 index 0000000..b3a4f81 --- /dev/null +++ b/blueprints/automation/lights/light_switch.yaml @@ -0,0 +1,115 @@ +blueprint: +  name: Light Switch +  description: Switch to control light bulb or power plug (including two-way synchronization) +  domain: automation +  input: +    switch: +      name: Switch +      description: controller +      selector: +        entity: +          domain: switch +    light: +      name: Bulb +      description: smart bulb or power socket +      selector: +        entity: +          domain: [light, switch] +    dblclick: +      name: dblclick +      description: Actions to perform on double click +      default: [] +      selector: +        action: +    on_click: +      name: on_click +      description: Additional actions to perform while turning on master switch +      default: [] +      selector: +        action: +    off_click: +      name: off_click +      description: Additional actions to perform while turning off master switch +      default: [] +      selector: +        action: + +variables: +  switch_entity: !input switch +  light_entity: !input light +  dblclick: !input dblclick + +trigger: +  - platform: state +    entity_id: !input "switch" +  - platform: state +    entity_id: !input "light" + +mode: single +action: +  - choose: +      - conditions: +          - "{{ trigger.entity_id == switch_entity }}" +        sequence: +          - if: +              - condition: template +                value_template: '{{ dblclick | length > 0 }}' +            then: +              - wait_for_trigger: +                  - platform: state +                    entity_id: !input switch +                timeout: '1' +                continue_on_timeout: true +              - if: +                  - condition: template +                    value_template: '{{ wait.trigger == None }}' +                then: +                  - if: +                      - condition: template +                        value_template: '{{trigger.to_state.state == "on" }}' +                    then: +                      - parallel: +                          - choose: [] +                            default: !input "on_click" +                          - service: homeassistant.turn_on +                            target: +                              entity_id: !input light +                    else: +                      - parallel: +                          - choose: [] +                            default: !input "off_click" +                          - service: homeassistant.turn_off +                            target: +                              entity_id: !input light +                else: +                  - choose: [] +                    default: !input "dblclick" +            else: +              - if: +                  - condition: template +                    value_template: '{{trigger.to_state.state == "on" }}' +                then: +                  - parallel: +                      - choose: [] +                        default: !input "on_click" +                      - service: homeassistant.turn_on +                        target: +                          entity_id: !input light +                else: +                  - parallel: +                      - choose: [] +                        default: !input "off_click" +                      - service: homeassistant.turn_off +                        target: +                          entity_id: !input light +      - conditions: +          - "{{ trigger.entity_id == light_entity  }}" +        sequence: +          - service: > +              {% if trigger.to_state.state == "on" %} +                switch.turn_on +              {% else %} +                switch.turn_off +              {% endif %} +            target: +              entity_id: !input switch diff --git a/blueprints/automation/lights/light_switch_combo.yaml b/blueprints/automation/lights/light_switch_combo.yaml new file mode 100644 index 0000000..9ea8655 --- /dev/null +++ b/blueprints/automation/lights/light_switch_combo.yaml @@ -0,0 +1,92 @@ +blueprint: +  name: Light Switch Combo +  description: Switch to control another switch, light bulb, or power plug (no sync) and allow another action on double click +  domain: automation +  input: +    switch: +      name: switch +      description: controller +      selector: +        entity: +          domain: switch +    master: +      name: master +      description: another switch, smart bulb, or power socket +      selector: +        entity: +    dblclick: +      name: dblclick +      description: Actions to perform on double click +      default: [] +      selector: +        action: +    on_click: +      name: on_click +      description: Additional actions to perform while turning on master switch +      default: [] +      selector: +        action: +    off_click: +      name: off_click +      description: Additional actions to perform while turning off master switch +      default: [] +      selector: +        action: + +#variables: +#  switch_entity: !input switch +#  master_entity: !input master + +trigger: +  - platform: state +    entity_id: !input "switch" + +# Can't do 'restart' since it will break wait_for_trigger +mode: single +action: +  - wait_for_trigger: +    - platform: state +      entity_id: !input switch +    timeout: '1' +    continue_on_timeout: true + +  - if: +      - condition: template +        value_template: '{{ wait.trigger == None }}' +    then: +      - if: +          - condition: state +            entity_id: !input switch +            state: 'on' +        then: +          - if: +              - condition: state +                entity_id: !input master +                state: 'on' +            then: +              - parallel: +                - service: homeassistant.toggle +                  target: +                    entity_id: !input master +                - choose: [] +                  default: !input "off_click" +            else: +              - parallel: +                - service: homeassistant.toggle +                  target: +                    entity_id: !input master +                - choose: [] +                  default: !input "on_click" +    else: +      - choose: [] +        default: !input "dblclick" +#      - service: switch.turn_off +#        target: +#          entity_id: switch.all_lights +#      - service: input_button.press +#        target: +#          entity_id: input_button.button_confirm + +  - service: switch.turn_off +    target: +      entity_id: !input switch diff --git a/blueprints/automation/lights/light_sync.yaml b/blueprints/automation/lights/light_sync.yaml new file mode 100644 index 0000000..44161ae --- /dev/null +++ b/blueprints/automation/lights/light_sync.yaml @@ -0,0 +1,55 @@ +blueprint: +  name: Light Sync +  description: Allows to switch both parts of lustre with single click +  domain: automation + +  input: +    master: +      name: Master +      description: Master Switch +      selector: +        entity: +          domain: switch +    slave: +      name: Slave +      description: Slave Switch +      selector: +        entity: +          domain: switch +    on_click: +      name: on_click +      description: Additional actions to perform while turning on master switch +      default: [] +      selector: +        action: +    off_click: +      name: off_click +      description: Additional actions to perform while turning off master switch +      default: [] +      selector: +        action: + + +trigger: +  - platform: state +    entity_id: !input "master" + +mode: single +action: +  - if: +      - condition: template +        value_template: '{{trigger.to_state.state == "on" }}' +    then: +      - parallel: +          - choose: [] +            default: !input "on_click" +          - service: homeassistant.turn_on +            target: +              entity_id: !input slave +    else: +      - parallel: +          - choose: [] +            default: !input "off_click" +          - service: homeassistant.turn_off +            target: +              entity_id: !input slave diff --git a/blueprints/automation/motion/motion_switch.yaml b/blueprints/automation/motion/motion_switch.yaml new file mode 100644 index 0000000..c78e31f --- /dev/null +++ b/blueprints/automation/motion/motion_switch.yaml @@ -0,0 +1,163 @@ +blueprint: +  name: Motion-activated Switch +  description: Turn on a light when motion is detected and surroundings are dark +  domain: automation +  input: +    motion_entity: +      name: Motion Sensor +      selector: +        entity: +          domain: binary_sensor +          device_class: motion + +    illumination_test: +      name: Illumination Test +      description: Select how to check if existing illumination is sufficient +      default: sun +      selector: +        select: +          options: +            - label: Illuminance Sensor +              value: sensor +            - label: Sun Elevation +              value: sun +            - label: Always turn on lights +              value: none +    illuminance_entity: +      name: Illuminance Sensor +      description: Sensor providing information about illumination in the room (keep empty to rely on sun position) +      selector: +        entity: +          domain: sensor +          device_class: illuminance +    lux_threshold: +      name: LUX threshold +      description: Threshold bellow which we consider that lighting is needed +      default: 40 +      selector: +        number: +          min: 10 +          max: 1000 +          unit_of_measurement: lux +    sun_elevation: +      name: Sun Elevation +      description: Sun elevation (suggested between 0 and -6) when dusks settles and we need to turn on lights) +      default: 0 +      selector: +        number: +          min: -30 +          max: 30 +          unit_of_measurement: ° + + +    light_target: +      name: Light Target +      default: [] +      selector: +        entity: +          multiple: true +          domain: [switch, 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 + +    on_click: +      name: on_click +      description: Additional actions to perform while turning on master light +      default: [] +      selector: +        action: +    off_click: +      name: off_click +      description: Additional actions to perform while turning off master light +      default: [] +      selector: +        action: + + + +variables: +  lux_threshold: !input lux_threshold +  illuminance_entity: !input illuminance_entity +  test: !input illumination_test + +  current_lux: '{{ (states(illuminance_entity) | float) }}' + +# If motion is detected within the delay, +# we restart the script. +mode: restart +max_exceeded: silent + +trigger: +  - platform: state +    id: "turn_on" +    entity_id: !input motion_entity +    from: "off" +    to: "on" +  - platform: state +    id: "turn_off" +    entity_id: !input motion_entity +    from: "on" +    to: "off" +    for: +      seconds: !input no_motion_wait + +action: +  - choose: +      - conditions: +          - condition: trigger +            id: "turn_on" +        sequence: +          - choose: +              - conditions:  +                  - condition: template +                    value_template: '{{ test == "sensor" }}' +                sequence: +                  - if: +                      - condition: template +                        value_template: '{{ (states(illuminance_entity) | float) < lux_threshold }}' +                    then: +                      - choose: [] +                        default: !input "on_click" +                      - service: switch.turn_on +                        target:  +                          entity_id: !input light_target + +              - conditions:  +                  - condition: template +                    value_template: '{{ test == "sun" }}' +                sequence: +                  - if: +                      - condition: numeric_state +                        entity_id: sun.sun +                        attribute: elevation +                        below: !input sun_elevation +                    then: +                      - choose: [] +                        default: !input "on_click" +                      - service: switch.turn_on +                        target: +                          entity_id: !input light_target +            default: +              - choose: [] +                default: !input "on_click" +              - service: switch.turn_on +                target:  +                   entity_id: !input light_target + +      - conditions: +          - condition: trigger +            id: "turn_off" +        sequence: +          - choose: [] +            default: !input "off_click" +          - service: switch.turn_off +            target:  +              entity_id: !input light_target +    default: [] diff --git a/blueprints/script/camera/security_camera.yaml b/blueprints/script/camera/security_camera.yaml new file mode 100644 index 0000000..0430266 --- /dev/null +++ b/blueprints/script/camera/security_camera.yaml @@ -0,0 +1,142 @@ +blueprint: +  name: Security Camera Streamer +  description: Stream photos from security camera +  domain: script +  input: +    camera: +      name: Camera +      description: Camera +      default: camera.192_168_50_51 +      selector: +        entity: +          domain: camera +    motion_sensor: +      name: Motion Sensor +      description: Sensor detecting if there are motions to trigger the camera +      selector: +        entity: +          domain: binary_sensor +          device_class: motion +    host: +      name: Host +      description: Host running camera server +      default: http://127.0.0.1:8123 +    caption:  +      name: Caption +      description: Caption to send in telegram message +      default: 'Intusion Alert: ' +    lights_on: +      name: Lights On +      description: List of lights to turn on +      default: [] +      selector: +        entity: +          multiple: true +          domain: [light, switch] +    lights_off: +      name: Lights Off +      description: List of lights to turn off +      default: [] +      selector: +        entity: +          multiple: true +          domain: [light, switch] +    prepare: +      name: prepare +      description: Actions to perform before shooting photos +      default: [] +      selector: +        action: +    delay: +      name: Delay +      description: Delay between shots (seconds) +      default: 5 +      selector: +        number: +          min: 1 +          max: 3600 +          unit_of_measurement: s +    fast_shots: +      name: Fast Shots +      description: Number of initial shots with short delay +      default: 10 +      selector: +        number: +          min: 0 +          max: 50 +    fast_delay: +      name: Fast Delay +      description: Delay between fast shots (milliseconds) +      default: 1000 +      selector: +        number: +          min: 100 +          max: 10000 +          unit_of_measurement: ms + +variables: +  camera: !input camera +  smartpi: !input host +  caption: !input caption +  delay: !input delay +  fast_shots: !input fast_shots +  fast_delay: !input fast_delay + +mode: restart +sequence: + - parallel: +    - service: homeassistant.turn_on +      target: +        entity_id: !input lights_on +    - service: homeassistant.turn_off +      target: +        entity_id: !input lights_off +    - choose: [] +      default: !input "prepare" +    - sequence: +      - service: telegram_bot.send_photo +        data: +          disable_notification: false +          caption: '{{ caption }} at {{ states("sensor.date_time_iso") +            }}' +          url: '{{ smartpi + state_attr(camera, "entity_picture") }}' +      - repeat: +          while: +          - condition: template +            value_template: '{{ repeat.index < fast_shots }}' +          sequence: +          - service: telegram_bot.send_photo +            data: +              disable_notification: true +              caption: '{{ caption }} {{ repeat.index }} (fast)' +              url: '{{ smartpi + state_attr(camera, "entity_picture") }}' +          - delay: +              hours: 0 +              minutes: 0 +              seconds: 0 +              milliseconds: '{{ fast_delay }}' +      - repeat: +# About 30 seconds delay before occupancy clears (both ways via state or device) +          until: +          - condition: state +            entity_id: !input motion_sensor +            state: 'off' +#            for:  +#              seconds: 2 +#          - type: is_no_motion +#            condition: device +#            device_id: 6deb0a6fb7a4a849ba22afc166cf9919 +#            device_id: '{{ device_id("binary_sensor.0x00158d0004485e0b_occupancy") }}' +#            entity_id: binary_sensor.0x00158d0004485e0b_occupancy +#            domain: binary_sensor +          sequence: +          - service: telegram_bot.send_photo +            data: +              disable_notification: true +              caption: '{{ caption }} {{ repeat.index + fast_shots - 1 }}' +              url: '{{ smartpi + state_attr(camera, "entity_picture") }}' +          - delay: +              hours: 0 +              minutes: 0 +              seconds: '{{ delay }}' +              milliseconds: 0 diff --git a/blueprints/script/camera/send_photo.yaml b/blueprints/script/camera/send_photo.yaml new file mode 100644 index 0000000..2b14639 --- /dev/null +++ b/blueprints/script/camera/send_photo.yaml @@ -0,0 +1,37 @@ +blueprint: +  name: Send Photo +  description: Send a single photo from the camera +  domain: script +  input: +    camera: +      name: Camera +      description: Camera +      default: camera.192_168_50_51 +      selector: +        entity: +          domain: camera +    host: +      name: Host +      description: Host running camera server +      default: http://127.0.0.1:8123 +    caption:  +      name: Caption +      description: Caption to send in telegram message +      default: '' + +variables: +  camera: !input camera +  smartpi: !input host +  caption: !input caption +#  caption: AubergineView +#  delay: 5 +#  fast_shots: 15 +#  fast_delay: 1000 + +mode: single +sequence: +  - service: telegram_bot.send_photo +    data: +      disable_notification: false +      caption: '{{ caption }} at {{ states("sensor.date_time_iso") }}' +      url: '{{ smartpi + state_attr(camera, "entity_picture") }}' diff --git a/blueprints/script/devices/aircon.yaml b/blueprints/script/devices/aircon.yaml new file mode 100644 index 0000000..b2641be --- /dev/null +++ b/blueprints/script/devices/aircon.yaml @@ -0,0 +1,135 @@ +blueprint: +  name: AirCon +  description: Stream photos from security camera +  domain: script +  input: +    power: +      name: Power +      description: Aircon Smart Power Plug +      selector: +        entity: +          domain: switch +    temperature: +      name: Temperature +      description: Temperature sensor +      selector: +        entity: +          domain: sensor +          device_class: temperature +    cold_temp: +      name: Cold Temp +      description: Temperature threshold to turn on heating +      default: 16 +      selector: +        number: +          min: 8 +          max: 20 +          unit_of_measurement: C +    hot_temp: +      name: Hot Temp +      description: Temperature threshold to turn on cooling +      default: 20 +      selector: +        number: +          min: 20 +          max: 36 +          unit_of_measurement: C +    cool_scene: +      name: Cool Scene +      description: Cooling scene of Aircon +      selector: +        entity: +          domain: scene +    heat_scene: +      name: Heat Scene +      description: Warming scene of Aircon +      selector: +        entity: +          domain: scene +    off_scene: +      name: Off Scene +      description: Off scene of Aircon +      selector: +        entity: +          domain: scene +    confirm: +      name: Confirm +      description: Confirmation script +      default: [] +      selector: +        action: + +variables: +  temp: !input temperature +  cold: !input cold_temp +  hot: !input hot_temp + +alias: AirCon +sequence: +  - if: +      - condition: state +        entity_id: !input power +        state: 'on' +    then: +      - service: scene.turn_on +        target: +          entity_id: !input off_scene +      - delay: +          hours: 0 +          minutes: 0 +          seconds: 5 +          milliseconds: 0 +      - service: switch.turn_off +        target: +          entity_id: !input power +    else: +      - service: switch.turn_on +        target: +          entity_id: !input power +      - delay: +          hours: 0 +          minutes: 0 +          seconds: 5 +          milliseconds: 0 +      - choose: +          - conditions:  +              - "{{ states('sensor.bedroom_temp_temperature') | float < cold }}" +            sequence: +              - service: scene.turn_on +                target: +                  entity_id: !input heat_scene +          - conditions:  +              - "{{ states('sensor.bedroom_temp_temperature') | float > hot }}" +            sequence: +              - service: scene.turn_on +                target: +                  entity_id: !input cool_scene +        default: +          - service: switch.turn_off +            target: +              entity_id: !input power +      - service: switch.turn_on +        target: +          entity_id: !input power +      - choose: [] +        default: !input "confirm" + +#  - if: +#      - condition: state +#        entity_id: switch.bedroom_aircon +#        state: 'off' +#    then: +#      - service: switch.turn_on +#        data: {} +#        target: +#          entity_id: switch.bedroom_aircon +#      - delay: +#          hours: 0 +#          minutes: 0 +#          seconds: 5 +#          milliseconds: 0 +  - service: scene.turn_on +    target: +      entity_id: scene.hyundai_aircon_cool_18 +    metadata: {} +mode: single diff --git a/blueprints/script/devices/kodi-alarm.yaml b/blueprints/script/devices/kodi-alarm.yaml new file mode 100644 index 0000000..48ecd1c --- /dev/null +++ b/blueprints/script/devices/kodi-alarm.yaml @@ -0,0 +1,29 @@ +blueprint: +  name: Kodi - Play Alarm +  description: Stream photos from security camera +  domain: script +  input: +    player: +      name: Player +      description: KoDi Media Player +      selector: +        entity: +          domain: media_player +    song: +      name: Player +      description: KoDi Media Player +      selector: +        media: {} + +mode: restart +sequence: +  - service: media_player.volume_set +    data: +      volume_level: 1 +    target: +      entity_id: !input player +  - service: media_player.play_media +    target: +      entity_id: !input player +    data: +      !input song diff --git a/blueprints/script/homeassistant/confirmable_notification.yaml b/blueprints/script/homeassistant/confirmable_notification.yaml new file mode 100644 index 0000000..d52e5a6 --- /dev/null +++ b/blueprints/script/homeassistant/confirmable_notification.yaml @@ -0,0 +1,84 @@ +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 +  input: +    notify_device: +      name: Device to notify +      description: Device needs to run the official Home Assistant app to receive notifications. +      selector: +        device: +          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/blueprints/script/lights/turn_off_lights.yaml b/blueprints/script/lights/turn_off_lights.yaml new file mode 100644 index 0000000..e5538b7 --- /dev/null +++ b/blueprints/script/lights/turn_off_lights.yaml @@ -0,0 +1,32 @@ +blueprint: +  name: turn_off_lights +  description: Turns off a group of lights +  domain: script +  input: +    lights: +      name: Affected class of lights +      description: "Which class of lights to turn off: all, bedroom, living, hall" +      default: "all" + +variables: +  name: !input lights +  std: "switch.lights_{{ name }}" +  manual: "switch.lights_{{ name }}_manual" + + +mode: single + +sequence: +  - service: switch.turn_off +    target: +      entity_id: "{{ std, manual }}" + +  - delay: +      hours: 0 +      minutes: 0 +      seconds: 3 +      milliseconds: 0 + +  - service: switch.turn_on +    target: +      entity_id: "{{ [ manual ] }}" diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..7310d24 --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,89 @@ + +# Loads default set of integrations. Do not remove. +default_config: + +#logger: +#  default: debug + +lovelace: +  mode: yaml +  resources: +    - url: "/local/community/lovelace-layout-card/layout-card.js" +      type: "module" +    - url: "/local/community/restriction-card/restriction-card.js?hacstag=215633404127" +      type: "module" + +frontend: +  themes: !include_dir_merge_named themes + + +# Trusted networks should go first or allow_bypass_login will be ignored +homeassistant: +  auth_providers: +    - type: trusted_networks +      trusted_networks: +        - 192.168.50.0/23 +      trusted_users: +        192.168.50.0/23: 31a296cc30a243089f121cef93b46cc0 +        192.168.50.234: 31a296cc30a243089f121cef93b46cc0 +        192.168.51.118: 31a296cc30a243089f121cef93b46cc0 +      allow_bypass_login: true +#    - type: legacy_api_password +#      api_password: !secret api_password +    - type: homeassistant + +# Hass is bad with self-signed certificates. Therefore, we use letsencrypt at darksoft.org and do proxying there +http: +#  ssl_certificate: /config/ssl/smartpi.suren.me.crt +#  ssl_key: /config/ssl/smartpi.suren.me.key +  use_x_forwarded_for: true +  trusted_proxies: +    - 192.168.21.1 +    - 192.168.24.1 + +# Text to speech +tts: +  - platform: google_translate + +telegram_bot: +  - platform: polling +    api_key: 5161737507:AAHAZZr_eh8ZOkhdg59XVIciGS2BkVBQU7M +    allowed_chat_ids: +      - -1001582338242 + +notify: +  - platform: telegram +    name: SmartPI +    chat_id: -1001582338242 + +#python_script: + +ffmpeg: +  ffmpeg_bin: /usr/bin/ffmpeg + +wake_on_lan: + +sensor: +  - platform: time_date +    display_options: +      - 'time' +      - 'date' +      - 'date_time' +      - 'date_time_utc' +      - 'date_time_iso' +      - 'time_date' +      - 'time_utc' +      - 'beat' + + +automation ui: !include automations.yaml +script ui: !include scripts.yaml +scene ui: !include scenes.yaml + + +group: !include custom/group.yaml +template: !include custom/template.yaml +input_number: !include custom/input_number.yaml +binary_sensor: !include custom/binary_sensor.yaml +script manual: !include_dir_merge_named custom/scripts/ +automation manual: !include_dir_merge_list custom/automation/ diff --git a/custom/binary_sensor.yaml b/custom/binary_sensor.yaml new file mode 100644 index 0000000..350a40f --- /dev/null +++ b/custom/binary_sensor.yaml @@ -0,0 +1 @@ +#binary_sensor: diff --git a/custom/group.yaml b/custom/group.yaml new file mode 100644 index 0000000..7815cce --- /dev/null +++ b/custom/group.yaml @@ -0,0 +1,10 @@ +  master_phones: +    name: "master_phones" +    entities: +      - device_tracker.legion8 +      - device_tracker.lm_g810 + +  master_laptops: +    name: "master_laptops" +    entities: +      - device_tracker.nyx diff --git a/custom/input_number.yaml b/custom/input_number.yaml new file mode 100644 index 0000000..0fd1307 --- /dev/null +++ b/custom/input_number.yaml @@ -0,0 +1,37 @@ +# Parameters for Bulbs +#- input_number: +    knob_office_current: +      min: 0.0 +      max: 10.0 +      step: 1.0 +      initial: 0.0 +    knob_office_brightness0: +      min: 0.0 +      max: 255.0 +      step: 25.0 +      initial: 255.0 +    knob_office_temperature0: +      min: 2000.0 +      max: 6500.0 +      step: 500.0 +      initial: 6500.0 +    knob_office_hue0: +      min: 0.0 +      max: 360.0 +      step: 20.0 +      initial: 0.0 +    knob_office_brightness1: +      min: 0.0 +      max: 255.0 +      step: 25.0 +      initial: 255.0 +    knob_office_temperature1: +      min: 2000.0 +      max: 6500.0 +      step: 500.0 +      initial: 6500.0 +    knob_office_hue1: +      min: 0.0 +      max: 360.0 +      step: 20.0 +      initial: 0.0 diff --git a/custom/scripts/sleep-and-wake.yaml b/custom/scripts/sleep-and-wake.yaml new file mode 100644 index 0000000..b737e8d --- /dev/null +++ b/custom/scripts/sleep-and-wake.yaml @@ -0,0 +1,129 @@ +sleep_and_wake: +  alias: "Sleep and Wake" +  description: "Sleep, Hibernate, and Wake actions for Office and Complete House" +  fields: +    mode: +      name: Mode +      description: "Operation mode: Sleep is non-intrusive action while Hibernate aimed on maximum power-savings and security" +      required: true +      selector: +        select: +          options: +            - hibernate +            - sleep +            - wake +    target: +      name: Target +      description: "Area: Office or complete House (more areas might be added in future)" +      required: true +      selector: +        select: +          options: +            - office +            - house + +  mode: single + +  sequence: +    - choose: +        - conditions: +            - condition: template +              value_template: '{{ target == "office" }}' +          sequence: +            - choose: +                - conditions: +                    - condition: template +                      value_template: '{{ mode == "sleep" }}' +                  sequence: +                    - parallel: +                        - service: switch.turn_off +                          target: +                            entity_id: switch.smart_power_strip_pro_socket_1 +                        - service: switch.turn_off +                          target: +                            entity_id: switch.living_lights_right + +                - conditions: +                    - condition: template +                      value_template: '{{ mode == "hibernate" }}' +                  sequence: +                    - parallel: +                        - service: media_player.media_stop +                          target: +                            entity_id: media_player.smartpi +# Wait until we fix both sleep and WOL on laptop +#                        - service: switch.turn_off +#                          target: +#                            entity_id: switch.plugs_office +                        - service: switch.turn_off +                          target: +                            entity_id: switch.smart_power_strip_pro_socket_1 +                        - service: switch.turn_off +                          target: +                            entity_id: switch.living_lights_right + +                - conditions: +                    - condition: template +                      value_template: '{{ mode == "wake" }}' +                  sequence: +                    - parallel: +                        - service: switch.turn_on +                          target: +                            entity_id: switch.plugs_office +                    - service: wake_on_lan.send_magic_packet +                      data: +                        mac: "e8:6a:64:7b:5d:0a" +                    - delay: +                        seconds: 2 +                    - service: wake_on_lan.send_magic_packet +                      data: +                        mac: "e8:6a:64:7b:5d:0a" + +        - conditions: +            - condition: template +              value_template: '{{ target == "house" }}' +          sequence: +            - choose: +                - conditions: +                    - condition: template +                      value_template: '{{ mode == "sleep" }}' +                  sequence: +                    - parallel: +# Wait until we fix both sleep and WOL on laptop +#                        - service: switch.turn_off +#                          target: +#                            entity_id: switch.plugs_office +                        - service: switch.turn_off +                          target: +                            entity_id: switch.smart_power_strip_pro_socket_1 +                        - service: switch.turn_off +                          target: +                            entity_id: switch.lights_all +                        # Thats a better way to allow some time for leaving +                        - service: switch.turn_on +                          target: +                            entity_id: switch.hall_lights_right + +                - conditions: +                    - condition: template +                      value_template: '{{ mode == "hibernate" }}' +                  sequence: +                    - service: switch.turn_off +                      target: +                        entity_id: +                          - switch.lights_all +                          - switch.plugs_manual +                          - switch.plugs_controlled +                    - service: switch.turn_on +                      target: +                        entity_id: switch.hall_lights_right + +                - conditions: +                    - condition: template +                      value_template: '{{ mode == "wake" }}' +                  sequence: +                    - service: switch.turn_on +                      target: +                        entity_id: +                          - switch.plugs_kitchen +                          - switch.bedroom_bedsidelampsocket diff --git a/custom/template.yaml b/custom/template.yaml new file mode 100644 index 0000000..710b936 --- /dev/null +++ b/custom/template.yaml @@ -0,0 +1,54 @@ +# Manual lights + +- trigger: +  - platform: state +    entity_id: "switch.bedroom_bedsidelampsocket" +  - platform: state +    entity_id: "sensor.bedroom_bedsidelampsocket_power" +  binary_sensor: +    - name: "Bedroom/BedsideLamp" +      device_class: light +      state: > +            {{ is_state("switch.bedroom_bedsidelampsocket", "on") and ((states("sensor.bedroom_bedsidelampsocket_power") | float) > 1)  }} + +- sensor: +  - name: "Power SmartPI" +    unit_of_measurement: "W" +    state: > +            {% set readings = [ states('sensor.living_office_power'), +                                states('sensor.office_shelftop_power') | float(0), states('sensor.office_shelfbottom_power') | float(0), +                                states('sensor.office_table_power') | float(0), states('sensor.office_aircon_power') | float(0) ] %} +            {{ 'unavailable' if readings[0] == 'unavailable' else readings[0] | float - readings[1] - readings[2] - readings[3] - readings[4] }} + +  - name: "Power Office" +    unit_of_measurement: "W" +    state: > +            {{  expand(states.switch.power_office) | selectattr('state') | map(attribute='entity_id')  +                | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") +                | selectattr('state','is_number') | map(attribute='state')  | map('float') | list | sum }} + +  - name: "Power Infrastructure" +    unit_of_measurement: "W" +    state: > +            {{  states('sensor.power_smartpi') | float +  expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id')  +                | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") +                | selectattr('state','is_number') | map(attribute='state')  | map('float') | list | sum }} +  - name: "Power Kitchen" +    unit_of_measurement: "W" +    state: > +            {{  expand(states.switch.power_kitchen) | selectattr('state') | map(attribute='entity_id')  +                | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") +                | selectattr('state','is_number') | map(attribute='state')  | map('float') | list | sum }} +  - name: "Power Climate" +    unit_of_measurement: "W" +    state: > +            {{  expand(states.switch.power_climate) | selectattr('state') | map(attribute='entity_id')  +                | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") +                | selectattr('state','is_number') | map(attribute='state')  | map('float') | list | sum }} +  - name: "Power Lights" +    unit_of_measurement: "W" +    state: > +            {{  expand(states.switch.power_lights) | selectattr('state') | map(attribute='entity_id')  +                | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") +                | selectattr('state','is_number') | map(attribute='state')  | map('float') | list | sum }} + diff --git a/python_scripts/set_state.py b/python_scripts/set_state.py new file mode 100644 index 0000000..fae5c7c --- /dev/null +++ b/python_scripts/set_state.py @@ -0,0 +1,27 @@ +#================================================================================================== +#  python_scripts/set_state.py  +#================================================================================================== + +#-------------------------------------------------------------------------------------------------- +# Set the state or other attributes for the entity specified in the Automation Action +#-------------------------------------------------------------------------------------------------- + +inputEntity = data.get('entity_id') +if inputEntity is None: +    logger.warning("===== entity_id is required if you want to set something.") +else: +    inputStateObject = hass.states.get(inputEntity) +    inputState = inputStateObject.state +    inputAttributesObject = inputStateObject.attributes.copy() + +    for item in data: +        newAttribute = data.get(item) +        logger.debug("===== item = {0}; value = {1}".format(item,newAttribute)) +        if item == 'entity_id': +            continue            # already handled +        elif item == 'state': +            inputState = newAttribute +        else: +            inputAttributesObject[item] = newAttribute + +    hass.states.set(inputEntity, inputState, inputAttributesObject) diff --git a/scenes.yaml b/scenes.yaml new file mode 100644 index 0000000..9c03dd5 --- /dev/null +++ b/scenes.yaml @@ -0,0 +1,9 @@ +- id: '1672945588841' +  name: Test +  entities: +    scene.hyundai_aircon_cool_18: +      friendly_name: Hyundai AirCon Cool 18 +      state: '2023-01-05T19:02:44.819188+00:00' +  metadata: +    scene.hyundai_aircon_cool_18: +      entity_only: false diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 0000000..59b3898 --- /dev/null +++ b/scripts.yaml @@ -0,0 +1,97 @@ +turn_off_all_lights: +  alias: turn_off_all_lights +  use_blueprint: +    path: lights/turn_off_lights.yaml +  mode: single +'1672632854824': +  alias: Send Photo +  use_blueprint: +    path: camera/send_photo.yaml +    input: +      host: http://127.0.0.1:8123 +'1672637427937': +  alias: Security Camera +  use_blueprint: +    path: camera/security_camera.yaml +    input: +      lights_on: +      - switch.entrance_lights_center +      lights_off: +      - switch.hall_lights_left +      fast_shots: 10 +      motion_sensor: binary_sensor.hall_motions_occupancy +turn_off_bedroom_lights: +  alias: turn_off_bedroom_lights +  use_blueprint: +    path: lights/turn_off_lights.yaml +    input: +      lights: bedroom +  mode: single +bedroom_aircon: +  alias: Bedroom AirCon +  use_blueprint: +    path: devices/aircon.yaml +    input: +      power: switch.bedroom_aircon +      temperature: sensor.bedroom_temp_temperature +      cool_scene: scene.hyundai_aircon_cool_18 +      heat_scene: scene.hyundai_aircon_warm_28 +      off_scene: scene.hyundai_aircon_off +      confirm: +      - service: input_button.press +        data: {} +        target: +          entity_id: input_button.button_confirm +  mode: single +'1672883652038': +  sequence: +  - service: media_player.volume_set +    data: +      volume_level: 1 +    target: +      entity_id: media_player.smartpi +  - service: media_player.play_media +    target: +      entity_id: media_player.smartpi +    data: +      media_content_id: media-source://dlna_dms/asgard/:64$0$5$1$0$0 +      media_content_type: audio/mpeg +    metadata: +      title: Wish I Had An Angel +      thumbnail: +      media_class: music +      children_media_class: +      navigateIds: +      - {} +      - media_content_type: app +        media_content_id: media-source://dlna_dms +      - media_content_type: channel +        media_content_id: media-source://dlna_dms/asgard/:0 +      - media_content_type: object.container.storageFolder +        media_content_id: media-source://dlna_dms/asgard/:64 +      - media_content_type: object.container.storageFolder +        media_content_id: media-source://dlna_dms/asgard/:64$0 +      - media_content_type: object.container.storageFolder +        media_content_id: media-source://dlna_dms/asgard/:64$0$5 +      - media_content_type: object.container.storageFolder +        media_content_id: media-source://dlna_dms/asgard/:64$0$5$1 +      - media_content_type: object.container.storageFolder +        media_content_id: media-source://dlna_dms/asgard/:64$0$5$1$0 +  mode: restart +  alias: Kodi - Play Angel Alarm +silence: +  alias: Silence +  sequence: +  - service: media_player.media_stop +    data: {} +    target: +      entity_id: media_player.smartpi +  mode: single +kodi_sleep: +  alias: 'Kodi: Sleep' +  sequence: +  - service: media_player.media_stop +    data: {} +    target: +      entity_id: media_player.smartpi +  mode: single diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml new file mode 100644 index 0000000..f58afbc --- /dev/null +++ b/ui-lovelace.yaml @@ -0,0 +1,9 @@ +views: +  - title: Overview (redirect) +    cards: +      - type: entities +        title: Redirect +        entities: +          - url: /lovelace-status/0 +            type: weblink +  | 
