Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for MQTT management or discovery #22

Open
shevett opened this issue Mar 15, 2021 · 5 comments
Open

No support for MQTT management or discovery #22

shevett opened this issue Mar 15, 2021 · 5 comments

Comments

@shevett
Copy link

shevett commented Mar 15, 2021

I have been rolling Tasmota devices into my home network for a bit now, and was pleased to see that tasmota-connect allowed me to add a tasmota device to Smartthings. However, the code as it stands now does not support MQTT management of Tasmota devices. This is a serious limitation.

As it stands now, to add a new device, you use the app on the phone to add the devices fixed IP address, login information, and device type. This has a number of drawbacks:

  • If the IP address of the device changes, you must reconfigure the device in the smart app.
  • Theres no way to determine if a new device was added to the network without manually adding it to the smartapp
  • When going beyond a small handful of devices, this level of management becomes unwieldy.

Fortunately, Tasmota supports using MQTT for device management. This is not the 'bridge' model that is used by some interfaces to control devices via MQTT commands. Tasmota uses the pub/sub model to collect, query, and control devices via MQTT topics.

As noted here: https://tasmota.github.io/docs/MQTT/ "MQTT is the main protocol for controlling Tasmota devices"

For Tasmota-connect to scale properly, it needs to have MQTT support added. This would make management of devices infinitely easier, and would not require tremendous changes.

There are several examples on the net of using MQTT via Groovy to communicate with Tasmota devices. As a first easy-to-define function, I'd suggest looking at using the HomeAssistant discovery model to query MQTT to list Tasmota devices. Any devices that come back from that query get added to the device list in Tasmota connect. This would go a LONG way to making management easier.

Once discovery mode is enabled, command and control can shift from direct socket connect to the Tasmota device to sending / receiving commands via MQTT. This can be done after the discovery mode is implemented. Once this is complete, direct connect to the Tasmota devices will not be necessary from the smartthings hub. See https://tasmota.github.io/docs/Home-Assistant/ for details on how to use the Tasmota Integration in MQTT to discover devices.

Would this feature be possible to implement? Without it, I think tasmota-connect will not scale well.

@hongtat
Copy link
Owner

hongtat commented Mar 15, 2021

Hello,

To add support for MQTT, it requires user to install a MQTT broker.

The purpose of this software is to provide a pure integration between Tasmota & SmartThings, i.e. the user doesn't have to install additional hardware or software. And for this to work correctly, it requires the Tasmota devices and SmartThings hub to be assigned with static IP addresses.

If you prefer MQTT based solutions, I believe there are a few alternatives.

@shevett
Copy link
Author

shevett commented Mar 15, 2021

I think it would still be worthwhile to put the possibility in of using an MQTT broker. You have 90% of the code there, it would be a matter of just adding the MQTT library, login credentials and address of the broker, and then subscribing to the topic. In the client, just look for the discovery information from the devices, and you have an auto-populated list of tasmota devices.

If there is another smartthings app that does this already, I'll use that, but I don't know of one off the top of my head. Got a pointer?

@hongtat
Copy link
Owner

hongtat commented Mar 15, 2021

I believe there is still no MQTT client in SmartThings.

MQTT based apps require a MQTT bridge, similar to this.
App that does auto-discovery would require modification to Tasmota firmware.

Or you could also write custom firmware to communicate directly with ST platform over MQTT. Link

Home automation (ST, HASS, Hubitat, etc) communities have more information/ideas on how to integrate Tasmota.

@shevett
Copy link
Author

shevett commented Mar 15, 2021

App that does auto-discovery would require modification to Tasmota firmware.

This is incorrect. Tasmota discovery is handled via the HomeAssistant discovery tools - SetOption19 0

https://tasmota.github.io/docs/Home-Assistant/ :

Once you configure the Home Assistant integration every new Tasmota device with SetOption19 0 set, will be discovered automatically.

I need to research some more what the state of the MQTT tools are, I am not sure the bridge is needed to get a discovery response from the app (since it's a synchronous query to MQTT - not a triggered event). I'll followup when I have more information.

@hongtat
Copy link
Owner

hongtat commented Mar 16, 2021

Because there is no MQTT client in SmartThings, ST smartapps which communicate over MQTT require a bridge (a MQTT client hosted outside of ST hub) to translate the messages between MQTT device/broker and ST.

ST/Hubitat-Tasmota smartapps that do Tasmota discovery use custom Tasmota firmware, and they use HTTP/TCP to communicate with the hub, they do not use MQTT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants