From 0cea82254696fd685a61c3fcc946f5874f4b336d Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Sun, 15 Aug 2021 20:59:29 +0200 Subject: [PATCH] Replaced REST sensor for shelly firmware update with native integration sensor --- .storage/lovelace.lovelace_dispositivi | 69 +++-- automations/update_notifications.yaml | 2 +- packages/shelly/shelly_groups.yaml | 27 +- packages/shelly/shelly_sensor.yaml | 382 ------------------------- 4 files changed, 66 insertions(+), 414 deletions(-) delete mode 100644 packages/shelly/shelly_sensor.yaml diff --git a/.storage/lovelace.lovelace_dispositivi b/.storage/lovelace.lovelace_dispositivi index c64032eb..4ef301df 100644 --- a/.storage/lovelace.lovelace_dispositivi +++ b/.storage/lovelace.lovelace_dispositivi @@ -264,7 +264,6 @@ }, { "title": "Shelly", - "type": "sidebar", "layout": { "grid-template-columns": "auto auto auto", "grid-template-rows": "auto", @@ -328,46 +327,82 @@ "type": "entities", "entities": [ { - "entity": "sensor.shelly1" + "entity": "binary_sensor.tapparella_sala_overheating" }, { - "entity": "sensor.shelly2" + "entity": "binary_sensor.luce_sala_overheating" }, { - "entity": "sensor.shelly3" + "entity": "binary_sensor.luci_bagno_overheating" }, { - "entity": "sensor.shelly4" + "entity": "binary_sensor.luce_camera_overheating" + } + ], + "title": "Surriscaldamento" + }, + { + "type": "entities", + "entities": [ + { + "entity": "binary_sensor.tapparella_cucina_firmware_update" }, { - "entity": "sensor.shelly5" + "entity": "binary_sensor.tapparella_sala_firmware_update" }, { - "entity": "sensor.shelly6" + "entity": "binary_sensor.tapparella_studio_firmware_update" }, { - "entity": "sensor.shelly7" + "entity": "binary_sensor.tapparella_camera_firmware_update" }, { - "entity": "sensor.shelly8" + "entity": "binary_sensor.luce_corridoio_firmware_update" }, { - "entity": "sensor.shelly9" + "entity": "binary_sensor.luce_cucina_firmware_update" }, { - "entity": "sensor.shelly10" + "entity": "binary_sensor.luce_sala_firmware_update" }, { - "entity": "sensor.shelly11" + "entity": "binary_sensor.luci_bagno_firmware_update" }, { - "entity": "sensor.shellyem" + "entity": "binary_sensor.luce_studio_firmware_update" + }, + { + "entity": "binary_sensor.luce_camera_firmware_update" + }, + { + "entity": "binary_sensor.luce_balcone_firmware_update" + }, + { + "entity": "binary_sensor.shelly_em_firmware_update" } ], - "title": "Aggiornamenti Disponibili", - "view_layout": { - "position": "sidebar" - } + "title": "Disponibilit\u00e0 Aggiornamenti" + }, + { + "type": "entities", + "entities": [ + { + "entity": "binary_sensor.luce_sala_overpowering" + }, + { + "entity": "binary_sensor.luce_bagno_overpowering" + }, + { + "entity": "binary_sensor.luce_specchio_overpowering" + }, + { + "entity": "binary_sensor.luce_camera_overpowering" + }, + { + "entity": "binary_sensor.shelly_em_overpowering" + } + ], + "title": "Sovraccarico" } ] } diff --git a/automations/update_notifications.yaml b/automations/update_notifications.yaml index fcb5e5f2..f261cb4e 100644 --- a/automations/update_notifications.yaml +++ b/automations/update_notifications.yaml @@ -57,7 +57,7 @@ "Sono disponibili aggiornamenti per i dispositivi Shelly:" {% for entity_id in states.group.shelly.attributes.entity_id %} {% if is_state(entity_id, 'on') %} - -> {{ state_attr(entity_id, 'friendly_name') }}: {{ state_attr(entity_id, 'update').new_version }} + -> {{ state_attr(entity_id, 'friendly_name')|replace(" - Aggiornamento Firmware", "") }}: {{ state_attr(entity_id, 'latest_stable_version') }} {% endif %} {%- endfor %} notification_id: "update" diff --git a/packages/shelly/shelly_groups.yaml b/packages/shelly/shelly_groups.yaml index 21580db7..c0508f7c 100644 --- a/packages/shelly/shelly_groups.yaml +++ b/packages/shelly/shelly_groups.yaml @@ -7,17 +7,16 @@ group: name: Shelly Devices icon: mdi:alpha-s-box entities: - - sensor.shelly1 - - sensor.shelly2 - - sensor.shelly3 - - sensor.shelly4 - - sensor.shelly5 - - sensor.shelly6 - - sensor.shelly7 - - sensor.shelly8 - - sensor.shelly9 - - sensor.shelly10 - - sensor.shelly11 - #- sensor.shellybulb - - sensor.shellyem - #- sensor.shellyplugs + - binary_sensor.tapparella_cucina_firmware_update + - binary_sensor.tapparella_sala_firmware_update + - binary_sensor.tapparella_studio_firmware_update + - binary_sensor.tapparella_camera_firmware_update + - binary_sensor.luce_corridoio_firmware_update + - binary_sensor.luce_cucina_firmware_update + - binary_sensor.luce_sala_firmware_update + - binary_sensor.luci_bagno_firmware_update + - binary_sensor.luce_studio_firmware_update + - binary_sensor.luce_camera_firmware_update + - binary_sensor.luce_balcone_firmware_update + #- binary_sensor.luce_divano_firmware_update + - binary_sensor.shelly_em_firmware_update diff --git a/packages/shelly/shelly_sensor.yaml b/packages/shelly/shelly_sensor.yaml deleted file mode 100644 index 7e415cc8..00000000 --- a/packages/shelly/shelly_sensor.yaml +++ /dev/null @@ -1,382 +0,0 @@ -###################################################################### -# Shelly Package - Sensor -###################################################################### - -sensor: - ###################################################################### - # Sensor: Shelly 1 - ###################################################################### - - platform: rest - scan_interval: 43200 - resource: http://shelly1.giorgioravera.it/status - method: GET - name: shelly1 - #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 - #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 - #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 - #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 - #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 - #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 - #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 - #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 - #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 10 - ###################################################################### - - platform: rest - scan_interval: 43200 - resource: http://shelly10.giorgioravera.it/status - method: GET - name: shelly10 - #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 11 - ###################################################################### - - platform: rest - scan_interval: 43200 - resource: http://shelly11.giorgioravera.it/status - method: GET - name: shelly11 - #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 - # #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 - #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 - # #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 -- 2.47.3