Is there a way to make an automation which notifies when the deConz firmware as a new update?
Or maybe incorporate this functionality into the addon, so an notification group can be added in the addon config?
- alias: 'Zigbee Conbee1 new firmaware notification'
trigger:
- platform: template
value_template: >-
{% set version = state_attr('sensor.zigbee_conbee1', 'latest_release_tag') %}
{% if "beta" not in version %}
true
{% endif %}
action:
- wait_template: >-
{% if "11:00" < now().strftime("%H:%M") < "21:00" %}
true
{% endif %}
- service: notify.me
data:
title: HA - Information
message: New firmare for Zigbee Conbee {{state_attr('sensor.zigbee_conbee1', 'latest_release_tag')}} is available
Is there an advanced version which directly puts the information “update available” in a sensor which can also be used in a lovelace card?
How to get the current firmware? If I read it correct existing yaml “just” tells “Well there is an update” but there´s no check related to the existing firmware on the hardware, so I could use this yaml without any deCONZ device. It might be “okay” but is only “half the way gone”, right?
I think I could achieve #1 and provide an updated yaml if someone points me in the right direction for #2 - how to get current used firmware version.
This was the poor man’s solution, does not actually monitor the installed firmware vs. latest release, but the latest Github version number.
For uptdate sensor try:
sensor: # or binary_sensor {{ version }} or {{ true }}
- platform: template
sensors:
conbee1_fw_updater:
value_template: >-
{% set version = state_attr('sensor.zigbee_conbee1', 'latest_release_tag') %}
{% if "beta" not in version %}
{{ version }}
{% endif %}
I know I can see the current version in the Addon Phoscon web app. But I want to have it as sensor so I can use it in my Lovelace UI (updates dashboard) like I do with all important updates:
…as well as in an automation for notification (grouped with other device firmware triggers, removed in the following code snippet):
alias: Notify_Devices_Firmware-Update(s)
description: ''
trigger:
- platform: state
entity_id: sensor.zigbee_firmware_latest
from: 'false'
to: 'true'
condition: []
action:
- service: notify.me
data:
title: "Firmware-Updates available "
message: >-
â„ą Info: Firmware-Update(s) available. See lovelace update
section or settings for details.
data:
subtitle: Devices
push:
thread-id: devices-notification-group
mode: single
So current status with this is:
No idea if it actually works, cause sensor value only changes (and automation triggers) when there´s a new latest version release which is not beta
It does not (yet) provide a separate sensor or attribute for the current firmware installed
It does not (yet) provide an automation which only triggers if latest_version (information available) is newer than installed_version (cause we don´t know what installed_version is, see #2)
If anyone with better HA/yaml skills can figure out how to…
get #2 working and
in addition how to go through the github release information and explicitly use the latest non-beta version instead of only looking at the latest version
…I´m quite confident the remaining part should be quite easy to finally make a “rich man” version
Is there a way to pick up the firmware version from the integration and make a template sensor for this?
-If so, monitoring Github and compare to the installed integration would then be possible.
I don’t use the deconz integration so I have limited exploration capabilities here unfortunately. Also sadly the fact that it is shown in that UI doesn’t mean there’s any way to get to it in a template. To my knowledge there is no way to get to a list of devices or information on a particular device in a template. HA code has access to it but it isn’t made available to templates. I would absolutely love to be corrected on this but have not found or seen a way to do it.
However I poked around in the deconz integration code a bit and it doesn’t look like the firmware version is actually stored in the config entry. Looks like the integration makes the config entry here and this is all it appears to store for a bridge:
Should be easy enough to confirm this if one of you pokes around in .storage to find the entry created for your bridge. Think it should either be under core.config_entries or core.device_registry. I can’t test this myself since I don’t use the deconz integration. It makes sense that HA wouldn’t store this information though since HA wants to show up to date information and the firmware is updated outside of HA.
There’s even an API for Updating the firmware once you know there’s a new version available if you wanted to provide an “update” action in your notification or an “update” button in your dashboard.
That’s probably as far as I can go with research though without one of these devices. Hopefully one of you all can take it from there and get it working.
Thanks for your replying and your educational insight.
Unfortunately the files “core.config_entries” and “core.device_registry” did not contain firmware version data.
This is over my know-how-level, and I don’t want to try hacking core, so hopefully the core team would consider to add a sensor with the firmware version or a binary sensor(true) when update is available. @Robban Any chance you consider this(?)
Thanks for replying. Unfortunately, I am just a happy camper (user) when it comes to HA, have no clue diving into this.
From what I understand from CentralCommands reply " within that we have an API that looks like it gives you the firmware version in the response". Anyways, maybe something to have on the list for future feature.
Yeah but we still need at least the latest version from Github which is not beta to compare it with the current version.
The latest_release_tag attribute from GitHub is not sufficient for this. Any ideas? We need a list of all versions and grab the newest one which is not “-beta”.
After that we can make a simple current vs. latest (non-beta) version comparison and proceed for creating the sensor, building proper notifications etc.