Author |
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: September 12 2022 at 18:36 | IP Logged
|
|
|
In my effort to migrate, however slowly, away from Insteon, I upgraded to the 2.2beta 3-5 and bought two SwitchBot relay plugs. I was able to flash them OTA with Tasmota and I am able to change options and control them over their Tasmota WebUI. Now I would like to control them with PH. It seems like running an MQTT broker on the local PH machine, I should be able to do this with the Powerhome MQTT Client built into ver.2.2.
I have read and reread the PH help files, and I have watched and read several MQTT webpages and videos as reference. Unfortunately, I cannot get Powerhome to communicate with my two plugs. The broker is listening, but I am not really sure how to send messages to the devices to turn on/off. The main error message I am getting is either, "The MQTT controller ID: MQTT was unable to subscribe to the AIO topic list," or, "The MQTT controller ID: MQTT was unable to subscribe to the general topic list," or, "The MQTT controller ID: MQTT general topic subscription failed. Attempted to subscribe to 2 topics but instead subscribed to 0 topics." These are the results from trying to subscribe to topics in PH>Devices>Analog or PH>MQTT>Publish/Subscribe. Clearly I am not subscribed as I should be.
Here's what I have done in PH:
I have created two analog devices
I've added an MQTT controller (btw, I don't think this worked when I used the network address, and maybe this has something to do with it?)
I played around with entries on the MQTT Publish/Subscribe page, but I surely haven't done this correctly.
Here is the relevant MQTT information from the Tasmota WebUI page:
I can publish a command using ph_mqttpub, which returns a successful publish (0), but I don't get the expected results at the plug, so somehow the devices are not subscribed to my published messages.
I think the devices aren't subscribed to whatever topic it is that controls them and I am hoping someone could upload a screenshot of something like this that works for them or point out what I am doing incorrectly.
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: September 14 2022 at 01:15 | IP Logged
|
|
|
I am still getting subscriber error messages, but when I use the full topic in the subscription, the ON and OFF commands now work using the Powerhome MQTT client. I had to get a third party client (I used MQTT Explorer) to watch the commands being issued by PH over MQTT to figure out what changes needed to happen between my successful commands on the Tasmota Console, mosquitto_pub, and MQTT Explorer and the (initially) unsuccessful commands from Powerhome. Hope this helps someone in the future although I may have simply avoided the bad subscriptions if I had entered them properly in the MQTT controller setup in the first place.
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: September 19 2022 at 14:44 | IP Logged
|
|
|
I am able to turn Tasmota flashed devices (SwitchBot and Shelly1 relay) on and off using MQTT, but I cannot determine the status from within Powerhome. I have read Dave's help files and I can see that I am publishing messages which are received, but I am not updating the analog device status. I believe this to be a simple configuration problem.
According to Dave's help file for MQTT Controllers:
"You WILL get an Analog In trigger on the received Subscribe topic. This is what will update the Raw and Calc values for the Analog IO device. If you have an IOT Output device type and left the Publish topic blank and entered only a Subscribe topic, controlling this device from PowerHome will Publish a message with the data to the Subscribe topic (Subscribe and Publish are the same). The broker receives this message which then sent out to all clients that have subscribed to that topic of which PowerHome is one. The message that was just sent will come in on the Subscribe topic, update the Analog IO device and then fire an Analog In trigger."
This is where I am stuck. If I leave the "Publish topic blank and only enter a Subscribe topic," then I am not even able to command the devices on or off, let alone update the devise status.
Does anyone have any ideas? The help files are great, and so are the forums, but I could really use a few screenshots of the Analog IO settings page and the MQTT Publish/Subscribe page for Tasmota on/off devises, or really anything that uses WiFi and MQTT.
I also continue to get error messages subscribing to the AIO topic list as well as the general topic list.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: September 20 2022 at 00:08 | IP Logged
|
|
|
Jeff,
Sorry I didnt catch the earlier messages in this thread. For reason, I only got the message from today.
I would happy to help you get setup and working. Probably the easiest way would be to do an AnyDesk session so we can figure out what is
going on. It looks like you've definitely made alot of progress and are close. Having an external MQTT Explorer is very helpful because it's
not always obvious what the publish and subscribe topics are. One thing that I have done is to setup a Subscribe entry under the MQTT
Subscribe screen and set my subscribe topic to "#" (get everything) and then set the action to write the TEMP variables to a file. I then let
it run for a bit while manually controlling the device as well as controlling the device from whatever built in interface it has. This is
pretty much what your MQTT Explorer is probably doing for you but wanted to let people know that can also get the information from PowerHome.
One thing I did notice real quick is that you may not have the correct case for your topics. MQTT topics (and filters) are case sensitive. In
the Analog IO screen, I see a topic as "cmnd/fan_plug/power" and the screenshot from Tasmota is showing "cmnd/Fan_plug".
Shoot me an email and lets try to set up a screenshare session as I don't think it will take long as you look like you're pretty close.
Dave.
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: September 20 2022 at 10:43 | IP Logged
|
|
|
Thanks for your response Dave. FWIW, I think the forum email notification has been spotty or down for a bit since I wasn't receiving emails even when people did respond (another thread in "Elk").
First, as soon as I loaded MQTT Explorer and could see some of the MQTT traffic, I realized my mistake with the case sensitivity and have subsequently gone to all lower case in Tasmota and Powerhome.
Second, I did up a pop up window, per your suggestion in the MQTT ZWAVE discussion (w/ Renard) to monitor traffic changes, but it has yet to trigger (although I was subscribing to stat/device_topic/# and not just #, but there should have been plenty of traffic on that topic) so I suspect it has to do with the pop up window warnings I get that the MQTT controller is unable to subscribe to the general topic list/AIO topic list.
I am trying your suggestion about subscribing to all (#) and using an action to write to a TEMP variable in a file and compare it to the MQTT Explorer information. Does this look right? It did create the file when I tested it, but nothing is being appended even after numerous status changes in the MQTT traffic. Hmmm.
Jeff
I leave town tomorrow early and won't get back until early next week, so I'll see what is produced in the file in that time and I will probably take you up on your AnyDesk offer at that point if I'm still stuck . . . which seems likely ;-)
Edited by Handman - September 20 2022 at 12:13
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: October 01 2022 at 13:20 | IP Logged
|
|
|
Just to close the loop on this thread, I was able to resolve my issue with MQTT working with Dave. The heart of the issue seemed to be that one of the .dll files wasn't registering properly, possibly because another reg file was hanging. I'm not certain, but I believe in my case that the M2Mqtt.NET.dll file was the issue, and this was creating a problem for the PHMqtt.dll file. Anyway, once this issue was resolved by proper registration of the file contents, all the MQTT subscriptions started working as intended.
In the interest of assisting others in the community who are willing to poke into the MQTT protocol with PH, I am reposting screenshots of my current (operational) MQTT subscriptions. I am so far only using three devices and all have been flashed (OTA) with Tasmota - an open source firmware for Expressif Wifi chipsets. I opted for Tasmota to get away from cloud controlled devices in my home in favor of local network control.
The subscriptions allow the PH MQTT controller to receive the published MQTT messages by the three devices. Commands to control the devices are issued with the prefix "cmnd," while subscriptions to any changes published by the devices are on the "stat" (status) prefix. Another prefix is "tele" (telemetry), and on Tasmota devices is published every five minutes (by default) to pass on the status of numerous variables depending on the device (date, time, time up, power consumption, chip temp, etc.). The only information I am actively using is "stat" to reflect any status changes in the power state (on/off). I have included the other (disabled) subscriptions to provide addition context to what is possible. Note that # and + are wildcard types. Also, the "Formula" section can be left blank, but this formula will create a text file which records the MQTT traffic on PH for informational purposes for debugging, etc.
The Analog Device page shows one way to set up these devices. Note that JSON and Extract are checked and the Raw to Calc Formula box allows the devices status changes to be displayed in PH (Thanks for fixing that on the spot, Dave). A new formula called Tasmota_ONOFF was added by Dave and will certainly appear in future releases.
I hope this helps PH users who want to look into MQTT within Powerhome.
|
Back to Top |
|
|
|
|