--- /dev/null
+######################################################################
+# Shelly: Update Available Notifications
+######################################################################
+
+- alias: "Shelly: Notifica aggiornamento"
+ initial_state: 'on'
+
+ trigger:
+ - platform: state
+ entity_id: group.shelly
+ to: 'on'
+
+ action:
+ service: script.notify_text
+ data_template:
+ title: "Shelly - Aggiornamento"
+ message: "Sono disponibili aggiornamenti per i dispositivi Shelly"
+ enable_persistant: true
+
script.shelly_upgrade:
icon: mdi:cellphone-arrow-down
+script.shelly_reboot:
+ icon: mdi:restart
--- /dev/null
+######################################################################
+# Group Shelly Devices
+######################################################################
+
+shelly:
+ name: Shelly Devices
+ view: true
+ #icon: mdi:thermometer
+ entities:
+ - sensor.shelly1_status
+ - sensor.shelly2_status
+ - sensor.shelly3_status
+ - sensor.shelly4_status
+ - sensor.shelly5_status
+ - sensor.shelly6_status
+ - sensor.shelly7_status
+ - sensor.shelly8_status
+ - sensor.shelly9_status
+ - sensor.shellybulb_status
+ - sensor.shellyem_status
+ - sensor.shellyplugs_status
- binary_sensor.ff590mr_park_brake_status
- binary_sensor.ff590mr_tire_warning
- binary_sensor.ff590mr_trunk
+ - binary_sensor.ff590mr_fuel_lid
#- binary_sensor.ff590mr_warning_brakefluid
#- binary_sensor.ff590mr_warning_coolantlevellow
#- binary_sensor.ff590mr_warning_washwater
- sensor.ff590mr_tire_pressure_rear_left
- sensor.ff590mr_tire_pressure_rear_right
- sensor.ff590mr_trunk
+ # Shelly
+ - sensor.shelly1_status
+ - sensor.shelly2_status
+ - sensor.shelly3_status
+ - sensor.shelly4_status
+ - sensor.shelly5_status
+ - sensor.shelly6_status
+ - sensor.shelly7_status
+ - sensor.shelly8_status
+ - sensor.shelly9_status
+ - sensor.shellybulb_status
+ - sensor.shellyem_status
+ - sensor.shellyplugs_status
# Energy Sensors
- sensor.potenza_reattiva
- sensor.tensione
# Living Room Light (White)
######################################################################
-- platform: mqtt
- name: Luce Divano Bianca
- schema: template
- command_topic: "shellies/shellybulb-BC8610/color/0/set"
- state_topic: "shellies/shellybulb-BC8610/color/0/status"
- command_on_template: >
- {
- "turn": "on",
- "mode": "white",
- {%- if color_temp is defined -%}
- "temp": {{ (1000000/(((float(color_temp)-153)/354*180)+153)-35) | int }},
- {%- endif -%}
- {%- if brightness is defined -%}
- "brightness": {{ (brightness/255*100) | int }},
- {%- endif -%}
- "effect": 0
- }
- command_off_template: >
- {
- "turn": "off",
- "mode": "white",
- "effect": 0
- }
- state_template: >
- {% if value_json.ison == true and value_json.mode == "white" %}
- on
- {% else %}
- off
- {% endif %}
- brightness_template: '{{ (value_json.brightness/100*255)|int }}'
- color_temp_template: "{{ (1000000/(((float(value_json.temp)-3000)/3500*4500)+2000)) | int }}"
- retain: false
- qos: 0
- optimistic: false
+#- platform: mqtt
+# name: Luce Divano Bianca
+# schema: template
+# command_topic: "shellies/shellybulb-BC8610/color/0/set"
+# state_topic: "shellies/shellybulb-BC8610/color/0/status"
+# command_on_template: >
+# {
+# "turn": "on",
+# "mode": "white",
+# {%- if color_temp is defined -%}
+# "temp": {{ (1000000/(((float(color_temp)-153)/354*180)+153)-35) | int }},
+# {%- endif -%}
+# {%- if brightness is defined -%}
+# "brightness": {{ (brightness/255*100) | int }},
+# {%- endif -%}
+# "effect": 0
+# }
+# command_off_template: >
+# {
+# "turn": "off",
+# "mode": "white",
+# "effect": 0
+# }
+# state_template: >
+# {% if value_json.ison == true and value_json.mode == "white" %}
+# on
+# {% else %}
+# off
+# {% endif %}
+# brightness_template: '{{ (value_json.brightness/100*255)|int }}'
+# color_temp_template: "{{ (1000000/(((float(value_json.temp)-3000)/3500*4500)+2000)) | int }}"
+# retain: false
+# qos: 0
+# optimistic: false
######################################################################
# Living Room Global
- binary_sensor.ff590mr_park_brake_status
- binary_sensor.ff590mr_tire_warning
- binary_sensor.ff590mr_trunk
+ - binary_sensor.ff590mr_fuel_lid
#- binary_sensor.ff590mr_warning_brakefluid
#- binary_sensor.ff590mr_warning_coolantlevellow
#- binary_sensor.ff590mr_warning_washwater
- sensor.ff590mr_tire_pressure_rear_left
- sensor.ff590mr_tire_pressure_rear_right
- sensor.ff590mr_trunk
+ # Shelly
+ - sensor.shelly1_status
+ - sensor.shelly2_status
+ - sensor.shelly3_status
+ - sensor.shelly4_status
+ - sensor.shelly5_status
+ - sensor.shelly6_status
+ - sensor.shelly7_status
+ - sensor.shelly8_status
+ - sensor.shelly9_status
+ - sensor.shellybulb_status
+ - sensor.shellyem_status
+ - sensor.shellyplugs_status
# Energy Sensors
- sensor.potenza_reattiva
- sensor.tensione
- binary_sensor.ff590mr_park_brake_status
- binary_sensor.ff590mr_tire_warning
- binary_sensor.ff590mr_trunk
+ - binary_sensor.ff590mr_fuel_lid
#- binary_sensor.ff590mr_warning_brakefluid
#- binary_sensor.ff590mr_warning_coolantlevellow
#- binary_sensor.ff590mr_warning_washwater
- sensor.ff590mr_tire_pressure_rear_left
- sensor.ff590mr_tire_pressure_rear_right
- sensor.ff590mr_trunk
+ # Shelly
+ - sensor.shelly1_status
+ - sensor.shelly2_status
+ - sensor.shelly3_status
+ - sensor.shelly4_status
+ - sensor.shelly5_status
+ - sensor.shelly6_status
+ - sensor.shelly7_status
+ - sensor.shelly8_status
+ - sensor.shelly9_status
+ - sensor.shellybulb_status
+ - sensor.shellyem_status
+ - sensor.shellyplugs_status
# Energy Sensors
- sensor.potenza_reattiva
- sensor.tensione
data:
topic: 'shellies/shellyplug-s-7A31CB/command'
payload: 'update_fw'
+
+######################################################################
+# Shelly: Reboot
+# - shell_command.shelly_reboot
+######################################################################
+shelly_reboot:
+ alias: "Shelly: Riavvia Dispositivi"
+ sequence:
+ - service: shell_command.shelly_reboot
--- /dev/null
+######################################################################
+# Sensor: Shelly 1
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly1.giorgioravera.it/status
+ method: GET
+ name: shelly1_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 2
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly2.giorgioravera.it/status
+ method: GET
+ name: shelly2_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 3
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly3.giorgioravera.it/status
+ method: GET
+ name: shelly3_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 4
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly4.giorgioravera.it/status
+ method: GET
+ name: shelly4_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 5
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly5.giorgioravera.it/status
+ method: GET
+ name: shelly5_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 6
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly6.giorgioravera.it/status
+ method: GET
+ name: shelly6_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 7
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly7.giorgioravera.it/status
+ method: GET
+ name: shelly7_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 8
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly8.giorgioravera.it/status
+ method: GET
+ name: shelly8_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly 9
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shelly9.giorgioravera.it/status
+ method: GET
+ name: shelly9_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly Bulb
+######################################################################
+
+#- platform: rest
+# scan_interval: 43200
+# resource: http://shellybulb.giorgioravera.it/status
+# method: GET
+# name: shellybulb_status
+# #value_template: '{{ value_json.has_update }}'
+# value_template: >-
+# {% if value_json.has_update == True %}
+# on
+# {% else %}
+# off
+# {% endif %}
+# authentication: basic
+# username: !secret shelly_user
+# password: !secret shelly_password
+# json_attributes:
+# # - wifi_sta
+# # - mqtt
+# # - time
+# # - has_update
+# - mac
+# - update
+# - uptime
+
+######################################################################
+# Sensor: Shelly EM
+######################################################################
+
+- platform: rest
+ scan_interval: 43200
+ resource: http://shellyem.giorgioravera.it/status
+ method: GET
+ name: shellyem_status
+ #value_template: '{{ value_json.has_update }}'
+ value_template: >-
+ {% if value_json.has_update == True %}
+ on
+ {% else %}
+ off
+ {% endif %}
+ authentication: basic
+ username: !secret shelly_user
+ password: !secret shelly_password
+ json_attributes:
+ # - wifi_sta
+ # - mqtt
+ # - time
+ # - has_update
+ - mac
+ - update
+ - uptime
+
+######################################################################
+# Sensor: Shelly Plug S
+######################################################################
+
+#- platform: rest
+# scan_interval: 43200
+# resource: http://shellyplugs.giorgioravera.it/status
+# method: GET
+# name: shellyplugs_status
+# #value_template: '{{ value_json.has_update }}'
+# value_template: >-
+# {% if value_json.has_update == True %}
+# on
+# {% else %}
+# off
+# {% endif %}
+# authentication: basic
+# username: !secret shelly_user
+# password: !secret shelly_password
+# json_attributes:
+# # - wifi_sta
+# # - mqtt
+# # - time
+# # - has_update
+# - mac
+# - update
+# - uptime
shelly_upgrade: 'bash /var/lib/homeassistant/.homeassistant/shell_scripts/shelly_upgrade.sh'
+shelly_reboot: 'bash /var/lib/homeassistant/.homeassistant/shell_scripts/shelly_reboot.sh'
--- /dev/null
+#!/bin/bash
+
+HASS_HOME="/var/lib/homeassistant/.homeassistant"
+USER=$(awk '/shelly_user/ { print $2 }' $HASS_HOME/secrets.yaml)
+PASSWORD=$(awk '/shelly_password/ { print $2 }' $HASS_HOME/secrets.yaml)
+SHELLY_ID=(
+ shelly1.giorgioravera.it
+ shelly2.giorgioravera.it
+ shelly3.giorgioravera.it
+ shelly4.giorgioravera.it
+ shelly5.giorgioravera.it
+ shelly6.giorgioravera.it
+ shelly7.giorgioravera.it
+ shelly8.giorgioravera.it
+ shelly9.giorgioravera.it
+ shellybulb.giorgioravera.it
+ shellyem.giorgioravera.it
+ shellyplugs.giorgioravera.it
+)
+
+echo "Reboot Shelly Devices"
+
+for i in "${SHELLY_ID[@]}"
+do
+ ALIVE=$(ping -c 1 $i |grep ttl)
+ if [ ! -z "$ALIVE" ]; then
+ STATUS=$(curl -s --user $USER:$PASSWORD http://$i/reboot | sed -e "s/{"ok"}://g")
+ echo $STATUS
+ fi
+done
+
+echo "Done"
#entity: group.lights_livingroom
entities:
- light.luce_divano
- - light.luce_divano_bianca
+ #- light.luce_divano_bianca
- cover.tapparella_sala
- climate.sala_termostato_sala
- media_player.tv_sala
- light.luce_corridoio
- light.luci_sala
- light.luce_divano
- - light.luce_divano_bianca
+ #- light.luce_divano_bianca
- light.luci_bagno
- light.luce_bagno
- light.luce_specchio
name: Luce Divano
entity: light.luce_divano
- - type: light
- name: Luce Divano Bianca
- entity: light.luce_divano_bianca
+# - type: light
+# name: Luce Divano Bianca
+# entity: light.luce_divano_bianca
- type: light
name: Luci Bagno
# entity_id: script.homeassistant_upgrade
- type: horizontal-stack
- cards:
+ cards:
- type: entities
title: Operazione sui Dispositivi
show_header_toggle: false
entities:
- script.shelly_upgrade
-# - type: entity-button
-# entity: script.shelly_upgrade
-# tap_action:
-# action: call-service
-# service: script.turn_on
-# service_data:
-# entity_id: script.shelly_upgrade
+ - script.shelly_reboot
- type: vertical-stack
cards: