Poller to ID

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
vespino
Posts: 49
Joined: Tuesday 05 August 2014 14:41
Target OS: Linux
Domoticz version:

Poller to ID

Post by vespino »

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.
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Poller to ID

Post by waltervl »

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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
vespino
Posts: 49
Joined: Tuesday 05 August 2014 14:41
Target OS: Linux
Domoticz version:

Re: Poller to ID

Post by vespino »

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…
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Poller to ID

Post by waltervl »

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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
vespino
Posts: 49
Joined: Tuesday 05 August 2014 14:41
Target OS: Linux
Domoticz version:

Re: Poller to ID

Post by vespino »

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.
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Poller to ID

Post by waltervl »

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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
willemd
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

Post by willemd »

vespino wrote: Monday 27 November 2023 16:02 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.
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 )

vespino
Posts: 49
Joined: Tuesday 05 August 2014 14:41
Target OS: Linux
Domoticz version:

Re: Poller to ID

Post by vespino »

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.
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Poller to ID

Post by waltervl »

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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
vespino
Posts: 49
Joined: Tuesday 05 August 2014 14:41
Target OS: Linux
Domoticz version:

Re: Poller to ID

Post by vespino »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest