We have moved at community.getvera.com

Author Topic: get data from one vera lite to other vera lite  (Read 494 times)

Offline huib

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
get data from one vera lite to other vera lite
« on: December 25, 2018, 09:46:48 am »
Transfer data from one VERA LITE (UI7) to VERA LITE (UI5)

I am running two vera lite at the same time (in the same network;
a)   One veralite UI5 with standard apps (lighting etc) and a number of homemade applications
One application is the dutch smart meter with internet connection of the isk5meter
(fixed ip address with fixed gateway)

b)   I have added a new vera lite running on UI7
With openterm gateway for the heating system (fixed ip address with fixed gateway)
All running smooth for a while separately.

Now i have moved the dutch smart meter to the UI7 unit and made connection to the iska meter with fixed ip and fixed gate.

I have two questions on which would like some advise;

Can I sent the following data

UI7(192.168.2.55)    >UI5(192.168.2.100)
SM_ImporT1(KWH)         ImportRate 1 (KWH),
SM_ImporT2(KWH)         ImportRate 2 (KWH)
SM_ExporT1(KWH)         ExportRate 1 (KWH)
SM_ExporT2(KWH)         ExportRate2  (KWH)
SM_ImporGAS            Gas

Is it better to sent to from the UI7 or read it from UI5 and what to use
My preference is to read the info from the UI5 from the UI7

You advice is much appreciated
Huib


- veralite UI5 - veralite UI7 - 9 fibaro dimmers - 7 fibaro switches - 2 eminent movement sensors - remote control - opentherm gateway - remote powermeter reading - control of whr930 unit - control of washing machine -

Offline huib

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Re: get data from one vera lite UI7 to other vera lite UI5
« Reply #1 on: December 26, 2018, 05:09:49 am »
after reading several posts on this forum i got the following;

xxx.xxx.x.xx:3480/data_request?id=variableget&DeviceNum=14&id=variableset&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KHW
if i test i get the respond "OK", so something happens


after reading and trying i came up with the following,but it does not work;
local status, result = luup.inet.wget("http://xxx.xxx.x.xx:3480/data_request?id=variableget&DeviceNum=14&id=variableset&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KHW " ,3)


so some advise is helpfull
regards
Huib
- veralite UI5 - veralite UI7 - 9 fibaro dimmers - 7 fibaro switches - 2 eminent movement sensors - remote control - opentherm gateway - remote powermeter reading - control of whr930 unit - control of washing machine -

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: get data from one vera lite UI7 to other vera lite UI5
« Reply #2 on: December 26, 2018, 10:24:21 am »

after reading and trying i came up with the following,but it does not work;
local status, result = luup.inet.wget("http://xxx.xxx.x.xx:3480/data_request?id=variableget&DeviceNum=14&id=variableset&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KHW " ,3)

Your request specifies the "id" parameter twice, so it's likely getting clobbered. Try:

Code: [Select]
local status, result = luup.inet.wget("http://xxx.xxx.x.xx/port_3480/data_request?id=variableget&DeviceNum=14&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KHW " ,3)
Also note that using the ":3480" port specifier will likely stop working at some future date; the replacement form is to use the /port_3480/ path.

Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline huib

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Re: get data from one vera lite to other vera lite
« Reply #3 on: December 27, 2018, 03:30:44 am »
@rigpapa

I have the following in a loop code but the file is not implementing, due to error in this part.
 
===
local http = require("socket.http")
local status, low = luup.inet.wget("http://xxx.xxx.x.xx/port_3480/data_request?id=variableget&DeviceNum=14&output_format=text&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KWH")
luup.variable_set("urn:Kuiper-com:serviceId:dutchSmartMeterCounter", "Low", Low, 94)
===

== running atUI5 (device 94 is dutchSmartMeterCounter)
Variable low is value to be taken from UI7 to UI5

== source running at UI7
Device 14 is dutchsmartmeter running at other vera

if i try the following if is working;
xxx.xxx.x.xx/port_3480/data_request?id=variableget&DeviceNum=14&output_format=text&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KWH >> gives the correct value

can you advise?

regards
Huib
- veralite UI5 - veralite UI7 - 9 fibaro dimmers - 7 fibaro switches - 2 eminent movement sensors - remote control - opentherm gateway - remote powermeter reading - control of whr930 unit - control of washing machine -

Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: get data from one vera lite to other vera lite
« Reply #4 on: December 27, 2018, 08:01:20 am »
Your variable is called "low", not "Low".

Details matter.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline huib

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Re: get data from one vera lite to other vera lite
« Reply #5 on: December 27, 2018, 02:52:57 pm »
@akboer
you are correct the details matters.

if i enter in the url xxx.xxx.x.xx/port_3480/data_request?id=variableget&DeviceNum=14&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KWH_frac i get direct the respond of the value

if i use
===
luup.log("dutchSmartMeterCounter import started")
local http = require("socket.http")      
local Status, LowMeter  = luup.inet.wget("http://xxx.xxx.x.xx/port_3480/data_request?id=variableget&DeviceNum=14&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=KWH_frac",3)
luup.log("dutchSmartMeterCounter import completed")
===
i got the following in the log file

01   12/27/18 19:38:19.051   _[31;1mLuImplementation::StartLua skipping device 94 implementation valid 1_[0m <0x2bb9d680>

if i remove the line Local Status ===,3)
the file is implemened.
can it be that i am working on the internet in stead of local in the same network?

your advise is helpfull
regards
Huib
- veralite UI5 - veralite UI7 - 9 fibaro dimmers - 7 fibaro switches - 2 eminent movement sensors - remote control - opentherm gateway - remote powermeter reading - control of whr930 unit - control of washing machine -

Offline huib

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Re: get data from one vera lite to other vera lite
« Reply #6 on: December 28, 2018, 09:55:29 am »
@ akboer

if i read on the wiki
==
function: wget
parameters: URL (String), Timeout (Number), Username (String), Password (String)
returns: operationStatusCode (Number), content (String), httpStatusCode (Number)

This reads the URL and returns 3 variables: the first is a numeric error code which is 0 if successful. The second variable is a string containing the contents of the page. The third variable is the HTTP status code. If Timeout is specified, the function will timeout after that many seconds. The default value for Timeout is 5 seconds. If Username and Password are specified, they will be used for HTTP Basic Authentication
==
it gives thee responds,

so should it not be
local operationStatus , LowMeter , httpStatus = luup.inet.wget ____
instead of
local Status, LowMeter = luup.inet.wget ____
 
regards
Huib

- veralite UI5 - veralite UI7 - 9 fibaro dimmers - 7 fibaro switches - 2 eminent movement sensors - remote control - opentherm gateway - remote powermeter reading - control of whr930 unit - control of washing machine -

Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: get data from one vera lite to other vera lite
« Reply #7 on: December 28, 2018, 06:45:03 pm »
If you don't actually check the status return value(s) then it really doesn't matter.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.