Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: MQTT Problems Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 07 2021 at 17:53 | IP Logged Quote patrickm

I just installed 2.2 and I am/was trying to setup PH with
my MQTT broker. Now PH will start briefly then shut down.
Is there any way I can disable MQTT so PH can actually
start again?

Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 07 2021 at 18:17 | IP Logged Quote dhoward

Patrick,

If MQTT was setup as a controller in PowerHome, open the pwrhome.ini file and change [SYSTEM]Loadctlrs to NO.

If MQTT was setup as a plugin, open the pwrhome.ini file and change [SYSTEM]Loadplugins to NO.

Save and launch PowerHome. You should now be able to go in and change the settings on your controllers or plugins. When done, change the
settings in pwrhome.ini to YES and restart.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 07 2021 at 18:39 | IP Logged Quote patrickm

Thanks Dave that worked. I would really like to get PH set
up with MQTT. My MQTT broker has been running on a local
subnet for a few years with no issues. I am not using SSL
or passwords so I assume the client fields for the MQTT
controller can be blank?

I added powerhome to Windows Firewall but it still hangs.

Edited by patrickm - March 07 2021 at 18:45
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 08 2021 at 23:36 | IP Logged Quote dhoward

Patrick,

Sounds like the way Ive got my test system configured. Im not using SSL or passwords but I did declare a unique Client ID in my
controller setup.

Basically all I needed to do was specify the IP and Port of Mosquitto, SSL is unchecked and SSL Protocol is set to None. The
certificate fields are blank, UserID and Password are blank (password will appear like a password is entered but if you click on the
field, it should show blank). I set my client ID to : PowerHome MQTT Controller.

I would go ahead and leave the prefix fields all blank until you're able to successfully connect to your broker.

It's odd that it would shutdown. Usually when Im testing, if something is right, it will just popup a window saying there is a
problem connecting and then it will retry up to 5 times. Im wondering if one of the core components of PowerHome did not get
properly registered.

Also, make sure that none of your devices are currently configured to point to the MQTT controller (just go into Setup->Controllers
and temporarily set the controller ID to something you havent used before) just so we can make sure we're getting past the "Connect"
process and no subs or pubs are being processed.

Let me know,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 09 2021 at 11:45 | IP Logged Quote patrickm

Hi Dave,
That is how I have it set up and it's still shuts down.

This is a fresh install on a W10 ESXI VM so there isn't any
other controllers other than a Insteon USB stick.

Thanks,
Patrick
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 10 2021 at 22:29 | IP Logged Quote dhoward

Patrick,

Can give the MQTT plugin a try? It uses many of the same components as the controller and it would help to know if it also has issues (and possibly
give an error message).

Let me know.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 11 2021 at 13:14 | IP Logged Quote patrickm

Can you give me a quick run down on installing the plugin?
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 11 2021 at 14:29 | IP Logged Quote dhoward

Patrick,

Check the help file that comes with 2.2
under Plugins->MQTT. Should be fully
documented.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 12 2021 at 00:25 | IP Logged Quote patrickm

Dave,
Thanks for the 2.2 help file.

I successfully registered the plugin and modified the
.ini file with my broker settings and added:

[subscribe_5]
topicfilter=tele/outside_garage/SENSOR
qos=0
actiontype=9
action=ph_msgbox("Variables",ph_returnallvars(6),90)

I reinit PH but I am not seeing the msgbox pop up or
anything in the log or status window.

I saw that MQTTClient connected to broker and I see that
topic regularly being published via MQTT.fx

Edited by patrickm - March 12 2021 at 00:50
Back to Top View patrickm's Profile Search for other posts by patrickm
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 15 2021 at 15:05 | IP Logged Quote patrickm

Is there anything else I can do to troubleshoot this?
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 15 2021 at 20:37 | IP Logged Quote dhoward

Patrick,

Sorry for not getting back sooner...

With PowerHome shutdown, open a command prompt with "run as administrator" and navigate to the c:\powerhome directory. Run the following commands:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe m2mqtt.net.dll /tlb /codebase
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe phmqtt.dll /tlb /codebase

Navigate to the c:\powerhome\plugins directory and run the following command:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe phmqttpi.dll /tlb /codebase

Launch PowerHome and test both the plugin and controller and let me know the results.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 15 2021 at 20:50 | IP Logged Quote patrickm

I successfully ran those commands as admin.

When I restarted PH I recieved an error about enabling
plugin MQTT return code = 1000

When I enable the controller PH shuts down during startup
as before.

Patrick

Edited by patrickm - March 15 2021 at 20:58
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 15 2021 at 20:55 | IP Logged Quote dhoward

Can you try using the plugin to publish an MQTT message to see if it shows up in your MQTT monitor?

Also, what MQTT broker are you using? It shouldnt matter but I only tested with Mosquitto.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 15 2021 at 20:59 | IP Logged Quote patrickm

I am running Mosquitto on Ubuntu 18.04. There was an error
enabling the MQTT plugin with a return code = 1000
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2021 at 14:38 | IP Logged Quote dhoward

Patrick,

Mosquitto on Unbuntu shouldnt be a problem.

Before doing the registration commands, were you getting the return code = 1000 on MQTT plugin enablement or did this problem only occur after
performing the commands.

I checked the sourcecode and the return code = 1000 is returned when an exception occurs on the MQTTClient.Connect function. In order to get more
details on the specific error, can you edit the phmqttpi.ini file and set the [Setup]options=2. You'll also want to create a generic plugin
trigger in PowerHome for the MQTT plugin with a trigger number of 256 and trigger value of 4. Make the action a raw formula with the following
formula:

ph_msgbox("Vars",ph_returnallvars(6),90)

With that done, go ahead and restart PowerHome and you should get a popup with message with more details related to the MQTT plugin enable failure
that you can send to me.

******************************

Did you check to see if the MQTT controller is acting any differently after doing the DLL registrations?

Let me know,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 17 2021 at 17:03 | IP Logged Quote patrickm

Dave,
When I first ran the DLL registrations there was no error
on startup other than when the controller was loaded
which caused PH to exit.

I made the modification in phmqttpi.ini and created the
trigger:




I restarted PH but there was no msg box that popped up or
anything in log.

Edited by dhoward - March 17 2021 at 17:10
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2021 at 17:15 | IP Logged Quote dhoward

Patrick,

If you restarted and nothing appeared in the log concerning the MQTT plugin enable failing, then it should be up and running. You can check if PowerHome
"thinks" everything is ok by going to Help->About->Plugins and seeing what shows for the MQTT plugin.

Assuming it is up and running (according to PowerHome), change your Trigger ID Number to [Any Command] and the Trigger Value to [Any Option]. Save, (you
don't have to restart PH) and try sending and receiving some MQTT messages to see if the trigger ever fires.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2021 at 17:17 | IP Logged Quote dhoward

Patrick,

I just noticed this from your trigger screenshot...with a Boolean value of 0, your trigger will NEVER fire. Set the Boolean value to 1 so it will always fire
if it is triggered.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: March 17 2021 at 17:34 | IP Logged Quote patrickm

I tried both values for Boolean with no difference.

When I initially added the plugin there were no errors.
There is always an error now (return code is: 1000).

Here is the output from about plugins:

***PLUGIN INVALID***
PowerHome Plugin ID: MQTT
Plugin failed during initialization.

Edited by patrickm - March 17 2021 at 17:36
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2021 at 18:32 | IP Logged Quote dhoward

Patrick,

Since you're always getting the error now, is the trigger message popup coming up with any additional information on why the plugin is
failing?

If not, it might be best to see if we can schedule a remote control session so I can try to figure out what is going wrong.

Dave.


Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

Page of 2 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum