Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Doc: https://www.home-assistant.io/integrations/version/
- # Qui ho usato platform version per farmi restituire la versione attuale di HA e la versione ultima disponibile.
- # Il sensore ha_latest si basa sull'ultima versione disponibile su pypi (mi serve per la mia istanza di HA CORE),
- # ma è possibile cambiare il source in base alle proprie esigenze (https://www.home-assistant.io/integrations/version/#source)
- sensor:
- - platform: version
- name: ha_latest
- source: pypi
- image: raspberrypi
- - platform: version
- name: ha_current
- source: local
- image: raspberrypi
- binary_sensor:
- # Sensore binario che segnala se la versione attuale è diversa dalla più recente
- - platform: template
- sensors:
- ha_new_version:
- friendly_name: "HA Version"
- value_template: "{{ states('sensor.ha_current') < states('sensor.ha_latest') }}"
- attribute_templates:
- current_version: "{{ states('sensor.ha_current') }}"
- latest_version: "{{ states('sensor.ha_latest') }}"
- # Automazione basata sul binary sensor creato. Se passa ad on il binary vuol dire che c'è una nuova versione
- # e viene inviata la notifica
- automation:
- - alias: New HA Version available
- initial_state: true
- trigger:
- - platform: state
- entity_id: binary_sensor.ha_new_version
- to: 'on'
- - event: start
- platform: homeassistant
- condition:
- - condition: state
- entity_id: binary_sensor.ha_new_version
- state: 'on'
- action:
- - service: persistent_notification.create
- data:
- title: "New Version available!"
- message: "Version {{ states('sensor.ha_latest') }} is available to download"
Add Comment
Please, Sign In to add comment