Read serial data in OH2 sent over wifi by a local device

I have installed an inverter (local IP: 192.168.1.3, “local station” mode) factory pre-programmed to send data (numbers + info text) over wifi to a remote location (www.remote.com, via port: 80 // I can change this address and port anyway) via my local router. These data arrived succesfully to that remote destination but I cannot have any control over that database to read/sync etc.

So I want to gather these data too in my local OH2 (RPI). Could you help me with some steps about how to approach that project?

It might work, but could be tricky. At first you need to figure out what sort of request that gets sent and to what path. Since it sends to port 80 it’s most probably http, but that’s all we know.

A possible approach would be to install nginx (or another http server), make your inverter send data to it and just check the access log. There you should be able to see the method (GET, POST or PUT) and path.

If you can get this far we can determine what more steps that need taken.

The TCP binding will probably be useful.

I’m trying with HTTP biding now.

# 3 // get RS232 Serial data from inverters
inverter01.url=http://192.168.1.3
inverter01.updateInterval=5000
Number Inverter01Event { http="<[inverter01:1000:($.voltage.[0])]" }

No able to read anything.

The http binding is just for sending requests, it cannot listen for requests from other devices. The TCP binding that @rossko57 suggested can both act as client and server, so it can listen for incoming connections.

OK, I’ve installed TCP.
I’ve create my.map:

ON= *S,0,2,01; 
OFF = *C,0,2,01; 

Than edit my.items file:

Number InverterEvent tcp=">[ON:192.168.1.3:3000:'MAP(my.map)')], >[OFF:192.168.1.3:3000:'MAP(my.map)']"```

I cannot see any piece of information after add this in my.sitemap file:

Frame label=""{
		Text item=InverterEvent label="Inverter: [%s]" labelcolor=[""]

	}

You have configured the item to send data TO your inverter, not to listen for data FROM your inverter, which is what you wanted, no? And what is the map transformation supposed to represent?

Slow down. Map? Just find out what your mystery data is first. Do you even know if it is TCP yet?

What about point the inverter to your PC and use Wireshark to see what is beeing sent :slight_smile:

Here is one way of doing such things that might inspire you.

1 Like