This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Doorbell 2N IP (Intercom)
#1
Hello,
I am a novice in scripting. 
Is there Anyone that can help me in reading out my doorbell status to link to object in KNX?

My Dorrbell is the 2N IP Verso and it has its own HTTP API (Testtool).
I need the status of the relay switch or the validation of the rfid card. Both would work. 

My goal is following problem:
If the relay switch status of the doorbell turns to 'true' then the knx group adresss (boolean) should write to 'true'.

I can start with "https://<ip-adress>/api/switch/status?switch=1"  an request from the doorbell. The doorbell uses TLS and the type "digest" for https.
The response is:

Code:
{
  "success" : true,
  "result" : {
    "switches" : [
      {
        "switch" : 1,
        "active" : false,
        "locked" : false,
        "held" : false
      }
    ]
  }
}


With the automation manual for the http request it is possible to send an request from the doorbell.
https://wiki.2n.com/hip/auto/latest/en/4-akce-action

Is there already a solution for my question/problem?
Thanks!!

Attached Files Thumbnail(s)
   
Reply
#2
I've got my solution:

I activate the remote service and use the remote http code:

"https://remote:remote@192.XXX.XX.XX/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=write&alias=1/1/2&value=true"

I just used it in the automation of the 2N IP Doorbell. Just stupid i am.
How simple...

Works fine for me!
Reply
#3
(30.01.2022, 13:23)KNXSeb Wrote: I've got my solution:

I activate the remote service and use the remote http code:

"https://remote:remote@192.XXX.XX.XX/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=write&alias=1/1/2&value=true"

I just used it in the automation of the 2N IP Doorbell. Just stupid i am.
How simple...

Works fine for me!

Hello there! I am trying the same but without success

What i am missing?

Attached Files Thumbnail(s)
   
Reply
#4
Did you enable remote services and did you export the object you are trying to write too?
Also enable Send Basic auth header in Remote services.
------------------------------
Ctrl+F5
Reply
#5
(30.06.2025, 07:46)Daniel Wrote: Did you enable remote services and did you export the object you are trying to write too?
Also enable Send Basic auth header in Remote services.

Yes, the point is the url works in a browser, then the LM works.

But i cannot make it works from 2n sending the http requests....
Reply
#6
Then you should contact 2N for support.
------------------------------
Ctrl+F5
Reply
#7
I would make it a GET request and put the text part after the URL
Reply
#8
(30.06.2025, 11:05)Erwin van der Zwart Wrote: I would make it a GET request and put the text part after the URL

I Would try! Thankyou all!
Reply
#9
Good afternoon,
I am trying to set up this integration to know from the Logic Machine when there is an access attempt or an authorized access, and I’ve been communicating with 2N for several days. However, the conclusion they reach is that the Logic Machine redirects with a 302 and requests authentication. I’ve been running several tests and sending them the logs from the 2N device, but there’s no way to make it work.
I’m attaching a screenshot so you can see the configuration that I also sent to j.martinez. Did you manage to get it working?
2N is asking me to modify the Logic Machine API, but I know there must be something in the 2N access controller, because it should work with the same parameters as a normal POST.
The URL you see in the image is:
http://192.168.2.205/login?ref=scada-remote
The text/plain is:
m=json&r=grp&fn=write&alias=35/1/12&value=Prueba2N
I have tried several approaches — putting username, password and body in the URL; only body with username and password separately… but nothing works.

   
Reply
#10
(11.09.2025, 13:37)DGrandes Wrote: Good afternoon,
I am trying to set up this integration to know from the Logic Machine when there is an access attempt or an authorized access, and I’ve been communicating with 2N for several days. However, the conclusion they reach is that the Logic Machine redirects with a 302 and requests authentication. I’ve been running several tests and sending them the logs from the 2N device, but there’s no way to make it work.
I’m attaching a screenshot so you can see the configuration that I also sent to j.martinez. Did you manage to get it working?
2N is asking me to modify the Logic Machine API, but I know there must be something in the 2N access controller, because it should work with the same parameters as a normal POST.
The URL you see in the image is:
http://192.168.2.205/login?ref=scada-remote
The text/plain is:
m=json&r=grp&fn=write&alias=35/1/12&value=Prueba2N
I have tried several approaches — putting username, password and body in the URL; only body with username and password separately… but nothing works.

Hello DGrandes!!

The point is 2N devices didn't works with http request with headers where the user and password is sended...... 2N says they will includes headers to work with ASAP..... for that reason i used other way script they don't use passwords until we could do it in a safest way....

   


The http request 2n module point to a url like: http://LM_IP/public/write.lp?addr=9/1/1&value=0 

Check this--> https://forum.logicmachine.net/printthread.php?tid=3141
Reply
#11
Try this: install 2025 RC firmware and enable "Send Basic auth header" in System config > Services > Remove services.
Reply
#12
(11.09.2025, 14:05)admin Wrote: Try this: install 2025 RC firmware and enable "Send Basic auth header" in System config > Services > Remove services.

Thank you very much! 

I’m going to try it.
Reply
#13
(22.09.2025, 09:03)DGrandes Wrote:
(11.09.2025, 14:05)admin Wrote: Try this: install 2025 RC firmware and enable "Send Basic auth header" in System config > Services > Remove services.

Thank you very much! 

I’m going to try it.

Hi,

Activating “Send Basic auth header” on the reqbin.com page works the same as before, but from the 2N server it doesn’t work.
I also tried creating the file “write.lp” and placing it inside the public folder, accessing with "apps" user, but it doesn’t work even from reqbin.com, although it does respond with “200 OK” when I make the GET/POST request. With GET and POST it responds OK, but it doesn’t write anything to address 35/1/12.

2nd method URL: http://192.168.2.205/public/write.lp?add...value=Test
Reply
#14
What is the contents of write.lp file?
Reply
#15
(22.09.2025, 10:43)admin Wrote: What is the contents of write.lp file?

This is the code:
Code:
<?
require('apps')
addr = getvar('addr') or ''
value = getvar('value') or ''
value = json.pdecode(value)
if type(value) ~= nil then
  grp.write(addr, value)
end
Reply
#16
Value must be a valid JSON. Strings must be enclosed in double quotes.
Reply
#17
(22.09.2025, 14:25)admin Wrote: Value must be a valid JSON. Strings must be enclosed in double quotes.

Good afternoon,
That is not the issue. I’ve changed the script to analyze what the Logic Machine returns, and for some reason, it only receives the first variable within the string. If I put addr first, it receives addr, and if I put value first, it receive value (without "").

With this write.lp:
Code:
<?
require('apps')
addr = getvar('addr') or ''
value = getvar('value') or ''

print("Addr: ", addr)
print("Value: ", value)
print("Type: ", type(value))

if value then
    print("Value: ", value)
    grp.write(addr, value)
end

If I send "http://192.168.2.205/public/write.lp?value=test&addr=35/1/12"
Response:
Code:
HTTP/1.1 200 OK
cache-control: no-store
connection: keep-alive
content-type: text/html; charset=utf-8
date: Mon, 22 Sep 2025 15:48:28 GMT
permissions-policy: autoplay=self,fullscreen=self
referrer-policy: same-origin
transfer-encoding: chunked
x-content-type-options: nosniff

Addr:
Value: test
Type: string
Value: test

If I send "http://192.168.2.205/public/write.lp?addr=35/1/12&value=test""
Response:
Code:
HTTP/1.1 200 OK
cache-control: no-store
connection: keep-alive
content-type: text/html; charset=utf-8
date: Mon, 22 Sep 2025 15:49:12 GMT
permissions-policy: autoplay=self,fullscreen=self
referrer-policy: same-origin
transfer-encoding: chunked
x-content-type-options: nosniff

Addr: 35/1/12
Value:
Type: string
Value:

If i send "http://192.168.2.205/public/write.lp?value=1"

Response:
Code:
HTTP/1.1 200 OK
cache-control: no-store
connection: keep-alive
content-type: text/html; charset=utf-8
date: Mon, 22 Sep 2025 15:51:48 GMT
permissions-policy: autoplay=self,fullscreen=self
referrer-policy: same-origin
transfer-encoding: chunked
x-content-type-options: nosniff

Addr:
Value: 1
Type: string
Value: 1

If i send "http://192.168.2.205/public/write.lp?addr=35/1/12&valor="Test" (or 'Test')
Response:
Code:
HTTP/1.1 200 OK
cache-control: no-store
connection: keep-alive
content-type: text/html; charset=utf-8
date: Mon, 22 Sep 2025 15:55:35 GMT
permissions-policy: autoplay=self,fullscreen=self
referrer-policy: same-origin
transfer-encoding: chunked
x-content-type-options: nosniff

Addr: 35/1/12
Value:
Type: string
Value:
Reply
#18
In last URL you have "valor" instead of "value".

Argument order does not matter:
Code:
> curl 'http://192.168.1.16/public/write.lp?addr=35/1/12&value=test'
Addr: 35/1/12
Value: test
Type: string
Value: test

> curl 'http://192.168.1.16/public/write.lp?value=test&addr=35/1/12'
Addr: 35/1/12
Value: test
Type: string
Value: test

Same thing when testing via browser.

If you call grp.write(addr, value) without decoding value as JSON then string values don't need to be escaped. But then if you send "false" the resulting value will be true because the input is not a boolean but a string (1/0 can be used instead). Sending complex values like date/time won't be possible as well.
Reply
#19
(23.09.2025, 08:17)admin Wrote: In last URL you have "valor" instead of "value".

Argument order does not matter:
Code:
> curl 'http://192.168.1.16/public/write.lp?addr=35/1/12&value=test'
Addr: 35/1/12
Value: test
Type: string
Value: test

> curl 'http://192.168.1.16/public/write.lp?value=test&addr=35/1/12'
Addr: 35/1/12
Value: test
Type: string
Value: test

Same thing when testing via browser.

If you call grp.write(addr, value) without decoding value as JSON then string values don't need to be escaped. But then if you send "false" the resulting value will be true because the input is not a boolean but a string (1/0 can be used instead). Sending complex values like date/time won't be possible as well.

The only way the string is accepted is like 3th option:
Code:
>curl "http://192.168.2.205/public/write.lp?addr=35/1/12&value=test"
Addr: 35/1/12
Value: nil
Type: nil

C:\Users\DGRANDES>curl "http://192.168.2.205/public/write.lp?addr=35/1/12&value='test'"
Addr: 35/1/12
Value: nil
Type: nil

>curl "http://192.168.2.205/public/write.lp?addr=35/1/12&value=\"hola\""
Addr: 35/1/12
Value: hola
Type: string

Thanks!
Reply


Forum Jump: