In need of mqtt help

Posted on
Thu Jan 28, 2021 10:17 am
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

In need of mqtt help

I have been running my Shellies with Karl’s Shelly plugin and it have worked well for my needs until I got the I3. It forced me to try mqtt and for a person without any programming skills it’s a bit of a challenge and of course I run into trouble.

This what I have done so far:
Installed mosquitto from Homebrev on the same Mac as I’m running Indigo.

Image

It seems to work, at least there is some action going on.

Image

Next thing was to change the settings on a Shelly 1pm to test it.
I made the following settings on it.
Image


Next step was to download MQTTconnector plugin and created a device

Image

Image

Image

Installed triggers like this

Image

Image

Finally I try to install the Shelly 1pm as a device.

Image


The device is not discovered and I’m trying with these settings but it will not show up correctly in the mosquitto.

Image

Image

I hope that I have been able to explain what I have done and that someone can help med to get it working and please try to explain in a way that makes sense to a person with limited programming skills.


Skickat från min iPad med Tapatalk

Posted on
Thu Jan 28, 2021 10:38 am
Colly offline
Posts: 535
Joined: Jan 16, 2016
Location: Ireland

Re: In need of mqtt help

Can you try put in your IP address rather than localhost? That’s how I’ve mine setup anyhow


Sent from my iPhone using Tapatalk

Posted on
Thu Jan 28, 2021 11:15 am
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: In need of mqtt help

Hi Colly,

Tried that but can’t connect MQTT Explorer to my local host IP address.


Skickat från min iPad med Tapatalk

Posted on
Thu Jan 28, 2021 11:46 am
Colly offline
Posts: 535
Joined: Jan 16, 2016
Location: Ireland

Re: In need of mqtt help

It doesn't look like your Shelly is being picked up in MQTT Explorer, see image of mine where I can see my Shelly devices. In order to simplify it I'd suggest entering your IP address of the server into both Mosquitto and the Shelly device and removing the password for now. I don't have a password on mine at all. Hope this helps.. Once you can see it in MQTT Explorer the rest should get sorted easily enough.
Attachments
Screenshot 2021-01-28 at 17.44.41.png
Screenshot 2021-01-28 at 17.44.41.png (20.75 KiB) Viewed 4079 times
Screenshot 2021-01-28 at 17.40.47.png
Screenshot 2021-01-28 at 17.40.47.png (55.04 KiB) Viewed 4079 times

Posted on
Thu Jan 28, 2021 2:53 pm
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: In need of mqtt help

Colly,

Tried with both changing from local host to 127.0.0.1 and the ip number of my Mac. No succes.
Mqtt Explorer refuse to let me connect with my IP number.

This is from the terminal window:

1611860449: New connection from ::1:53240 on port 1883.
1611860449: Client indigo-mqtt-67750538 already connected, closing old connection.
1611860449: New client connected from ::1:53240 as indigo-mqtt-67750538 (p2, c1, k60, u'mac').

Will try to reinstall Mosquitto tomorrow if no one have a better suggestion.


Skickat från min iPad med Tapatalk

Posted on
Thu Jan 28, 2021 6:10 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: In need of mqtt help

tazswe wrote:
Colly,

Tried with both changing from local host to 127.0.0.1 and the ip number of my Mac. No succes.
Mqtt Explorer refuse to let me connect with my IP number.

This is from the terminal window:

1611860449: New connection from ::1:53240 on port 1883.
1611860449: Client indigo-mqtt-67750538 already connected, closing old connection.
1611860449: New client connected from ::1:53240 as indigo-mqtt-67750538 (p2, c1, k60, u'mac').

Will try to reinstall Mosquitto tomorrow if no one have a better suggestion.


Skickat från min iPad med Tapatalk


Hi tazswe,

I'm glad you are giving ShellyMQTT a try! Please note that the plugin version with Shelly i3 support is v0.2.2, which is not published to the plugin store yet and is found on GitHub (https://github.com/AaronLionsheep/Shell ... /tag/0.2.2).

Colly is right with the IP address (thanks Colly). The shelly devices need to have the IP address of the MQTT broker (running on your Mac) to connect to.

In the "Advanced - Developer Settings" of your Shelly, change the server to IP:1883 where IP is the local IP address of your Mac running the MQTT broker. For example, my Mac has an IP of 192.168.1.7 that runs the broker and my Shelly devices use the value of 192.168.1.7:1883 in that server field.

Screen Shot 2021-01-28 at 7.05.18 PM.png
Screen Shot 2021-01-28 at 7.05.18 PM.png (195.89 KiB) Viewed 4027 times




If all the above still do not work then you may need to look at your firewall and ensure your Mac is allowing connections from other devices on the network to connect over MQTT. Go the System Preferences -> Security & Privacy -> Firewall -> Firewall Options... (unlock to make changes) -> Ensure mosquito allows incoming connections and add if necessary.

Also, uncheck the "Use Custom MQTT Prefix" option in your Shelly device. I do not think that plays nice with the plugin as the plugin expects the standard Shelly topic structure. There is a known bug/issue with device discovery out-of-the-box. That device discovery will work perfectly after your manually enter the first device.



I looked over your Indigo configuration screenshots and everything seems perfect. I see Indigo can communicate with the broker, so we just need to get the Shelly device to communicate as well. I personally don't use a username and password for the broker, and unless you specifically enabled authentication for mosquito, I would leave the username and password fields empty. If you DID enable mosquito authentication, then continue to use that username and password as you know what you are doing there!

Good luck,
Aaron

Posted on
Fri Jan 29, 2021 11:50 am
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: In need of mqtt help

Thanks a lot Aron and Colly,

I deleted the installed Mosquitto and made a new installation from Docker. It created an ip number for the server and the Shellies showed up nicely in the server. They are changing state when I switch my I3 and 1Pm.

I have tried to trigger some actions based on what is happening in the Mosquitto server but haven’t been successful.

I should need some guidance to get some triggers running.

So far I have one I3 and one 1PM installed on the server.


Skickat från min iPad med Tapatalk

Posted on
Fri Jan 29, 2021 11:54 am
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: In need of mqtt help

tazswe wrote:
Thanks a lot Aron and Colly,

I deleted the installed Mosquitto and made a new installation from Docker. It created an ip number for the server and the Shellies showed up nicely in the server. They are changing state when I switch my I3 and 1Pm.

I have tried to trigger some actions based on what is happening in the Mosquitto server but haven’t been successful.

I should need some guidance to get some triggers running.

So far I have one I3 and one 1PM installed on the server.


Skickat från min iPad med Tapatalk


Glad to hear you are making some progress!

So you have the Shelly devices added in Indigo and are seeing state changes in Indigo, correct? If so, you can create Indigo triggers on those devices just like other Indigo devices.

If you are not seeing the devices in Indigo then please post a screenshot of your Mqtt Explorer that shows the devices and topics.

Posted on
Fri Jan 29, 2021 2:20 pm
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: In need of mqtt help

I can’t see any state changes in Indigo, only in Mqtt Explorer.

This is a screenshot

Image

These are the status and setting pages of the I3.

Image
Image
When I push the buttons on my I3 they show the action in both the status page and Mqtt Explorer.


Skickat från min iPad med Tapatalk

Posted on
Fri Jan 29, 2021 2:30 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: In need of mqtt help

Ok so now we just need to work on the connection from the broker to Indigo. Here are some things to check:

1. You have your MQTTConnector device connected to the broker and it shows a "Connected" in the State column of Indigo.
2. In your Indigo device for the broker, ensure you are subscribed to "shellies/#" in the "Topic Subscriptions" in the device settings.
3. Click on the broker device and scroll to the bottom of the status panel to show the "Custom States" and verify that there is activity when manipulating the i3 or 1pm.
4. You have created a trigger for a topic match of "shellies" followed by "any" that queues messages with your own message type value.

