hekmon / linkytic

Linky TIC support for Home Assistant
MIT License
45 stars 11 forks source link

Use `serial_for_url` for serial port, allowing rfc2217 #4

Closed xouillet closed 1 year ago

xouillet commented 1 year ago

Hi,

As my the serial port connected to my Linky is connected to another host than the one running home-assistant, I nedded to use rfc2217 which is supported by pyserial, via the serial_for_url method (cf. https://pyserial.readthedocs.io/en/latest/url_handlers.html)

Moreover, serial_for_url can be used as a drop-in replacement for standard Serial constructor, that's what is done in this PR.

As an example, the home assistant yaml can now contains:

lixeeticdin:
  serial_port: rfc2217://192.168.1.254:10000?ign_set_control
hekmon commented 1 year ago

I was not aware of such possibility, thank you for your input !

Could I ask a few modifications before merging it ?

Once merged, I will release a 3rd beta with it :)

Thanks again !

xouillet commented 1 year ago

Oh, I wasn't aware a v2 is on the way, nice !

I've made the changes, and tested it on my installation, with the new config flow, it works ok.

I took the liberty to add my device in the README in a separate commit but the same PR, I can create a separate PR for this if you want.

hekmon commented 1 year ago

No that's fine the way it is, do not worry. Still have to test it before tagging it and release the 3rd beta. Will do asap.

Thanks again !