TheAgentK / tuya-mqtt

Nodejs-Script to combine tuyaapi and openhab via mqtt
MIT License
173 stars 81 forks source link

Docker setup for tuya-mqtt #45

Closed Trauma closed 3 years ago

Trauma commented 3 years ago

A small contrib to add handy config files to build and run tuya-mqtt within docker a container

tsightler commented 3 years ago

I'm going to close this PR for now. I do plan to add Docker support in the future, but it will be done slightly differently (I think) and, while I may implement a status option for the script in a future version, it will not be done in the same way as what the patches from mbronk do (i.e. it will not be an option) as I just don't agree with the implementation.

Trauma commented 3 years ago

Ho, sorry didn't realised that merging this in my fork's master will update this MR. I was not intending to insist on mbronk's MR at all. I should have merge it in a separate branch...

I perfectly understand your opinion about that, but I have to admit that tasmosta's implementation behave like this and is really stable for my use case, and so it seems right/logical to me that tuya-mqtt can behave the same, or at least give an opportunity for users to configure this to behave the same as tasmota.

Anyway you've got the point, I was about to ask you if you still plan to fix the status topic update bug when HA status change is detected. I'm facing lot's off instability with HA/tuya-mqtt integration by this days, and while I didn't really took the time to troubleshoot the root cause, I did stumble on @mbronk's MR and decided to give it a try.

About the docker support, I'll be interested in your implementation plans. I can not see any big issue with my MR, despite the lack of documentation :), comments are welcome !

tsightler commented 3 years ago

No issue. I don't really think it's a valid analog to compare Tasmota to tuya-mqtt. For Tasmota each device maintains it's own unique connection to the broker so you can assume that if the device has an active connection it's online. For tuya-mqtt that's simply not true, the script could absolutely have a connection to the broker while some devices are offline due to no active connection so the script has to maintain the status of each device.

I'm open to implementing a separate status, based on LWT, for the scripts connection to the broker, but that's largely useless for Home Assistant, which would still depend on the actual device status, not on the scripts connection status. The goal of the current tuya-mqtt device level status function is to show if the tuya device is online and tuya-mqtt is able to communicate with it, it's not to show if tuya-mqtt has a connection to the broker.

I do have a fix queued up for the current failure to republish online state, it's just a single line, so no big deal, this project has simply taken a backseat lately.

And there's not much different between what I will implement and what you had from a Docker perspective, just some small code changes to look for configs in a specific mounted path when running in Docker, nothing world changing. I just need to get the time to get these, and the handful of other fixes I have, queued up and pushed. Hopefully in the next week.