Page 1 of 1

issue command "getdeviceinfo"

Posted: Friday 13 May 2022 19:05
by wewa
Hello together,

is it possible to issue the command "getdeviceinfo" via script (LUA, dzVents, etc.)?
And how would this be possible? Maybe you can provide some example.

Best regards
wewa

PS: I have to admit that I failed to issue this command via some Domitcz script. I could never see the device status on MQTT.

Re: issue command "getdeviceinfo"

Posted: Saturday 14 May 2022 1:04
by waltervl
With dzvents everything is documented in the wiki https://www.domoticz.com/wiki/DzVents:_ ... _scripting

What would you like to know of a device?

Re: issue command "getdeviceinfo"

Posted: Sunday 15 May 2022 20:26
by wewa
I have an issue with a dummy switch of type selector. Usually a switch (e.g. of type on/off) reports it's state on MQTT once it is changed via MQTT (I am using Reacticz for that). This is good to have, because with this other MQTT clients are informed of this change when they are listening on "domitcz/out". But the issue with a switch of type selector is not reporting back.

Therefore I would need a script to issue trigger getdeviceinfo (https://www.domoticz.com/wiki/MQTT#Request_Device_Info) for the selector switch once it is changed.

I already found a workaround for this (see the script below), but it would be prettier if getdeviceinfo could be triggered.

Code: Select all

return {
	on = {
		devices = {
			'MyDummySelectorSwitchName'
		}
	},
	data = {
            svalue = { initial = 0 }
        },
	execute = function(domoticz, item)
	    if (item.isDevice) then
		    if (item.level ~= domoticz.data.svalue) then -- should only be done once
		        domoticz.data.svalue = item.level
		        -- set level again, so that it is broadcasted via MQTT
		        item.switchSelector(item.level)
		    end
		end
	end
}

Re: issue command "getdeviceinfo"

Posted: Monday 16 May 2022 0:14
by waltervl
Seems strange that you do not get the correct MQTT message out when you set the selector switch. I suppose you do that manually or by another scripting way?
There was in the past an issue with python plugin managed selector switches but that does not seems to be the case.

Re: issue command "getdeviceinfo"

Posted: Tuesday 17 May 2022 9:16
by wewa
waltervl wrote: Monday 16 May 2022 0:14 Seems strange that you do not get the correct MQTT message out when you set the selector switch. I suppose you do that manually or by another scripting way?
You are so right. See this commit I made in Reacticz. https://github.com/domoticz/Reacticz/co ... 6729280f79
I made it so long ago that I forgot about this. :roll:

But, should not Domoticz be expanded by a functionality which broadcasts the state of a device via MQTT (domoticz/out) regardless on how it was changed (e.g. via MQTT, GUI etc.)?

Re: issue command "getdeviceinfo"

Posted: Tuesday 17 May 2022 13:12
by waltervl
Perhaps you have to test the Prevent Loop setting of MQTT: https://www.domoticz.com/wiki/MQTT#Main_parameters
It could result in race conditions depending of the applications that read Domoticz/out