add update check for device

This commit is contained in:
John
2022-12-17 19:33:53 +01:00
parent f2fb959135
commit 40f8d2e5a0
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -354,6 +354,23 @@ def_global_updatecheck-payload = %global_prefix,
"value_template":"{%% set my_vernum = value_json|truncate(255)|regex_replace(find=',.*| available|revision v|version v',replace='') %%}{%% set my_ver = {'installed_version':'%version','latest_version':my_vernum,'entity_picture':'https://ebusd.eu/logo-32x32.png','release_url':'https://github.com/john30/ebusd/releases/latest'} %%}{%% if my_vernum == '' %%}{%% set my_ver.latest_version = '%version' %%}{%% endif %%}{{ my_ver | tojson }}"
}
# optional secondary update check for the eBUS device (consuming the same topic though!)
def_global_updatecheck_device-topic = %haprefix/update/%{TOPIC}_device/config
def_global_updatecheck_device-payload = {
"unique_id":"%{TOPIC}_device",
"device":{
"identifiers":"%{PREFIXN}_device",
"manufacturer":"ebusd.eu",
"name":"%prefixn device",
"via_device":"%PREFIXN",
"suggested_area":"%area"
},
"state_topic":"%topic",
"name":"%prefixn %name",
"value_template":"{%% set my_vernum = value_json|truncate(255)|regex_replace(find='^[^,]*|, device firmware |,.*| available',replace='') %%}{%% set my_ver = {'installed_version':'old','latest_version':my_vernum,'entity_picture':'https://adapter.ebusd.eu/favicon.ico','release_url':'https://adapter.ebusd.eu/firmware/ChangeLog'} %%}{%% if my_vernum == '' %%}{%% set my_ver.installed_version = 'current' %%}{%% set my_ver.latest_version = '%version' %%}{%% endif %%}{{ my_ver | tojson }}"
}
# the topic and payload to listen to in order to republish all config messages.
# HA integration: force republish of all configs when HA goes down and comes up again.
config_restart-topic = %haprefix/status