add update check for device
This commit is contained in:
@@ -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 }}"
|
"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.
|
# 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.
|
# HA integration: force republish of all configs when HA goes down and comes up again.
|
||||||
config_restart-topic = %haprefix/status
|
config_restart-topic = %haprefix/status
|
||||||
|
|||||||
@@ -952,6 +952,8 @@ void MqttHandler::run() {
|
|||||||
publishDefinition(m_replacers, "def_global_uptime-", uptimeTopic, "global", "uptime", "def_global-");
|
publishDefinition(m_replacers, "def_global_uptime-", uptimeTopic, "global", "uptime", "def_global-");
|
||||||
publishDefinition(m_replacers, "def_global_updatecheck-", m_globalTopic.get("", "updatecheck"), "global",
|
publishDefinition(m_replacers, "def_global_updatecheck-", m_globalTopic.get("", "updatecheck"), "global",
|
||||||
"updatecheck", "def_global-");
|
"updatecheck", "def_global-");
|
||||||
|
publishDefinition(m_replacers, "def_global_updatecheck_device-", m_globalTopic.get("", "updatecheck"), "global",
|
||||||
|
"updatecheck_device", "");
|
||||||
publishDefinition(m_replacers, "def_global_scan-", m_globalTopic.get("", "scan"), "global", "scan",
|
publishDefinition(m_replacers, "def_global_scan-", m_globalTopic.get("", "scan"), "global", "scan",
|
||||||
"def_global-");
|
"def_global-");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user