Vera UI7 humidity data to Domoticz

Moderator: leecollings

Post Reply
GreenGuy
Posts: 1
Joined: Wednesday 01 May 2019 16:46
Target OS: Linux
Domoticz version: 2021.1
Location: Cheshire UK
Contact:

Vera UI7 humidity data to Domoticz

Post by GreenGuy »

I am trying to transfer humidity data from Vera UI7 to Domoticz using the command "os.execute('curl "http://192.168.1.95:3480/data_request?i ... rrentLevel"')" in ~/domoticz/scripts/lua_parsers under Linux Debian 18.04. The command "http://192.168.1.95:3480/data_request?i ... rrentLevel" when put into a web programme gives the correct result. I've looked at examples but am struggling.
How do I programme LUA to put the humidity data into a Virtual Sensor?

HTTP Poller settings
ContentType: application/xmp

The lua script below
os.execute('curl "http://192.168.1.95:3480/data_request?i ... rrentLevel"')
local deviceId = 281
s = request['content'];
local id = domoticz_applyXPath(s,'//id/text()')
local s = domoticz_applyXPath(s,'//value/text()')
domoticz_updateDevice(id,'',s)
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Vera UI7 humidity data to Domoticz

Post by waltervl »

What is coming out of this URL from Vera? A json, a xml?
If you copy an example here, so we can help you.
It is perhaps also better to use DzVents (based on Lua) for easier coding and better support.

Edit: from the DzVents wiki below example that you could modify based on your situation (change url, json parameters, devices etc)

Asynchronous HTTP Request and handling
Suppose you have some external web service that will tell you what the current energy consumption is and you want that information in Domoticz:

Code: Select all

return {
    on = {
        timer = { 'every 5 minutes' },
        httpResponses = { 'energyRetrieved' }
    },
    execute = function(domoticz, item)
        if (item.isTimer) then
            domoticz.openURL({
            url = 'http://url/to/service',
            method = 'GET',
            callback = 'energyRetrieved'
            })
        elseif (item.isHTTPResponse) then
            if (item.ok) then -- statusCode == 2xx
                local current = item.json.consumption
                domoticz.devices('myCurrentUsage').updateEnergy(current)
            end
        end
    end
}
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest