help help
I think I stumbled upon this in the past, but I would really like to have the idx of a device available in LUA. In LUA there's only the device name and there seems no easy way to link the two. Can it please be added?
IDX in LUA Topic is solved
Moderators: leecollings, remb0
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: IDX in LUA
Why do you need the idx?
When you remove a device and add it again then the idx is changed while you can give it the same name?
This will save you changing all the scripts.
When you remove a device and add it again then the idx is changed while you can give it the same name?
This will save you changing all the scripts.
Re: IDX in LUA
I would like to send out the idx using openurl. After that something else can respond with json
(/json.htm?type=devices&rid=1)
Json requires idx and not the device name.
I think I've got another solution though. I can use /json.htm?type=devices&filter=all&used=true&order=name which will give back all statusses of all devices. There I can filter out the result with the specific device name after which I also have alll attributes (including idx)
(/json.htm?type=devices&rid=1)
Json requires idx and not the device name.
I think I've got another solution though. I can use /json.htm?type=devices&filter=all&used=true&order=name which will give back all statusses of all devices. There I can filter out the result with the specific device name after which I also have alll attributes (including idx)
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: IDX in LUA
If you have a look at the check battery level script on the Wiki, here device names are used to retrieve the device idxs:
http://www.domoticz.com/wiki/Battery_level_check
It is also used extensively in the integration of Telegram for remote control of Domoticz:
http://www.domoticz.com/forum/viewtopic ... 500#p39741
http://www.domoticz.com/wiki/Battery_level_check
It is also used extensively in the integration of Telegram for remote control of Domoticz:
http://www.domoticz.com/forum/viewtopic ... 500#p39741
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: IDX in LUA
See also this script where a idx is used to fill a device with information: http://domoticz.com/forum/viewtopic.php ... 787#p39762
I am not active on this forum anymore.
Re: IDX in LUA
Like I said I was able to solve the issue in node-red.
http://www.domoticz.com/forum/viewtopic ... 120#p40212
It's basically using the same techniques, maybe a bit more elegantly.After a device has changed I am able to produce a message like this which contains all information available (including Idx) so that's nice
now I can do anything I want with it
http://www.domoticz.com/forum/viewtopic ... 120#p40212
It's basically using the same techniques, maybe a bit more elegantly.After a device has changed I am able to produce a message like this which contains all information available (including Idx) so that's nice
Code: Select all
/domoticz/out/json {"5MinuteHistoryDays":1,"ActTime":1429217810,"AllowWidgetOrdering":true,"DashboardType":0,"Latitude":"51.573735","Longitude":"5.089093","MobileType":0,"ServerTime":"Apr 16 2015 22:56:50","Sunrise":"06:43:00","Sunset":"20:35:00","TempScale":1,"TempSign":"C","WindScale":1,"WindSign":"m/s","dontcachehtml":true,"result":{"AddjMulti":1,"AddjMulti2":1,"AddjValue":0,"AddjValue2":0,"BatteryLevel":100,"CustomImage":0,"Data":"17.2 C, 50 %","DewPoint":"6.68","Favorite":1,"HardwareID":1,"HardwareName":"Rfxcom","HaveTimeout":false,"Humidity":50,"HumidityStatus":"Comfortable","ID":"400E","LastUpdate":"2015-04-16 22:56:49","Name":"TX320 Hal","Notifications":"false","PlanID":"0","Protected":false,"ShowNotifications":true,"SignalLevel":6,"SubType":"Cresta, TFA TS34C","Temp":17.2,"Timers":"false","Type":"Temp + Humidity","TypeImg":"temperature","Unit":2,"Used":1,"XOffset":"0","YOffset":"0","idx":"106"},"status":"OK","title":"Devices"}
-
- Posts: 66
- Joined: Monday 20 July 2015 14:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: IDX in LUA
I just created a pull request to address this: https://github.com/domoticz/domoticz/pull/457
Who is online
Users browsing this forum: No registered users and 1 guest