Integrating IP Verso with HTTP and Rest API in OH3

Hello everyone,

I feel like I’m advancing with Openhab and my home automation as well, but at several points I fear I’m just missing too much knowledge.
Here is what I was trying to do for the last few days:

  1. Get my openhab to sound an alarm if the doorbell rings
  2. Add a button to open the door
  3. Popup of the video from the door camer in the OH3 visu

and I’m failing at step 1:

First try was the helios binding → It’s not working with OH3; the bug is reported (over a year ago), but no solution is in sight.

Second try: Send the info from the IP Verso to the Rest-API (I don’t really know what I’m doing there, so I startet with trying to send a plain text):

thing: (want it on the knx as well so this should do):

string-control     : EG_WF_IPVerso_Klingel_string                    "Klingel Erdgeschoss String" [ ga="23/5/51"]

item:

String    EGWFIPVersoKlingelString "Klingel erdgeschoss string"   {channel="knx:device:bridge:allg_virtual:EG_WF_IPVerso_Klingel_string"}

The Rest-Api for the item seems to be working

link	"http://192.168.178.42:80…EGWFIPVersoKlingelString"
state	"NULL"
stateDescription	{…}
editable	false
type	"String"
name	"EGWFIPVersoKlingelString"
label	"Klingel erdgeschoss string"
tags	[]
groupNames	[]

The automation within the verso does look like this (url is the one from the Rest-API, doesnt show the full path):

If I’m hitting the button on the bell I’m running into this error:

2021-11-30 20:34:04.575 [WARN ] [s.impl.WebApplicationExceptionMapper] - javax.ws.rs.ClientErrorException: HTTP 415 Unsupported Media Type

Any Ideas whats wrong?

The second step would be to send the json and get a switch status out of it - in which kind of item am I putting this? String?

If thats all not working, it should be possible to get the call status via the http-binding, but then I would have to pull the status every some seconds.

Regards
Alex

PS: If anyone has another working solution with OH3 I’m interested

It’s difficult to help you because you don’t show the complete URI. Maybe this comes from the On text parameter instead of ON.

Anyway, I use the following process for communicating between 2N devices and openhab 3.x. and it works flawlessly:

First I created a 2n user (via karaf console for example) and added an API token for this user.

I then used the following settings for the SendHttpRequest function of 2N automation:

  • URI: http://<replace by OH server IP>:8080/rest/items/<replace_by_item_name>/state to update the state, (or without the trailing /state for commands).
  • Username: API token created in openhab, looks like oh.2n.ABCDEFG…
  • Method: PUT for state updates, or POST for commands
  • Type: text/plain
  • Text: OPEN or CLOSED for the Contact oh items I update or a string from another automation function for the String oh item to which I send a command.
  • Password: field remains empty due to use of a token

This way I have an openHAB item that mirrors the door status (open or closed), linked to the 2N device input, and I have another item that receives a command for each identification on the door, to be further used in some rules. I assume getting the bell status is not much different and using the CallStateChanged automation function is the right entry point.

Hi Tarag,

thanks for the solution. I made several errors:

  • Using just the rest-api link without the /state
  • Using the openhab user (i thougt this would work as well)

using a string was just my easier way if i did write something wrong into the automation rule.
The solution is this so far:

  • Create an API token (works via UI and is documented in the Docu)
  • Create a Thing
Type switch-control     : EG_WF_IPVerso_Klingel     "Klingel Erdgeschoss" [ ga="1.001:23/5/50"]
  • Create an Item
Switch    EGWFIPVersoKlingel            "Klingel Erdgeschoss" {channel="knx:device:bridge:allg_virtual:EG_WF_IPVerso_Klingel"}

this is working so far. Now I’ll try to get that into the visu