From 0d743ff04ce6c324aabad229bf780facf2395f55 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Tue, 27 Oct 2026 11:23:46 +0100 Subject: [PATCH] Added shelly lora integration for garage --- .storage/lovelace.lovelace | 24 +++++ .storage/lovelace.lovelace_devices | 126 ++++++++++++++++++++++++ README.md | 2 +- automations/lights.yaml | 50 ++++++++++ components/google_assistant/lights.yaml | 4 + configuration.yaml | 2 +- 6 files changed, 206 insertions(+), 2 deletions(-) diff --git a/.storage/lovelace.lovelace b/.storage/lovelace.lovelace index de559ee3..8210c506 100644 --- a/.storage/lovelace.lovelace +++ b/.storage/lovelace.lovelace @@ -983,6 +983,30 @@ ] } ] + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Garage", + "heading_style": "title", + "icon": "mdi:garage" + }, + { + "features": [ + { + "type": "toggle" + } + ], + "entity": "light.garage_lora_luce_garage", + "name": "Luce Garage", + "type": "tile", + "features_position": "bottom", + "vertical": false, + "hide_state": true + } + ] } ], "max_columns": 3 diff --git a/.storage/lovelace.lovelace_devices b/.storage/lovelace.lovelace_devices index 06b6cd00..5868fc6d 100644 --- a/.storage/lovelace.lovelace_devices +++ b/.storage/lovelace.lovelace_devices @@ -1781,6 +1781,132 @@ ] } ] + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Garage LoRa", + "heading_style": "title", + "icon": "mdi:garage" + }, + { + "type": "vertical-stack", + "cards": [ + { + "type": "custom:mushroom-template-card", + "primary": "Garage LoRa", + "secondary": "{% set online = states('binary_sensor.garage_lora_garage_online') %}\n{% set porta = states('binary_sensor.garage_lora_serranda_garage') %}\n{% set luce = states('light.garage_lora_luce_garage') %}\n\n{% if online != 'on' %}\n Dispositivo Offline\n{% else %}\n Online •\n {% if porta == 'on' %}\n Serranda Aperta •\n {% elif porta == 'off' %}\n Serranda Chiusa •\n {% else %}\n Serranda Sconosciuta •\n {% endif %}\n {% if luce == 'on' %}\n Luce Accesa\n {% elif luce == 'off' %}\n Luce Spenta\n {% else %}\n Luce Sconosciuta\n {% endif %}\n{% endif %}\n", + "icon": "mdi:home-import-outline", + "icon_color": "{% if is_state('binary_sensor.garage_lora_garage_online','on') %}\n green\n{% else %}\n red\n{% endif %}\n" + }, + { + "type": "grid", + "columns": 2, + "square": false, + "cards": [ + { + "type": "tile", + "entity": "binary_sensor.garage_lora_garage_online", + "name": "Garage Online" + }, + { + "type": "tile", + "entity": "sensor.garage_lora_garage_last_seen", + "name": "Ultimo update" + }, + { + "type": "custom:mushroom-template-card", + "primary": "Stato Serranda", + "secondary": "{% if is_state('binary_sensor.garage_lora_serranda_garage', 'on') %}\n Serranda Aperta\n{% elif is_state('binary_sensor.garage_lora_serranda_garage', 'off') %}\n Serranda Chiusa\n{% else %}\n Stato non disponibile\n{% endif %}\n", + "icon": "{% if is_state('binary_sensor.garage_lora_serranda_garage', 'on') %}\n mdi:garage-open\n{% elif is_state('binary_sensor.garage_lora_serranda_garage', 'off') %}\n mdi:garage\n{% else %}\n mdi:garage-alert\n{% endif %}\n", + "icon_color": "{% if is_state('binary_sensor.garage_lora_serranda_garage', 'on') %}\n orange\n{% elif is_state('binary_sensor.garage_lora_serranda_garage', 'off') %}\n green\n{% else %}\n red\n{% endif %}\n", + "tap_action": { + "action": "none" + } + }, + { + "type": "tile", + "entity": "sensor.garage_lora_batteria_sensore_porta", + "name": "Batteria Sensore" + }, + { + "type": "tile", + "entity": "light.garage_lora_luce_garage", + "name": "Luce Garage", + "tap_action": { + "action": "toggle" + }, + "features_position": "bottom" + }, + { + "type": "tile", + "entity": "button.garage_lora_pulsante_serranda_garage", + "name": "Serranda Garage", + "icon": "mdi:garage", + "tap_action": { + "action": "call-service", + "service": "button.press", + "target": { + "entity_id": "button.garage_lora_pulsante_serranda_garage" + } + }, + "features_position": "bottom" + } + ] + }, + { + "type": "custom:mushroom-template-card", + "primary": "Manutenzione", + "icon": "mdi:cog", + "tap_action": { + "action": "none" + } + }, + { + "type": "horizontal-stack", + "cards": [ + { + "type": "custom:mushroom-template-card", + "primary": "Riavvia Bridge", + "icon": "mdi:restart", + "tap_action": { + "action": "call-service", + "service": "button.press", + "target": { + "entity_id": "button.garage_lora_riavvia_bridge_lora" + } + } + }, + { + "type": "custom:mushroom-template-card", + "primary": "Riavvia Garage", + "icon": "mdi:restart", + "tap_action": { + "action": "call-service", + "service": "button.press", + "target": { + "entity_id": "button.garage_lora_riavvia_garage" + } + } + } + ] + }, + { + "type": "custom:mushroom-template-card", + "primary": "Shelly EM", + "secondary": "Apri interfaccia web", + "icon": "mdi:web", + "icon_color": "blue", + "tap_action": { + "action": "url", + "url_path": "https://shellyem.giorgioravera.it" + } + } + ] + } + ] } ], "max_columns": 3, diff --git a/README.md b/README.md index 64df82f4..321dead0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ My server is an Intel NUC (NUC10i5FNH) with [Proxmox Virtual Environment](https: * Mitsubishi Air Conditioning (MSZ-LN25VG2V, MSZ-LN35VG2V) * Proxmox * QNAP NAS (TS-228A) -* Shelly (ShellyEM Gen4) +* Shelly (ShellyEM Gen4 & Shelly 2PM Gen4) * Sony Android TV (KD-55XF8596) * Xiaomi (MiJia door & window contact sensor, MiJia temperature & humidity sensor) diff --git a/automations/lights.yaml b/automations/lights.yaml index 550c5292..02b2ad73 100644 --- a/automations/lights.yaml +++ b/automations/lights.yaml @@ -47,3 +47,53 @@ # entity_id: light.luce_trono mode: restart + +###################################################################### +# Bathroom Light: Switch on Lights +# +# Actions: +# - light.turn_on +###################################################################### +- alias: "Accendi luce studio se occupato e casa non vuota" + id: "accendi_luci_presenza_studio" + + description: > + If someone is at home, the office is occupied, + the sun is low, and it is between 3:00 p.m. and 5:00 a.m., + turn on the light in the large bathroom and turn it off after a while. + + triggers: + - trigger: state + entity_id: binary_sensor.sensore_presenza_studio_occupancy + to: "on" + + conditions: + - condition: state + entity_id: group.residents + state: "home" + - condition: state + entity_id: light.luce_studio + state: "off" + - condition: numeric_state + entity_id: sun.sun + attribute: elevation + below: 1 + + actions: + - service: light.turn_on + target: + entity_id: light.luce_studio + + # Wait 10 minutes before checking if the light should be turned off + - delay: "00:10:00" + + # Turn off only if there is no more presence in the bathroom + - condition: state + entity_id: binary_sensor.sensore_presenza_studio_occupancy + state: "off" + + - service: light.turn_off + target: + entity_id: light.luce_studio + + mode: restart diff --git a/components/google_assistant/lights.yaml b/components/google_assistant/lights.yaml index afdb14ee..319f28c0 100644 --- a/components/google_assistant/lights.yaml +++ b/components/google_assistant/lights.yaml @@ -44,3 +44,7 @@ light.luce_camera: light.luce_balcone: expose: true room: Balcone +light.garage_lora_luce_garage: + name: Luce Garage + expose: true + room: Garage diff --git a/configuration.yaml b/configuration.yaml index 657e4f80..3db97bed 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -53,7 +53,7 @@ usage_prediction: # Enables the frontend frontend: - themes: !include_dir_merge_named themes + themes: !include_dir_merge_named themes/ # File integration to read from and write to text files in support of system sensors, scripts, and automations. # file: -- 2.47.3