Poller to ID
Moderators: leecollings, remb0
Poller to ID
I never noticed the “http poller” before and I was wondering if it might be a good idea to directly set a value of a device with the value found in the url instead of using a LUA script. Just a thought.
- waltervl
- Posts: 5904
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Poller to ID
Yes that is very well possible altough if your current lua scripts runs why change?
Only if the http call is slow it will not stall the event system-when using HTTP Poller as it is in a separate system.
But you could also use the async openURL function in DzVents for this.
Only if the http call is slow it will not stall the event system-when using HTTP Poller as it is in a separate system.
But you could also use the async openURL function in DzVents for this.
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
Re: Poller to ID
I’m not using LUA at the moment, I’m updating using the API which works, but if I can use what’s built in…
- waltervl
- Posts: 5904
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Poller to ID
Yes, then start with the http poller.
But only if your device website is showing CSV, JSON or XML data. Else you will have to do some extra scraping.
https://www.domoticz.com/wiki/HTTP/HTTPS_poller
But only if your device website is showing CSV, JSON or XML data. Else you will have to do some extra scraping.
https://www.domoticz.com/wiki/HTTP/HTTPS_poller
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
Re: Poller to ID
But my point is: I would like to NOT use LUA and simply import the URL output in a device specified with an ID. This is currently not possible if I read the documentation correctly.
- waltervl
- Posts: 5904
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Poller to ID
That is not how it works, see the Wiki.
It is a plugin or an integration that already connects to the website.
Or the HTTP Poller (with a small Lua script), a separate eventscript (Lua, dzvents, python) or some script outside Domoticz that updates a Dummy device with API calls.
It is a plugin or an integration that already connects to the website.
Or the HTTP Poller (with a small Lua script), a separate eventscript (Lua, dzvents, python) or some script outside Domoticz that updates a Dummy device with API calls.
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: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: Poller to ID
The lua script needed for the http poller is required but very simple.
It only does the mapping from a field in the API output to a device. Example for a kWh meter below receiving two values below.
Code: Select all
-- Read API output
s = request['content'];
-- Extract the values
local a = domoticz_applyJsonPath(s,'.total_power_export_t1_kwh')
local b = domoticz_applyJsonPath(s,'.active_power_w')
-- Post values onto the device
local idxkWh = 3
domoticz_updateDevice(idxkWh,'',-1*b ..";".. a*1000 )
Re: Poller to ID
I know it’s very simple, but my thought was it could be even easier and was meant as feature request. I posted on GitHub, but they told me to post it here.
- waltervl
- Posts: 5904
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Poller to ID
If it was meant as a enhancement request I would have no idea how somebody could implement this without a serious complex configuration interface.
Every website is different, so a lot of settings to think of to support all possible possibilities.
The current implementation with a small script seems to be the best possible way.
Every website is different, so a lot of settings to think of to support all possible possibilities.
The current implementation with a small script seems to be the best possible way.
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
Re: Poller to ID
The output value gotten from the URL could only be txt I guess. But I understand this could give difficulties with elaborate devices. I will look into LUA then to keep things centralized and less depended on the API… or maybe not change a thing.
Who is online
Users browsing this forum: No registered users and 1 guest