Using Shelly devices with the MQTT plugin

Espressomatic
Posts: 73
Joined: Sun Dec 30, 2018 10:37 am

Using Shelly devices with the MQTT plugin

Post by Espressomatic »

Is anyone working on a Shelly-specific plugin? MQTT has a lot of possibilities and supports a lot of messaging from a lot of very different products, but Shelly publishes details to directly integrate their products with anyone's platform. Cloud API, REST API, direct device-to-device API.

IMO, I won't ever waste my time flashing Tasmota on a SONOFF when Shelly has done things properly from the start. 4 switches arriving shortly along with some buttons to turn a pair of them into lamp-cord switches. H&T, Switch 2.5 and then their smoke detector later in the spring.
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Introducing the Shims plugin

Post by FlyingDiver »

Espressomatic wrote:Is anyone working on a Shelly-specific plugin?
Why would you need one? Shelly does MQTT.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Introducing the Shims plugin

Post by FlyingDiver »

Pre-release available - https://github.com/FlyingDiver/Indigo-S ... /tag/0.1.3

Minor changes to support Shelly native MQTT.

Changed commands sent to lower case. This is to accommodate Shelly devices that require lower case commands. See https://github.com/FlyingDiver/Indigo-Shims/issues/8 for specifics.

Tested with a Sonoff/Tasmota device and it seems to work fine.

Please test action commands from Indigo to relay type devices. Specifically on/off/toggle. That's the only thing that changed.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
MarcoGT
Posts: 1148
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Introducing the Shims plugin

Post by MarcoGT »

Will this plugin support all Shelly devices? I bought a Shelly switch to use with Alexa, but it would be fine to integrate it with Indigo
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Introducing the Shims plugin

Post by FlyingDiver »

MarcoGT wrote:Will this plugin support all Shelly devices? I bought a Shelly switch to use with Alexa, but it would be fine to integrate it with Indigo
I really don't know anything about Shelly devices, other than they (at least some) do MQTT natively. If that's true, then I would expect you can use it with my MQTT plugins. If there are issues doing so, and I can fix them without breaking something else, I'll do so.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
MarcoGT
Posts: 1148
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Introducing the Shims plugin

Post by MarcoGT »

Ok fine.
I did a quick research and it seems that the dimmer (I bought the dimmer, not the switch) and it seems that it support MQTT
CliveS
Posts: 864
Joined: Sun Jan 10, 2016 5:31 am
Location: Medomsley, County Durham, UK

Re: Introducing the Shims plugin

Post by CliveS »

MarcoGT wrote:Will this plugin support all Shelly devices? I bought a Shelly switch to use with Alexa, but it would be fine to integrate it with Indigo
I have just received a Shelly 1PM and having spent all day trying to get my head around MQTT and failing so I just setup two Actions to turn on and turn off the Shelly, works fine. Also have a Shelly dimmer and so I will need to try and sort out MQTT but it just confuses me.
CliveS

Indigo 2024.2.1 : macOS Sequoia 15.6.1 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD

The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer
MarcoGT
Posts: 1148
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Introducing the Shims plugin

Post by MarcoGT »

How do you turn it on and off? Using MQTT?
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Using Shelly devices with the MQTT plugin

Post by FlyingDiver »

I moved the discussion of Shelly devices to a new thread.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Using Shelly devices with the MQTT plugin

Post by FlyingDiver »

Here's the docs for using MQTT with Shelly devices: https://shelly-api-docs.shelly.cloud/#reboot
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: Using Shelly devices with the MQTT plugin

Post by siclark »

Really interested in the Shelly 1 and the button to give hardwired control to lamps but also remote control them.
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: Using Shelly devices with the MQTT plugin

Post by siclark »

Except it's only for their switch and not their dimmer. Two buttons on it would be perfect.
CliveS
Posts: 864
Joined: Sun Jan 10, 2016 5:31 am
Location: Medomsley, County Durham, UK

Re: Using Shelly devices with the MQTT plugin

Post by CliveS »

MarcoGT wrote:How do you turn it on and off? Using MQTT?
I am using 2 actions that run either On or Off python scripts

Code: Select all

# Shelly Turn Off 

import urllib2
import socket

ShellyIP = "192.168.100.236"
TurnOn	 = "/relay/0?turn=on"
TurnOff  = "/relay/0?turn=off"

#url_cmd = "http://" + ShellyIP + TurnOn

url_cmd = "http://" + ShellyIP + TurnOff

indigo.server.log(u"Sending to Shelly at " + ShellyIP)

try:
	response = urllib2.urlopen(url_cmd)
	response.read()
	response.close()

except socket.timeout:
	indigo.server.log(u"Timed out when talking to Shelly at " + ShellyIP)
		
except urllib2.URLError, e:
	if hasattr(e, 'reason'):
		indigo.server.log(u"Error: We failed to find Shelly at " + ShellyIP)
		indigo.server.log("Reason: " + str(e.reason))

	elif hasattr(e, 'code'):
		indigo.server.log(u"Error: The Shelly couldn\'t fulfill the request.")
		indigo.server.log("Error code: " + str(e.code))

else:
	indigo.server.log(u"Sent to Shelly at " + ShellyIP)
FlyingDiver wrote:Here's the docs for using MQTT with Shelly devices: https://shelly-api-docs.shelly.cloud/#reboot
Yes, I have been staring at it all day but can't get my head around Mosquitto, MQTT plugin, Shims plugin and Shelly.

If anyone gets a Shelly and installs with these plugins please can you put a "how to" here (in idiot steps) and I will be eternally grateful
CliveS

Indigo 2024.2.1 : macOS Sequoia 15.6.1 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD

The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: Using Shelly devices with the MQTT plugin

Post by siclark »

I have always found The Hook Up to be very clear in his explanations.

https://www.youtube.com/watch?v=NjKK5ab0-Kk

As an alternative to shims, and as described in above video, you could also use nodered, which can do nodered to follow along with the above and use the indigo action nodered pluging / palette to control the devices
CliveS
Posts: 864
Joined: Sun Jan 10, 2016 5:31 am
Location: Medomsley, County Durham, UK

Re: Using Shelly devices with the MQTT plugin

Post by CliveS »

siclark wrote:I have always found The Hook Up to be very clear in his explanations.

https://www.youtube.com/watch?v=NjKK5ab0-Kk

As an alternative to shims, and as described in above video, you could also use nodered, which can do nodered to follow along with the above and use the indigo action nodered pluging / palette to control the devices
Yes watched that also this afternoon but it is based around Home Assistant which seems to have a very large base of Shelly support, as for Node-Red I uninstalled that a few days ago as I now have the Alexa back working with the Echo Gen 1 so did not need it, not sure I would manage to get my head around it, would rather a step by step how to for FlyingDiver's MQTT and Shims plugins, once I get one switch setup I should be fine for others.
CliveS

Indigo 2024.2.1 : macOS Sequoia 15.6.1 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD

The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer
Post Reply

Return to “MQTT”