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.
issue command "getdeviceinfo"
Moderator: leecollings
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: issue command "getdeviceinfo"
With dzvents everything is documented in the wiki https://www.domoticz.com/wiki/DzVents:_ ... _scripting
What would you like to know of a device?
What would you like to know of a device?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 14
- Joined: Saturday 11 May 2019 10:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: issue command "getdeviceinfo"
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.
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
}
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: issue command "getdeviceinfo"
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.
There was in the past an issue with python plugin managed selector switches but that does not seems to be the case.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 14
- Joined: Saturday 11 May 2019 10:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: issue command "getdeviceinfo"
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.
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.)?
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: issue command "getdeviceinfo"
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
It could result in race conditions depending of the applications that read Domoticz/out
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: No registered users and 1 guest