ebaauw / homebridge-p1

Homebridge plugin for DSMR end-consumer (P1) interface
Apache License 2.0
53 stars 11 forks source link

ser2net and homebridge-P1 #77

Closed rgrs83 closed 1 year ago

rgrs83 commented 1 year ago

Hi,

I am using the docker version of homebridge and I am running ser2net on a different machine (for sharing the dsmr telegrams to different applications). Is homebridge-P1 able to use this, using the relay settings?

At the moment I added the following at the relay settings: Websocket port= empty Host: ip:23 (as per description)

Log: [P1] warning: Parse Error: Expected HTTP/ [P1] disconnected from ws://192.168.188.6:23/data

Ser2net uses telnet for connecting to it and has the following config loaded: define: &banner \r\nser2net port \p device \d [\B] (Debian GNU/Linux)\r\n\r\n

connection: &usb accepter: tcp,23 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 115200n81,local

ebaauw commented 1 year ago

The web socket is for setups where Homebridge P1 relays the P1 data to another instance of Homebridge P1. I created this originally for testing, before I had ser2net setup. To connect to the P1 cable over ser2net, set serialport to hostname:port of the ser2net socket. See https://github.com/ebaauw/homebridge-p1/wiki/Multiple-Concurrent-Connections-to-the-Smart-Meter#using-ser2net-as-relay.

I use the following configuration in ser2net.conf:

2000:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT max-connections=3

This is for a DMSR v5 smart meter, connected to /dev/ttyUSB0 on my Raspberry Pi. The max-connections is to allow multiple clients to connect to the port simultaneously (it's read-only, so no conflicts). Here I use port 2000; it's best to use a port > 1024, and definitely not 23 (which is for a Telnet server). Also, you probably don't want to use a banner, as Homebridge P1 won't appreciate one and issue another "ignoring invalid telegram" warning.

Ser2net uses telnet for connecting to it

Not quite, but you can use the telnet client to check that ser2net has been setup correctly. Unfortunately, this has been removed from most systems, as it sends passwords in clear text when logging in remotely.

rgrs83 commented 1 year ago

Thank you, that did the trick!

Eve is reporting the correct values. Homekit reports nothing. That is as expected?

ebaauw commented 1 year ago

That’s technically impossible - Eve gets the values through HomeKit.

As I mention in the README, Apple’s Home app doesn’t support all of HomeKit.