On a project I’m working on, we have a kNX switch that shall open a lock, in the main door of a house. The video intercom device is a Zennio Getface IP. I want to use the LM5 lite that I already have, to be used as a gateway. To my knowledge the Zennio Getface Ip has Http Api license installed.
Is it possible to do? And if so can someone help me?
LM5 ip: 192.168.1.103
Zennio Getface ip: 192.168.1.101
(15.05.2018, 08:39)admin Wrote: Do you have documentation on HTTP API? Sending requests via HTTP is simple, but without documentation there's nothing we can help with.
Hi, I can`t find anything on Zennio Gatface Ip documentation, but on 2N who is the manufacture i found this:
Attach this code to an event script (boolean object). It will contol switch 1 depending on object value. Make sure that Switch API is enabled without encryption and authentication. log(...) call at the end should be removed if script is working correctly.
Code:
require('socket.http')
switch = 1
value = event.getvalue()
if value then
action = 'on'
else
action = 'off'
end
(16.05.2018, 12:38)admin Wrote: Attach this code to an event script (boolean object). It will contol switch 1 depending on object value. Make sure that Switch API is enabled without encryption and authentication. log(...) call at the end should be removed if script is working correctly.
Code:
require('socket.http')
switch = 1
value = event.getvalue()
if value then
action = 'on'
else
action = 'off'
end
State has to be polled so you need a resident script. Adjust sleep time as needed, but do not use 0 as it will consume all CPU.
Uncomment and modify grp calls depending on how many inputs are used.
Code:
require('json')
require('socket.http')
res, err = socket.http.request('http://192.168.1.101/api/io/status')
if res then
data = json.pdecode(res)
if type(data) == 'table' then
ports = data.result.ports
log(ports)
-- grp.checkwrite('1/1/1', ports[ 1 ].state)
-- grp.checkwrite('1/1/1', ports[ 2 ].state)
else
alert('failed to decode data')
end
else
alert('http request failed ' .. tostring(err))
end
(18.05.2018, 08:07)admin Wrote: State has to be polled so you need a resident script. Adjust sleep time as needed, but do not use 0 as it will consume all CPU.
Uncomment and modify grp calls depending on how many inputs are used.
Code:
require('json')
require('socket.http')
res, err = socket.http.request('http://192.168.1.101/api/io/status')
if res then
data = json.pdecode(res)
if type(data) == 'table' then
ports = data.result.ports
log(ports)
-- grp.checkwrite('1/1/1', ports[ 1 ].state)
-- grp.checkwrite('1/1/1', ports[ 2 ].state)
else
alert('failed to decode data')
end
else
alert('http request failed ' .. tostring(err))
end
You access the same URL (http://192.168.1.101/api/io/status) in your browser and check whether input states change or not.
Error checking can be improved like this:
Code:
if type(data) == 'table' and type(data.result) == 'table' and type(data.result.ports) == 'table' then
ports = data.result.ports
18.05.2018, 10:40 (This post was last modified: 18.05.2018, 10:43 by Evens.)
(18.05.2018, 09:32)admin Wrote: You access the same URL (http://192.168.1.101/api/io/status) in your browser and check whether input states change or not.
Error checking can be improved like this:
Code:
if type(data) == 'table' and type(data.result) == 'table' and type(data.result.ports) == 'table' then
ports = data.result.ports
Hi,
When using the url, i see that all innputs work like they should.
I think the problem is the port number, it doesn`t seem to match the input correctly.
Do you have an idea?
BR Even.
(18.05.2018, 10:40)Evens Wrote:
(18.05.2018, 09:32)admin Wrote: You access the same URL (http://192.168.1.101/api/io/status) in your browser and check whether input states change or not.
Error checking can be improved like this:
Code:
if type(data) == 'table' and type(data.result) == 'table' and type(data.result.ports) == 'table' then
ports = data.result.ports
Hi,
When using the url, i see that all innputs work like they should.
I think the problem is the port number, it doesn`t seem to match the input correctly.
it did work, i just didn`t change the port number.
it was on 1 and 2 and i didn`t change it. so when changing to 4 and 7 it worked perfectly.
the reason why it worked on 2 is becouse relay 1 is linked to ext.input 1 in the getface.
[1] led_secured
[2] relay1
[3] output1
[4] input1
[5] ext1.relay1
[6] ext1.relay2
[7] ext1.input1
[8] ext1.input2
23.10.2023, 11:12 (This post was last modified: 23.10.2023, 11:39 by khalil.)
(16.05.2018, 12:38)admin Wrote: Attach this code to an event script (boolean object). It will contol switch 1 depending on object value. Make sure that Switch API is enabled without encryption and authentication. log(...) call at the end should be removed if script is working correctly.
Code:
require('socket.http')
switch = 1
value = event.getvalue()
if value then
action = 'on'
else
action = 'off'
end
Hello dear Admin
If I want to do the job reverse, means I want to receive a command/trigger from the Getface IP, what is the http command from the zennio getface should look like?
(22.07.2024, 10:39)admin Wrote: Try removing remote:remote from the URL. Or put correct user:pass into the URL and keep the Username and Password fields empty.
Didn't work!
while when I try from the browser its bring the default webpage with user name and password when entered the command triggered, while both SL and Zennio are on the same VLAN and I tried to connect my laptop on the same cable of the zennio intercom and its worked.
but from zennio its not working!
How to check the http command comes out from zennio?
Could it be monitored from LM, or I need Wireshark?
If Wire shark needed what filters should I use?
You can use Wireshark but then you need configure Zennio to send requests to your PC IP address instead of LM. You will also need to run a HTTP server on your PC. You can use this one, but keep in mind that default port is 1180 not 80 when configuring Zennio.
In Wireshark set filter to ip.src==IP where IP is Zennio IP address.