Hi all,
I've searching the forum for a while looking for an example of switching on/off a switch via json. The reason behind is that the switch can be controlled by the Domoticz general way as the dat send by Domoticz is the command to set dimmer values while the device is just a switch (FGS-213 from Fibaro)
So I was wondering if I can control the device just by using the json way of working.
So is there someone out there that can explain or give an easy example (would be very nice) how to use json in lua
Many thanks.
Lua & Json example
Moderator: leecollings
- jvdz
- Posts: 2269
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua & Json example
Is it this you are looking for: https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s ?
Jos
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 24
- Joined: Monday 23 January 2017 7:05
- Target OS: Linux
- Domoticz version: 4.10717
- Contact:
Re: Lua & Json example
Thanks jvdz
I've seen that page already however it's not clear how to integrate this into LUA. In the location domotics/scripts/lua there is also a file JSON.lua but also here It isn't clear how to manage the json commands.
If I have already one example to control a simple switch it will already help
I've used already json to collect battery status of the devices in the network via the following os execution:
now I want to set some values via json.
Thanks
I've seen that page already however it's not clear how to integrate this into LUA. In the location domotics/scripts/lua there is also a file JSON.lua but also here It isn't clear how to manage the json commands.
If I have already one example to control a simple switch it will already help
I've used already json to collect battery status of the devices in the network via the following os execution:
Code: Select all
os.execute("curl 'http://username:pasword@" .. DomoticsIP .. ":" .. DomoticzPort .. "/json.htm?type=devices&order=name' 2>/dev/null| /user/local/bin/jq -r '.result[] | [.Name, .idx, . BatteryLevel, .Manufacturer] | @csv' >" .. DeviceFileName)
Thanks
Who is online
Users browsing this forum: No registered users and 1 guest