I think your issue may lie in of those steps.

Posted on
Fri Jan 29, 2021 4:43 pm
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: In need of mqtt help

1. It shows Connected 0 , the zero makes me nervous
2. I am subscribing to shellies/# in the top subscriptions.
3. There is activity in the Customs states and its upgrading about twice per minute.
4. Yes I have created a trigger with both shellies and any,

Image
Image

Image

This is the evenetlog when I reload the plugin in debug mode.

Starting plugin "ShellyMQTT 0.2.2" (pid 32159)
Started plugin "ShellyMQTT 0.2.2"
ShellyMQTT Debug shelly 1 pm: Updated to version 0
ShellyMQTT Starting "shelly 1 pm"...
MQTT Connector Mosquitto: Subscribing to: shellies/announce (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/online (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/relay/0 (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/input/0 (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/longpush/0 (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/relay/0/power (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/relay/0/overpower_value (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/relay/0/energy (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/temperature (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/overtemperature (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shelly1pm-8CAAB542D1D2/input_event/0 (0)
ShellyMQTT Debug shelly 3 Sonos Down: Updated to version 0
ShellyMQTT Starting "shelly 3 Sonos Down"...
MQTT Connector Mosquitto: Subscribing to: shellies/announce (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/online (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/input/0 (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/input_event/0 (0)
ShellyMQTT Debug shelly 3 Sonos Down channel 2: Updated to version 0
ShellyMQTT Starting "shelly 3 Sonos Down channel 2"...
MQTT Connector Mosquitto: Subscribing to: shellies/announce (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/online (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/input/1 (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/input_event/1 (0)
ShellyMQTT Debug shelly 3 Sonos Down channel 3: Updated to version 0
ShellyMQTT Starting "shelly 3 Sonos Down channel 3"...
MQTT Connector Mosquitto: Subscribing to: shellies/announce (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/online (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/input/2 (0)
MQTT Connector Mosquitto: Subscribing to: shellies/shellyix3-8CAAB555D87E/input_event/2 (0)


Skickat från min iPad med Tapatalk

Posted on
Fri Jan 29, 2021 4:48 pm
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: In need of mqtt help

Your topic match trigger is wrong. It should look like this.
Attachments
Screen Shot 2021-01-29 at 5.48.33 PM.png
Screen Shot 2021-01-29 at 5.48.33 PM.png (133.79 KiB) Viewed 3943 times

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 29, 2021 4:50 pm
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: In need of mqtt help

tazswe wrote:
1. It shows Connected 0 , the zero makes me nervous


It's the return code from the connection call. Anything other than zero would trigger an error. I was lazy, I probably should have suppressed the return code if it's not an error.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 29, 2021 4:53 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: In need of mqtt help

Ok I see the issue.

The "Connected 0" is good. I think the 0 is just a status code and 0 means no errors.

You are seeing activity in the custom states, so this is great because the MQTT broker device is seeing the messages coming from the Shelly devices. This works because you are subscribed to "shellies/#" on that broker device.

The issue lies with your trigger. This can seem a bit weird, but each entry in the topic strings constructs the format of the topic to trigger on. So you need to first delete those previous matches. Then do a match on shellies and then do an Any match (with no match string). This makes the trigger look for any message on "shellies/#".

Screen Shot 2021-01-29 at 5.49.34 PM.png
Screen Shot 2021-01-29 at 5.49.34 PM.png (40.37 KiB) Viewed 3940 times

Posted on
Sat Jan 30, 2021 5:06 am
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: In need of mqtt help

This it the setting of my device for the Mosquitto Mqtt broker.

Image

Image

Image

Not sure if I shall publish the devices or not, tried both ways.
Image

Image

Image

Image

Pls confirm that settings are ok and if I shall publish devices or not?


Skickat från min iPad med Tapatalk

Who is online

Users browsing this forum: No registered users and 2 guests

cron