mrwiwi / tydom2mqtt

Link between a Delta Dore's Tydom Hub and and a MQTT broker, unofficial of course.
MIT License
28 stars 17 forks source link

tydom2mqtt is failing to start when no tty #40

Closed fmartinou closed 2 years ago

fmartinou commented 2 years ago

tydom2mqtt fail starting if no tty is enabled. Example failing

$ docker run -e TYDOM_MAC="xxx" ... --rm mrwiwi/tydom2mqtt_edge

Starting main.py <-- stuck here

Example working

$ docker run -t -e TYDOM_MAC="xxx" ... --rm mrwiwi/tydom2mqtt_edge

Starting main.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
STARTING TYDOM2MQTT
Dectecting environnement......
...

It's caused by the Popen in forever.py.

Generally speaking, I don't think that handling uncaught errors in an uber Python process for automatic restart is a good practice. Especially when working in containerized environments 🤔

Better use --restart Docker option to handle automatic restart on crash.

You can find here the related commit on my fork.

mrwiwi commented 2 years ago

Hi @fmartinou ! Big thanks to take upon that project, you seems way more skilled that I am and I'm glad ! The forever py was a dirty workaround before home assistant introduced the watchdog. Could you please take the lead on a proper add-on (if you use home assistant) ? I did what I could be don't have time and skills, I started that project just for my needs, with no experience in coding so...

fmartinou commented 2 years ago

Hi @mrwiwi,

I'm using Home-Assistant but unfortunately, I'm not using Hass.io so I don't know much about Supervisor, addons and so on. I don't really know what an addon should look like and don't know how to test it 🤔 .

I'll take some time to know more about all that and I'll let you know if I think I can be helpful.

Thanks again for your project! I'm now able to control my heating system from Home-Asssistant 🤩 !

mrwiwi commented 2 years ago

You should try a supervised install ! Big advantage is backup/logs/installation of everything in HA, and add-ons are just docker containers integrated in HA ! You can check my add-on for tydom2mqtt, with your skills I'm pretty sure you will figure it out very quickly !

mrwiwi commented 2 years ago

I've just installed your add-on, that's great, lighter indeed ! I think all users should switch to your fork now, what do you think ?

fmartinou commented 2 years ago

Hi,

I'm currently working on that :) You were right; addon publishing is not that hard 😃

I'm going to create an external addon repository because I'm planning to deploy 2 other addons in addition to tydom2mqtt:

Please give me few additional days and existing users should be able to switch to my fork 😄

Besides that, would you be interesting to join me as developer on my fmartinou/tydom2mqtt fork?

Because I now about Docker, Code quality, automation... but I don't know much about Deltadore stuff (and I have almost no Deltadore devices at home) 🤔

mrwiwi commented 2 years ago

I'm in ! ^^ I just have covers and alarm, but I begin to know pretty well the tydom box and websockets ;D

fmartinou commented 2 years ago

Invitation sent; welcome on board!

fmartinou commented 2 years ago

Hi @mrwiwi ,

I created a static documentation (hosted on Github pages) for the project: https://fmartinou.github.io/tydom2mqtt/ The source files (markdown files) are right next to the source code.

In addition, I created the first release on my fork (2.0.0) and referenced it into my new hass.io addons repository

Could you give it a try? (The repository to add to your Home-Assistant instance is https://github.com/fmartinou/hassio-addons.git)

Thanks!

fmartinou commented 2 years ago

Voici mon adresse mail. Ce sera peut-être plus simple pour échanger entre nous en dehors de Github : @.***

Cdt

Le mer. 24 nov. 2021 à 14:22, William Friconneau @.***> a écrit :

I'm in ! ^^ I just have covers and alarm, but I begin to know pretty well the tydom box and websockets ;D

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mrwiwi/tydom2mqtt/issues/40#issuecomment-977873635, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD2RGL3HCUTTPRD3MJTBNU3UNTRJLANCNFSM5IRPYQ6Q .

-- Manfred Martin

mrwiwi commented 2 years ago

That's awesome !!! Hassio add-on working perfectly here, except for MQTT default value : localhost doesn't work, but "homeassistant" do !

The documentation, the icon... Wow it feels like an professional project :D thanks a lot !

fmartinou commented 2 years ago

Hi!

Thanks for your support!

default value : localhost doesn't work, but "homeassistant" do

Oh yeah, I get it.

By default, addons are running in the same network as homeassistant (see host_network)

So on localhost, there is no MQTT_broker.

=> I changed the default value.