ZSDR-850 smoke detectors dont report updates .

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Gents.

I have problems with ZSDR-850 smoke detectors. In previous release the "last-seen" status was updated and I used it in a LUA script to track the availability of the smoke detector. However after the last update of Domoticz (5 nov-2022) this does'n work any more. The Auto detect finds the detectors but no updates are transferred from zigbee2mqtt to domoticz anymore. The Z2M is updated correctly every hour. Also the other (switches) are updated. Therefore apparently DOMOTICZ is not listening in? I used the latest Z2M 1.28.2 with Sonoff dongle 3.0 (coordinate revision 20220219)

Has someone an idea why its not working?

Thanks.

Z2M yaml
homeassistant:
legacy_entity_attributes: true
discovery_topic: homeassistant_domoticz
permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: mqtt://Mosquitto
user: mqtt
password: XXXXX
serial:
port: /dev/ttyUSB-ZIGSONOF
frontend:
port: 8080
host: 0.0.0.0
advanced:
network_key: '!secret network_key'
channel: 25
pan_id: 6754
transmit_power: 10
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
log_syslog:
app_name: Zigbee2MQTT
eol: /n
host: localhost
localhost: localhost
path: /dev/log
pid: process.pid
port: 123
protocol: tcp4
type: '5424'
log_level: info
last_seen: ISO_8601_local
device_options:
legacy: false
Last edited by rini52 on Tuesday 30 January 2024 14:50, edited 1 time in total.
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

After a couple of days I give up. This "last_seen" issue is killing. I understood that only the Web server was updated in the 2022.1 release. Now thats not the case anymore in 2022.2 . Start thinking of moving to HA, hopefully I don;t have to program each time a new release comes out.....
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by waltervl »

rini52 wrote: Friday 11 November 2022 14:52 I understood that only the Web server was updated in the 2022.1 release. Now thats not the case anymore in 2022.2 .
Who gave you that impression?
https://www.domoticz.com/wiki/Domoticz_ ... le_V2022.1
https://www.domoticz.com/wiki/Domoticz_ ... le_V2021.1
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by waltervl »

From the code the last_seen should be in the state topic as it is filtered out since 2022.1 beta from discovery topic

https://github.com/domoticz/domoticz/bl ... scover.cpp

Code: Select all

//skip some non-needed types, they will be transmitted in the state topic anyways (for 90%) or not necessary
	if (
		(object_id == "update_available")
		|| (object_id == "power_on_behavior")
		|| (object_id == "power_outage_memory")
		|| (object_id == "update_state")
		|| (object_id == "over-load_status")
		|| (object_id == "linkquality")
		|| (object_id == "last_seen")
		|| (object_id == "sensitivity")
		|| (object_id == "color_temp_startup")
		|| (object_id == "requested_brightness_level")
		|| (object_id == "requested_brightness_percent")
		|| (object_id == "device_automation")
		|| (object_id == "over-load_status")
		|| (object_id == "hardware_status")
		|| (object_id.find("_address") != std::string::npos)
		|| (object_id.find("_ssid") != std::string::npos)
		|| (object_id.find("_signal_sensor") != std::string::npos)
		)
	{
and last seen is updated:

Code: Select all

void MQTTAutoDiscover::handle_auto_discovery_availability(_tMQTTASensor* pSensor, const std::string& payload, const struct mosquitto_message* message)
{
	if (message->retain)
		return;
	if (pSensor->devType == 0)
		return; //not in system yet
	pSensor->bOnline = (payload == "online");
	if (!pSensor->payload_available.empty())
		pSensor->bOnline = (payload == pSensor->payload_available);
	else if (!pSensor->payload_not_available.empty())
		pSensor->bOnline = !(payload == pSensor->payload_not_available);
	if (pSensor->bOnline)
	{
		// update last seen
		m_sql.safe_query("UPDATE DeviceStatus SET LastUpdate='%s' WHERE (HardwareID==%d) AND (DeviceID=='%q') AND (Unit==%d)", TimeToString(nullptr, TF_DateTime).c_str(), m_HwdID,
			pSensor->unique_id.c_str(), pSensor->devUnit);
	}
}
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Walter,

Thanks for your reply.

Below a dzvent script I used in 2022.1 for tracking "last_seen" using "HTTPJsON" from de Domoticz object in memory to find the updated time. This is than used to update the "updated" time in the dbase for that smoke sensor. I use another script to track all by battery devices to warn me if the battery runs out.
The reason is quite simple the "smoke" detectors don't update the "Lastupdate" item in the database. Other sensors I have installed (wifi and RFXCOM433 sensors) do update this item on regular heartbeat times.

As reported with the new 2022.2 no reporting to the domoticz object anymore and I could not find a way to fix it.

The mqtt broker send out messages(see above) but don't now if they are correct for the new 2022.2 release.

In the mean time I have bridged two MQTT brokers and the messages are received in the second MQTT broker. In HA I have put an automatization that republish the messages to "homeassistant/#" so HA can read(discover) it. This works only partly, some are "auto discovered" but also "last_seen" is not updated at the moment. But since there is 7000km between the two brokers there might be some lag. To be investigated.

I have a look comming week if I can make some sens form the cpp code...

Thanks,
Rini


Dzvent code.....>


local devicesToCheck = {
{ ['name'] = 'ZB_smoke_hal_last_seen' , ['DeviceIdx'] = 81 , ['UpdDevIdx'] = 69 }, -- add you device list here. First line is an example from my Domoticz.
{ ['name'] = 'ZB_smoke_woonkamer_last_seen', ['DeviceIdx'] = 82 , ['UpdDevIdx'] = 71 }, -- find you devices IDx in Domoticz/Setup/Devices
{ ['name'] = 'ZB_smoke_frank_last_seen' , ['DeviceIdx'] = 83 , ['UpdDevIdx'] = 67 }, -- (-1 in UpdDevIdx => means no other device need to be updated.
{ ['name'] = 'ZB_cox_frank_last_seen' , ['DeviceIdx'] = 85 , ['UpdDevIdx'] = 73 }
}

local last_seen = 'smoke_update'
local chkdev_name = nil
local chkdev_idx = -1
local upddev_name = nil
local upddev_idx = -1
local battery_warn = 25 -- 25% battery level warning
local dead_warn = 241 -- xx minuytes no heartbeat ....





local env_mail = nil -- your mail if notification by mail needed, nil if not
local env_port = '8080' -- your mail if notification by mail needed, nil if not
local env_https = false -- true if only https supported
local env_username = nil -- base 64 if local auth is needed (see Local Networks (no username/password) option, add 127.0.0.*)
local env_password = nil -- base 64 if local auth is needed (see Local Networks (no username/password) option, add 127.0.0.*)
local env_ReturnNotif = true --Notification on normal condition return

local message = ''
local message_light = 'Device(s): '

return {
on = {
timer = { 'every 1 hours' }, -- call to url will be done at this set time
httpResponses = { last_seen } -- must match with the callback passed to the openURL command
-- devices = {
-- '*ZB_smoke*last_seen'
-- }
},
logging = {
level = domoticz.LOG_INFO, ---only info needed
marker = last_seen,
},
data = {
chkdev_name = { initial = 'none'},
chkdev_idx = { initial =-1 },
upddev_name = { initial ='none'},
upddev_idx = { initial =-1},
state = { initial = ""},
messageSent = { "Nothing" } -- for persistent data notification
},

execute = function(dz, item)

local Time = require ('Time')
local conditionDeviceState = "Off" -- keep track of warinng states
local SubSystem = nil
--[[ Notifications available :
-- NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER NSS_TELEGRAM
-- If severals needed, use {}.
-- Example :{dz.NSS_TELEGRAM, dz.NSS_HTTP}
-- must be declared in function block (https://www.dz.com/forum/viewtopic.php?f=71&t=33539)
--]]


local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end

local function get_device_info(devIdx,topic)
ans = nil
if type(devIdx) == 'string' then
devIdx_n = tonumber(devIdx);
else
devIdx_n = devIdx;
end
for i, dev2chk in pairs(devicesToCheck) do
if devIdx_n == dev2chk['DeviceIdx'] then
if topic == 'chkdev_name' then
ans = dev2chk['name'];
elseif topic == 'chkdev_idx' then
ans = dev2chk['DeviceIdx'];
elseif topic == 'upddev_idx' then
ans = dev2chk['UpdDevIdx'];
elseif topic == 'upddev_name' then
ans = dz.devices(dev2chk['UpdDevIdx']).name;
else
ans="unkown topic";
end
end
end
return ans
end

local function notification(subject, message)
dz.log("State before notify : " .. dz.data.state,dz.LOG_DEBUG)
dz.log("State after notify : " .. conditionDeviceState,dz.LOG_DEBUG)
if conditionDeviceState ~= dz.data.state then
dz.log("Notification sending",dz.LOG_INFO)
if SubSystem == nil then
dz.notify(subject, message, dz.PRIORITY_NORMAL)
else
dz.notify(subject, message, dz.PRIORITY_NORMAL, '', '', SubSystem)
end
if env_mail ~= nil then
dz.email('Dead devices', message, env_mail)
end
dz.data.state = "On"
dz.data.messageSent = message_light
else
dz.log("Nothing to send, message not updated",dz.LOG_INFO)
end
end

local function triggerJSON()
local URLString = "http"
if env_https then
URLString = URLString .. 's'
end
if (env_password == nil or env_username == nil) then
--url = 'http://127.0.0.1:8080/json.htm?type=devices&rid='.. chkdev_idx ..'',
URLString = URLString .. "://127.0.0.1:"..env_port.."/json.htm?type=devices&used=false"
else
URLString = URLString .. "://127.0.0.1:"..env_port.."/json.htm?type=devices&used=false&username="..env_username.."&password="..env_password
end
dz.openURL({ url = URLString,
method = "GET",
callback = last_seen })
end

local function updateJSON(upddev_idx,chk_signalLevel,chk_batterylevel)
-- dz.settings['Domoticz url']='http://127.0.0.1:'..env_port
-- logWrite("URL=" .. dz.settings['Domoticz url'])
-- url construction
-- local js_prefix=dz.settings['Domoticz url'] .. '/json.htm?type=command&param=udevice&nvalue=0&svalue=
-- update device
dz.log("DeviceID '"..upddev_idx.."' will be updated from last-seen (ZB)device",dz.LOG_DEBUG)
-- url construction
local js_prefix='http://127.0.0.1:'.. env_port .. '/json.htm?type=command&param=udevice&nvalue=0&svalue='
dz.openURL(js_prefix ..
'&idx='.. upddev_idx ..
'&rssi=' .. chk_signalLevel ..
'&battery='.. chk_batterylevel ..
'&linkqualit=120')
end


if (item.isTimer) then

triggerJSON() -- call the url

end

if (item.isHTTPResponse) then

if (item.ok) then
if (item.isJSON) then
-- local Time = require('Time')
local now = Time()
-- local rt = dz.utils.fromJSON(trigger.data) -- convert json data to Lua table
-- local sensor2update=string.gsub(dz.data.trigger_device,'last_seen','smoke',1) --get ther real name of the sensors
local results = item.json.result -- just an example
for i, deviceToCheck in pairs(devicesToCheck) do
local chkdev_idx = deviceToCheck['DeviceIdx']
local chkdev_found = false
-- loop through the devices (one by one)
for j, node in pairs(results) do
-- if string.match(results.Name,'smoke.*last_seen') ~= nil then -- mache anything between smoke and last_seen
-- if string.match(results.Name,string.gsub(trigger_device,'last_seen','',1)) ~= nil then -- get the sensor info
-- update some device in Domoticz
num_idx = tonumber(node.idx) -- need number(int)
if chkdev_idx == num_idx then
logWrite("Device " .. node.Name .. " device " .. node.idx .. " has battery: ".. node.BatteryLevel)
chkdev_found = true
-- Find device to update
-- upddev_name = string.gsub(node.Name,'last_seen','smoke',1) --replace lasst_seen by smoke
local upddev_name = get_device_info(node.idx,'upddev_name')
local upddev_idx = get_device_info(node.idx,'upddev_idx')
local chk_lastup = Time(node.LastUpdate)
logWrite('Device:'.. upddev_name)
logWrite('Minutes ago: ' .. chk_lastup.minutesAgo)
local chk_batterylevel=node.BatteryLevel
local chk_signalLevel=node.SignalLevel
-- Current_batterylevel=90
logWrite("batteryLevel=" .. chk_batterylevel)
-- update device if needed.... (60 minutes?)
if chk_lastup.minutesAgo < 61 and upddev_idx > 0 then
dz.log("Device '"..upddev_name.."(" ..upddev_idx .. ")' will be updated from last-seen (ZB)device",dz.LOG_INFO)
--update relate Device
updateJSON(upddev_idx,chk_signalLevel,chk_batterylevel)
end
-- check batterylevels and warn if necc (zit nu in battery_checking)
if chk_batterylevel < battery_warn then
logWrite ('Device: ' .. upddev_name .. ' has low batterylevel ('..chk_batterylevel..'%). Need to be replaced')
-- warnnnnnnn
dz.log("Device "..upddev_name.." has low batterylevel ("..chk_batterylevel.."%)",dz.LOG_INFO) -- change notification logline to suit your needs
-- dz.notify(upddev_name,"Batterij van "..device.name.." moet vervangen worden ("..device.batteryLevel.."%)",dz.PRIORITY_NORMAL) -- change notification message to suit your needs

end
if chk_lastup.minutesAgo > dead_warn then --- check for dead devices
--
message = message .. 'Device ' ..
upddev_name .. ' seems to be dead. No heartbeat for at least ' ..
chk_lastup.minutesAgo .. ' minutes at ' .. now.raw .. '. \n\r'
message_light = message_light .. upddev_name .. ', '
-- notification('Warning',message)
end
break
end
end
if not chkdev_found then
-- looped through all devices but device not found
dz.log("Device: "..chkdev_idx.." not available in 'unused' device-list (see devicesToCheck array)",dz.LOG_ERROR)
end
end

if (message ~= "") then
message_light = message_light .. 'seem(s) to be dead'
dz.log(message_light, dz.LOG_DEBUG)
dz.log(dz.data.messageSent, dz.LOG_DEBUG)
if (message_light ~= dz.data.messageSent) then
dz.data.state = "Off" -- force sending if new device added
end
conditionDeviceState = "On"
notification('Warning',message_light)
dz.log('Dead devices found: ' .. message, dz.LOG_ERROR)
end

if dz.data.state ~= conditionDeviceState then --Normal state return
dz.data.state = conditionDeviceState
if env_ReturnNotif == true then
if SubSystem == nil then
dz.notify('Information','Return to normal state, all devices are operational')
else
dz.notify('Information','Return to normal state, all devices are operational', '', '', '', SubSystem)
end
end
else
dz.log("State Reset not needed",dz.LOG_DEBUG)
end
dz.log("Live state: " .. dz.data.state,dz.LOG_DEBUG)
dz.log("Live condition: " .. conditionDeviceState,dz.LOG_DEBUG)
else
dz.log('There was a problem handling event request (Trig OK json NOK)', dz.LOG_ERROR)
dz.log(item, dz.LOG_ERROR)
end
else
dz.log('There was a problem handling trigger event request', dz.LOG_ERROR)
dz.log(item, dz.LOG_ERROR)
end
end
end
}
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Walter,

I did use MQTT_exploror to publish the "auto-discover message and got the error below in the log file.


2022-11-14 16:48:30.541 Error: Zigbee2Mqtt AutoDetect: MQTT_Discovery: Invalid/Unhandled data received! (Topic: homeassistant_domoticz/sensor/0x000d6f00166ac2c2/last_seen, Message: {
2022-11-14 16:48:30.541 "availability": [
2022-11-14 16:48:30.541 {
2022-11-14 16:48:30.541 "topic": "zigbee2mqtt/bridge/state",
2022-11-14 16:48:30.541 "value_template": "{{ value_json.state }}"
2022-11-14 16:48:30.541 },
2022-11-14 16:48:30.541 {
2022-11-14 16:48:30.541 "topic": "zigbee2mqtt/ZB_smoke_woonkamer/availability",
2022-11-14 16:48:30.541 "value_template": "{{ value_json.state }}"
2022-11-14 16:48:30.541 }
2022-11-14 16:48:30.541 ],
2022-11-14 16:48:30.541 "availability_mode": "all",
2022-11-14 16:48:30.541 "device": {
2022-11-14 16:48:30.541 "identifiers": [
2022-11-14 16:48:30.541 "zigbee2mqtt_0x000d6f00166ac2c2"
2022-11-14 16:48:30.541 ],
2022-11-14 16:48:30.541 "manufacturer": "Trust",
2022-11-14 16:48:30.541 "model": "Smoke detector (ZSDR-850)",
2022-11-14 16:48:30.541 "name": "ZB_smoke_woonkamer",
2022-11-14 16:48:30.541 "sw_version": "1.1.1"
2022-11-14 16:48:30.541 },
2022-11-14 16:48:30.541 "device_class": "timestamp",
2022-11-14 16:48:30.541 "enabled_by_default": true,
2022-11-14 16:48:30.541 "entity_category": "diagnostic",
2022-11-14 16:48:30.541 "icon": "mdi:clock",
2022-11-14 16:48:30.541 "json_attributes_topic": "zigbee2mqtt/ZB_smoke_woonkamer",
2022-11-14 16:48:30.541 "name": "ZB_smoke_woonkamer_last_seen",
2022-11-14 16:48:30.541 "state_topic": "zigbee2mqtt/ZB_smoke_woonkamer",
2022-11-14 16:48:30.541 "unique_id": "0x000d6f00166ac2c2_last_seen_zigbee2mqtt",
2022-11-14 16:48:30.541 "value_template": "{{ value_json.last_seen }}"
2022-11-14 16:48:30.541 })
...



maybe something wrong with it and since I had the the sensors already installed in the Domoticz from the 2022.1 may some mismatch .....

???
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Walter

Updateing the auto-discover in Hardware looks okey....

Log file-->

2022-11-14 16:48:15.186 Status: MQTT_local: Connecting to Mosquitto:1883
2022-11-14 16:48:28.322 Status: Zigbee2Mqtt AutoDetect: Connecting to Mosquitto:1883
2022-11-14 16:48:28.525 Status: Zigbee2Mqtt AutoDetect: re-connected to: Mosquitto:1883
2022-11-14 16:48:28.829 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1 (unique_id: 0xa4c138b50e36bf78_switch_zigbee2mqtt)
2022-11-14 16:48:28.931 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2 (unique_id: 0xa4c138911a94cf75_switch_zigbee2mqtt)
2022-11-14 16:48:29.033 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_power (unique_id: 0xa4c138b50e36bf78_power_zigbee2mqtt)
2022-11-14 16:48:29.134 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_current (unique_id: 0xa4c138b50e36bf78_current_zigbee2mqtt)
2022-11-14 16:48:29.234 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_voltage (unique_id: 0xa4c138b50e36bf78_voltage_zigbee2mqtt)
2022-11-14 16:48:29.335 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_energy (unique_id: 0xa4c138b50e36bf78_energy_zigbee2mqtt)
2022-11-14 16:48:29.536 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_indicator_mode (unique_id: 0xa4c138b50e36bf78_indicator_mode_zigbee2mqtt)
2022-11-14 16:48:30.038 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_hal/ZB_smoke_hal_battery (unique_id: 0x000d6f00166a8958_battery_zigbee2mqtt)
2022-11-14 16:48:30.340 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_woonkamer/ZB_smoke_woonkamer_battery (unique_id: 0x000d6f00166ac2c2_battery_zigbee2mqtt)
2022-11-14 16:48:30.845 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_frank/ZB_smoke_frank_battery (unique_id: 0x000d6f00166ab7f1_battery_zigbee2mqtt)
2022-11-14 16:48:31.447 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_cox_frank/ZB_cox_frank_battery (unique_id: 0x000d6f001697e64b_battery_zigbee2mqtt)
2022-11-14 16:48:31.748 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_power (unique_id: 0xa4c138911a94cf75_power_zigbee2mqtt)
2022-11-14 16:48:31.849 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_current (unique_id: 0xa4c138911a94cf75_current_zigbee2mqtt)
2022-11-14 16:48:31.949 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_voltage (unique_id: 0xa4c138911a94cf75_voltage_zigbee2mqtt)
2022-11-14 16:48:32.050 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_energy (unique_id: 0xa4c138911a94cf75_energy_zigbee2mqtt)
2022-11-14 16:48:32.251 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_indicator_mode (unique_id: 0xa4c138911a94cf75_indicator_mode_zigbee2mqtt)
2022-11-14 16:48:32.754 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_indicator_mode (unique_id: 0xa4c138b50e36bf78_indicator_mode_zigbee2mqtt)
2022-11-14 16:48:32.956 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_indicator_mode (unique_id: 0xa4c138911a94cf75_indicator_mode_zigbee2mqtt)
2022-11-14 16:48:33.058 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_Hue_lamp_1/ZB_Hue_lamp_1_effect (unique_id: 0x001788010c31490d_effect_zigbee2mqtt)
2022-11-14 16:48:33.159 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_1/ZB_smartplug_1_child_lock (unique_id: 0xa4c138b50e36bf78_child_lock_zigbee2mqtt)
2022-11-14 16:48:33.260 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smartplug_2/ZB_smartplug_2_child_lock (unique_id: 0xa4c138911a94cf75_child_lock_zigbee2mqtt)
2022-11-14 16:48:33.461 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_hal/ZB_smoke_hal_smoke (unique_id: 0x000d6f00166a8958_smoke_zigbee2mqtt)
2022-11-14 16:48:33.562 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_hal/ZB_smoke_hal_battery_low (unique_id: 0x000d6f00166a8958_battery_low_zigbee2mqtt)
2022-11-14 16:48:33.663 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_woonkamer/ZB_smoke_woonkamer_smoke (unique_id: 0x000d6f00166ac2c2_smoke_zigbee2mqtt)
2022-11-14 16:48:33.764 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_woonkamer/ZB_smoke_woonkamer_battery_low (unique_id: 0x000d6f00166ac2c2_battery_low_zigbee2mqtt)
2022-11-14 16:48:33.864 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_frank/ZB_smoke_frank_smoke (unique_id: 0x000d6f00166ab7f1_smoke_zigbee2mqtt)
2022-11-14 16:48:33.965 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_smoke_frank/ZB_smoke_frank_battery_low (unique_id: 0x000d6f00166ab7f1_battery_low_zigbee2mqtt)
2022-11-14 16:48:34.166 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_cox_frank/ZB_cox_frank_carbon_monoxide (unique_id: 0x000d6f001697e64b_carbon_monoxide_zigbee2mqtt)
2022-11-14 16:48:34.267 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_cox_frank/ZB_cox_frank_battery_low (unique_id: 0x000d6f001697e64b_battery_low_zigbee2mqtt)
2022-11-14 16:48:34.468 Status: Zigbee2Mqtt AutoDetect: discovered: ZB_Hue_lamp_1/ZB_Hue_lamp_1 (unique_id: 0x001788010c31490d_light_zigbee2mqtt)
2022-11-14 16:48:45.235 Status: MQTT_local: Connecting to Mosquitto:1883
2022-11-14 16:48:45.439 Status: MQTT_local: re-connected to: Mosquitto:1883
2022-11-14 16:50:00.311 Status: dzVents: Info: S0_8266_RLD: ------ Start internal script: S0_8266_RLD:, trigger: "at daytime every 2 minutes"
2022-11-14 16:50:00.332 Status: dzVents: Info: S0_8266_RLD: Device Solaredge actual ouput 0.0 (Watt)
2022-11-14 16:50:00.332 Status: dzVents: Info: S0_8266_RLD: Solaredge switch updated 101 (min ago)
2022-11-14 16:50:00.333 Status: dzVents: Info: S0_8266_RLD: ------ Finished S0_8266_RLD
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Hi Walter

Some updates.

First I have to admit that my C++ knowledge is a little rusty and do not fully understand the flow throw the code.
What I can report is that the auto discover of the "last_seen" item is producing a device with that name (LAST_SEEN) but maybe it was already there in the 2022.1 version and transfered to the 022.2 upgrade. I removed the battery_low device and it was rediscovered, so I assume the "last-seen" will also be re-discovered?.

The text states that the "last-seen" item might be inserted in the topic-state fase. Did not find where that happens (but that is my missing knowledge!!)
I think I understand the "//topic format: <discovery_prefix>/<component>/[<node_id>/]<object_id>/<action>" mqqt message and the exclusion of "Last-seen" but the update of the sensor is reported by the message "zigbee2mqtt/ZB_smoke_woonkamer ("ac_status":false etc") where that is captured I misssed do to my knowledge gap. The alarm is however reported and that is with the same mqtt message, only the item smoke is set to "true". So it seems that "last_seen" is not picked up in the new 2022.2 code.


I had a look at the 2022.1 code and there the "last_seen" object_id was not in the exclusion list. Maybe that could be the reason?

2022.1 code --->
//skip some non-needed types, they will be transmitted in the state topic anyways (for 90%) or not necessary
if (
(object_id == "update_available")
|| (object_id == "power_on_behavior")
|| (object_id == "power_outage_memory")
|| (object_id == "update_state")
|| (object_id == "over-load_status")
|| (object_id == "linkquality")
|| (object_id == "sensitivity")
|| (object_id == "color_temp_startup")
|| (object_id == "requested_brightness_level")
|| (object_id == "requested_brightness_percent")
|| (object_id == "device_automation")
|| (object_id == "over-load_status")
|| (object_id == "hardware_status")
|| (object_id.find("_address") != std::string::npos)
|| (object_id.find("_ssid") != std::string::npos)
|| (object_id.find("_signal_sensor") != std::string::npos)
)
{
return;
}

2022.2 code -->

//skip some non-needed types, they will be transmitted in the state topic anyways (for 90%) or not necessary
if (
(object_id == "update_available")
|| (object_id == "power_on_behavior")
|| (object_id == "power_outage_memory")
|| (object_id == "update_state")
|| (object_id == "over-load_status")
|| (object_id == "linkquality")
|| (object_id == "last_seen")
|| (object_id == "sensitivity")
|| (object_id == "color_temp_startup")
|| (object_id == "requested_brightness_level")
|| (object_id == "requested_brightness_percent")
|| (object_id == "device_automation")
|| (object_id == "over-load_status")
|| (object_id == "hardware_status")
|| (object_id.find("_address") != std::string::npos)
|| (object_id.find("_ssid") != std::string::npos)
|| (object_id.find("_signal_sensor") != std::string::npos)
)
{
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by waltervl »

rini52 wrote: Wednesday 16 November 2022 9:20 Hi Walter

Some updates.

First I have to admit that my C++ knowledge is a little rusty and do not fully understand the flow throw the code.
What I can report is that the auto discover of the "last_seen" item is producing a device with that name (LAST_SEEN) but maybe it was already there in the 2022.1 version and transfered to the 022.2 upgrade. I removed the battery_low device and it was rediscovered, so I assume the "last-seen" will also be re-discovered?.

The text states that the "last-seen" item might be inserted in the topic-state fase. Did not find where that happens (but that is my missing knowledge!!)
I think I understand the "//topic format: <discovery_prefix>/<component>/[<node_id>/]<object_id>/<action>" mqqt message and the exclusion of "Last-seen" but the update of the sensor is reported by the message "zigbee2mqtt/ZB_smoke_woonkamer ("ac_status":false etc") where that is captured I misssed do to my knowledge gap. The alarm is however reported and that is with the same mqtt message, only the item smoke is set to "true". So it seems that "last_seen" is not picked up in the new 2022.2 code.


I had a look at the 2022.1 code and there the "last_seen" object_id was not in the exclusion list. Maybe that could be the reason?
I do not use MQTT and neither I am a C++ programmer so cannot help you here. I suppose last-seen will be managed somehow. Normally it is an attribute of the domoticz device and NOT a seperate device.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Hi Walter

Unfortunate "last_seen" is nowhere updated and is lost in space with the new 2022.2 version. As a test, I also removed the whole device and did an re- auto-discover. Only the "smoke" and "battery_low" were discovered and inserted in the device table, the "last_seen" was not created. At least in the 2022.1 we also got a "last_seen" device and with the Json trick in dzventz you could extract the last reported time of the device. Now we are in the dark and basicly you have to go to the smoke device and manual push test button to get the the "lastupdate" time. This is exactly what you want to avoid. The Zigbee2Mqqt GUI is nicely reporting how long ago it got an update. This is what you want as well in Domoticz and was possible in 2022.1 with the "last_seen" device.
Going back to the 2022.1 is also not possible because the db of the new 2022.2 is not excepted in the 2022.1.
Hopefully someone comes up with a solution for the auto-detect version of Zigbee2mqtt. If I remember correctly the python version was ok . But mixing auto and python is,i think, a recipe for disaster!!!

Also in Homeassistant there is a long discussion about "last_seen", therefore One should have the possibility to use it. Not exclude it, as in the new 2022.2...

Regards,
Rini
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by waltervl »

Indeed normally there is no last seen device created, it should be seen as a value on the device widget. See for example my motion sensor with last seen value
Screenshot_20221117-205028-926.png
Screenshot_20221117-205028-926.png (42.36 KiB) Viewed 742 times
This last seen value can be read with scripts. Also you can set device notifications on some devices if last seen value becomes too large.

Do you see a last seen value on your device widget of the smoke sensor device?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Yes it's there but doesn't get updated from sensors heartbeat (one per hour).
Image

In the mean time i recompiled the source code. and removed the exclusion in the .cpp code. Now it seems to work again....

So maybe a request somewhere to either get it updated in the widget or something like i did..
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Walter,

After I re-compiled the domoticz source code. I did some more fact finding.
I noticed that after removing the "last_seen" from the exclusion check the following things happen.

a) a new device "last_seen" is created in the the device list.
b) The detector sends out a update message /zigbee2mqtt/xxx with a payload item "last_seen" having a time stamp different from the time the message was send.
c) the device "last-seen" gets updated and I can detect the "lastUpdate" time from the item in Domoticz and is the time when the acutal message was send.
d) this lastUpdate time is the time of the last mesaaeg send by the sensor and I can use to keep track if the sensor is still alive.
(sett the attched screen dump of the MQTT-explorer . where you can compare "last_seen" with the actual time.

So the above is helping me.

However what happens, I assume, in the case of the new 2022.2 code the "last-seen" item in the widget is fed with the "last-seen" time in the message from zigbee2mqtt broker. and the time is not updated . This contains i think the last time the test button was pushed. So Koen of Z2M has to provide it with the proper time if we want to use "last-seen" as "lastupdate" time for a still alive check.
This might be debuted by others however????

best regards,
Rini
COX_sensor_update.png
COX_sensor_update.png (199.95 KiB) Viewed 712 times
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
rini52
Posts: 34
Joined: Friday 10 June 2022 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by rini52 »

Hi Walter
In the mean time I took a big journey into cross compiling domoticz. Frist I ,as explained, commented out the line "last-seen line" in the AUTO_discover.cpp code in the hardware directory. I did it inside a VM using using the "vagrant" example in domoticz documentation. This however was done on my ubutu box with a x86_64 processor. My production Domoticz is running at home 7000km away on a Pi-4. This one has a arm processor. So I had to changed the "Vagranfile" to cross-compile domoticz for a arm64 processor on my ubuntu box. Great help from "https://github.com/abhiTronix/raspberry ... lers/wiki/" . My biggest challenge was the boost library cross compiling. The resulting domoticz executable was transferred to the production docker container at home. It seems to work ok and I have the "last_seen" text devices updated every hour.....

So I don't know how to make a request to get the "last-seen" item also excluded in the main stream build , or make it optional....

Regards
Rini
Domoticz running on Pi-4, Ubuntu(amd64), Synology Nas and VM
Hardware: RFXCOM, RFLINK, P1-smartmeter-HomeWizard, Z2M Sonoff dongle(20+ devices), Esp8266 (counters), Eaton_3S ups
User avatar
waltervl
Posts: 5721
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: ZSDR-850 smoke detectors dont report updates .

Post by waltervl »

If your change is suitable for all users then you are free to submit a pull request with your change to the dev branche of Domoticz. It will then be implemented into Domoticz latest beta.
https://github.com/domoticz/domoticz/pulls
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest