Is it possible to get the device status (On, Off, Open, Closed and so on) from just the IDX value? Insted of using the name of the device?
I have searched the forum and google, and have not found any answer. I know how to to update a device status using 'IDX|X|State' eg. '52|0|Off'
But not how to get te current device status using only the IDX number.
use IDX with devicechanged and/or otherdevices
Moderators: leecollings, remb0
-
- Posts: 15
- Joined: Monday 01 May 2017 20:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
use IDX with devicechanged and/or otherdevices
Raspberry Pi 4 - Raspbian Buster + Domoticz + RFXtrxcom 433, House(dimmers, sockets, harmonyhub, Temp / Humidity Sensors, PIR, ESP8266)
- lonebaggie
- Posts: 86
- Joined: Tuesday 31 January 2017 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: England
- Contact:
Re: use IDX with devicechanged and/or otherdevices
I cannot claim any credit for this function, I found it somewhere on this site, but it returns the switch name from IDX number
function idxname(deviceIDX)
local idx = tonumber(deviceIDX)
for i, v in pairs(otherdevices_idx) do
if v == idx then
return i
end
end
return 0
end
function idxname(deviceIDX)
local idx = tonumber(deviceIDX)
for i, v in pairs(otherdevices_idx) do
if v == idx then
return i
end
end
return 0
end
-
- Posts: 15
- Joined: Monday 01 May 2017 20:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: use IDX with devicechanged and/or otherdevices
i did stumble on this approach aswell in the forum, it would be nice to see a more efficient way of doing it.
Dose dzVents offer some better solution to this?
Dose dzVents offer some better solution to this?
Code: Select all
function idxname(deviceIDX)
local idx = tonumber(deviceIDX)
for i, v in pairs(otherdevices_idx) do
if v == idx then
return i
end
end
return 0
end
Raspberry Pi 4 - Raspbian Buster + Domoticz + RFXtrxcom 433, House(dimmers, sockets, harmonyhub, Temp / Humidity Sensors, PIR, ESP8266)
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: use IDX with devicechanged and/or otherdevices
Of course it does! It's trivial with dzVents!
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Who is online
Users browsing this forum: No registered users and 1 guest