New Teleinfo Binding - Tester and Feedback welcome

Hi all, @pakutz79, @srsr, @ysc,
Here is the new release (Beta 20191029-2235) : https://github.com/nokyyz/openhab2-addons/releases/tag/beta-20191029-2235
This release try to fix binding crashs on random I/O errors (see https://github.com/nokyyz/openhab2-addons/issues/7) and invalid/corrupted frame errors.

Any feedback will be welcome !

Hi @nokyyz
Thanks for your work !
I use your binding on openhab 2.5.0.M3 on docker with the previous (Alpha 20191015-1958) version. My teleinfo hardware is a Cartelectronic like @ysc. It works well but I noticed several issues/enhancements:

  • Same issue than @ysc [ERROR] [nternal.serial.TeleinfoReceiveThread] - Got invalid frame The groupLine seems corrupted (integrity not checked) during receiving. exiting thread.. I will try the new beta version next week.
  • Rules auto updating seems to be broken when using your binding: need a restart of my docker image to take into account modifications in my .rules files.
  • Could this binding directly support a ser2net device? For example with a device address like ip:port instead of /dev/ttyXXX. With that my docker image could be independent of the harware where he is running. Enocean binding seems to already support this.

Thanks @hollysaiqs for your feedback !

Yes, the beta-20191029-2235 version should fix this issue :slight_smile:

Iā€™m using OpenHAB 2.5.0-M1 on Docker (ā€˜openhab/openhab:2.5.0.M1-amd64-debianā€™ image). I will check it in the next few days. I am very surprised that this problem is due to my teleinfo bindingā€¦

I think OpenHAB supports the rfc2217 feature natively. If you want to try/test, I can update the binding configuration to replace Serial port dropdown list to a simple text field.
Ok ?

For my information, can you give me some details about your electricty meter ? single-phase or tree-phase ? your pricing option (Base, HC, Tempo, EJP) ?

Thx

Hi @nokyyz,

My electricity meter is single phased and my pricing option is HC.
A text field instead of dropdown list would be great!
No time to test the new version for the momentā€¦

Hi all, @pakutz79, @srsr, @ysc, @hollysaiqs
Here is the new release (Beta 20191104-2035) : https://github.com/nokyyz/openhab2-addons/releases/tag/beta-20191104-2035
Release note:

Any feedback will be welcome !

1 Like

Hi @nokyyz,
I am testing the new release and I am trying to have a working rfc2217 configuration. I receive this error:

[rial.TeleinfoSerialControllerHandler] - An error occurred during serial port connection. Detail: "gnu.io.UnsupportedCommOperationException"
org.eclipse.smarthome.io.transport.serial.UnsupportedCommOperationException: gnu.io.UnsupportedCommOperationException
	at org.eclipse.smarthome.io.transport.serial.rxtx.RxTxSerialPort.enableReceiveThreshold(RxTxSerialPort.java:157) ~[?:?]
	at org.openhab.binding.teleinfo.internal.serial.TeleinfoSerialControllerHandler.openSerialPortAndStartReceiving(TeleinfoSerialControllerHandler.java:176) [243:org.openhab.binding.teleinfo:2.5.0.201911041935]
	at org.openhab.binding.teleinfo.internal.serial.TeleinfoSerialControllerHandler.access$5(TeleinfoSerialControllerHandler.java:148) [243:org.openhab.binding.teleinfo:2.5.0.201911041935]
	at org.openhab.binding.teleinfo.internal.serial.TeleinfoSerialControllerHandler$1.run(TeleinfoSerialControllerHandler.java:89) [243:org.openhab.binding.teleinfo:2.5.0.201911041935]
	at java.util.TimerThread.mainLoop(Timer.java:555) [?:?]
	at java.util.TimerThread.run(Timer.java:505) [?:?]
Caused by: gnu.io.UnsupportedCommOperationException
	at gnu.io.rfc2217.TelnetSerialPort.enableReceiveThreshold(TelnetSerialPort.java:948) ~[?:?]
	at org.eclipse.smarthome.io.transport.serial.rxtx.RxTxSerialPort.enableReceiveThreshold(RxTxSerialPort.java:155) ~[?:?]
	... 5 more

Here is my ser2net.conf:
5001:telnet:0:/dev/ttyUSB0:1200 7DATABITS EVEN 1STOPBIT remctl

Where is my mistake?
Do I need to add something to my docker image configuration?

Hi @hollysaiqs,
I could not test the RFC2217 featureā€¦ After some searchs on this forum, have you try with RAW option instead of Telnet ? E.g:
5001:telnet:0:/dev/ttyUSB0:1200 7DATABITS EVEN 1STOPBIT remctl
->
5001:raw:0:/dev/ttyUSB0:1200 7DATABITS EVEN 1STOPBIT remctl

Hi @nokyyz,
With raw option, I receive this error:

[ERROR] [rial.TeleinfoSerialControllerHandler] - An error occurred during serial port connection. Detail: "gnu.io.UnsupportedCommOperationException"
org.eclipse.smarthome.io.transport.serial.UnsupportedCommOperationException: gnu.io.UnsupportedCommOperationException
	at org.eclipse.smarthome.io.transport.serial.rxtx.RxTxSerialPort.enableReceiveThreshold(RxTxSerialPort.java:157) ~[?:?]
	at org.openhab.binding.teleinfo.internal.serial.TeleinfoSerialControllerHandler.openSerialPortAndStartReceiving(TeleinfoSerialControllerHandler.java:176) [243:org.openhab.binding.teleinfo:2.5.0.201911041935]
	at org.openhab.binding.teleinfo.internal.serial.TeleinfoSerialControllerHandler.initialize(TeleinfoSerialControllerHandler.java:74) [243:org.openhab.binding.teleinfo:2.5.0.201911041935]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [133:org.openhab.core:2.5.0.M3]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [133:org.openhab.core:2.5.0.M3]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: gnu.io.UnsupportedCommOperationException
	at gnu.io.rfc2217.TelnetSerialPort.enableReceiveThreshold(TelnetSerialPort.java:948) ~[?:?]
	at org.eclipse.smarthome.io.transport.serial.rxtx.RxTxSerialPort.enableReceiveThreshold(RxTxSerialPort.java:155) ~[?:?]
	... 12 more

During my searchs I didnā€™t see anyone who succeeds in making rfc2217 worksā€¦ Everybody seems to use socat instead. Does rfc2217 actually work on openhab?

No idea :sweat_smile:
And what is the result with socat command ?

I have a working socat configuration in my openhab docker image. I have to manually launch the socat command inside the docker:

socat pty,link=/dev/ttyUSB21 tcp:192.168.0.21:5001,reuseaddr,keepalive,connect-timeout=5,keepcnt=5,keepidle=5,keepintvl=5

It seems to work because I can see teleinfo data when I launch cat /dev/ttyUSB21
Now openhab send me this error:

[ERROR] [rial.TeleinfoSerialControllerHandler] - No port identifier for '/dev/ttyUSB21'

Any idea?

[edit]
It works :grinning: with socat command

socat pty,link=/dev/ttyUSB21,raw,user=openhab,group=dialout,mode=777 tcp:192.168.0.21:5001,reuseaddr,keepalive,connect-timeout=5,keepcnt=5,keepidle=5,keepintvl=5
1 Like

Good job @hollysaiqs !

In this case, what is the value of Serial port parameter in Teleinfo Serial Configuration configuration ?

Thanks @nokyyz,
The value of Serial Port is /dev/ttyUSB21 (socat emulates an USB hardware). No need to have rfc2217 with socat, sorry for asking a functionality which was finally useless (for me).
I am currently trying to automate socat launching when running the docker image.

Is there any chance this binding will be official in openhab 2.5.0? Release seems to be closeā€¦

It remains to write the documentation (iā€™m struggling :neutral_face:), to merge/synchronize with the last source code of official openhab-addons github and then create a pull request :sweat:

So, what is the command line to broadcast your Teleinfo serial port on TCP/IP ? I think it would be interesting to specify it in the binding documentationā€¦

Quick summary of my configuration:

  • On computer where the teleinfo modem is plugged:
    • install ser2net: apt install ser2net
    • add the line 5001:raw:0:/dev/ttyUSB0:1200 7DATABITS EVEN 1STOPBIT remctl on the configuration file /etc/ser2net.conf. I think the remctl is useless with socat on the other side. /dev/ttyUSB0 is the serial port of my teleinfo modem.
    • Start the ser2net service with systemctl start ser2net and make it persistent at reboot with systemctl enable ser2net
  • On openhab computer:
    • Install socat: apt install socat

    • launch the command (I donā€™t know if options after port number 5001 are mandatory)

      socat pty,link=/dev/ttyUSB21,raw,user=openhab,group=dialout,mode=777 tcp:192.168.0.21:5001,reuseaddr,keepalive,connect-timeout=5,keepcnt=5,keepidle=5,keepintvl=5
      

      To be more robust to socat failure, I use this script:

       #!/bin/bash
       while true
         do
           socat pty,link=/dev/ttyUSB21,raw,user=openhab,group=dialout,mode=777 tcp:192.168.0.21:5001,reuseaddr,keepalive,connect-timeout=5,keepcnt=5,keepidle=5,keepintvl=5
           sleep 1
         done
      

      Since socat is not a system service, you have to launch it after each reboot.
      Your teleinfo device must be accessible from openhab on the /dev/ttyUSB21.

1 Like

The UnsupportedCommOperationException you are seeing is due to the fact that the RFC2217 library (specifically TelnetSerialPort) does not support the enableReceiveThreshold method (and also doesnā€™t support enableReceiveTimeout). Iā€™m not sure why they chose to throw an exception instead no-op, but the binding needs to be modified to catch and ignore that exception to have a chance of functioning with rfc2217 ports.

Hi
Using this binding works but intermittently ( I use a virtual serial port using VSPE connected to a serial port server on which the RS232 modem demodulating the electricity meter information is connected). May be you can help.
I have a second meter i would like to read. May be it is possible to have a second binding with another name?
Thanks for your help

Hi @Dids,
Have you try to add an another Ā« Teleinfo Serial Controller Ā» thing (from PaperUI > Inbox > Add (+) > Teleinfo binding > Add manually) ?

Perfect it works fine. Thanks

1 Like

Great :sunglasses: