When is a Shelly Dimmer not a Shelly Dimmer -UPDATED-

Posted on
Sat Apr 18, 2020 7:35 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

When is a Shelly Dimmer not a Shelly Dimmer -UPDATED-

=====================================================================================
UPDATED
Since I wrote this Joe came back with a much better way with his HTTPd v2 server,

I have changed over to it and no more editing a python script. Thanks Joe!

FlyingDiver wrote:
See viewtopic.php?f=216&t=23833&p=190742#p190742 for my way of doing it. ;)

And thanks for pointing out that IOS shortcuts can do a web request. I had no idea. I can actually use this to remove a
bunch of stuff from HKB.

=====================================================================================

Answer.
When it is running an Indigo Action instead.

Decided to learn about IOS shortcuts and one thing led to another.

So with an iPhone/iPad/AppleWatch ect that runs Siri/Shortcuts you can now run any Action you have in Indigo with just a Shelly Dimmer (97 Actions per Dimmer - if you need more then just get another Dimmer or if you have a load of Actions you can control over 1000 by using a Shelly RGBW) and Aaron's ShellyMQTT plugin, no homebridge required.

Install ShellyMQTT and give your Dimmer a fixed IP and add to ShellyMQTT.

Run IOS Shortcuts and add a New Shortcut, Add Action, Web, Web Requests, Get Contents of URL and fill in using your Shelly Dimmer IP.

8417B014-D765-4398-BEAA-DA2F15088EED_1_101_o.jpeg
Shortcut
8417B014-D765-4398-BEAA-DA2F15088EED_1_101_o.jpeg (270.2 KiB) Viewed 2930 times


For every Shortcut give it a different Brightness value between 2 and 99.

To speed adding shortcuts you can use the duplicate shortcut and edit just the brightness value and the shortcut name.
26A29A7F-6B5D-4D91-8FBF-E8222267CD57_1_101_o.jpeg
Shortcut Duplicate
26A29A7F-6B5D-4D91-8FBF-E8222267CD57_1_101_o.jpeg (199.04 KiB) Viewed 2930 times


Now write a python script to get the "brightness" and use it to run the correct Action.
Excuse my beginners Python, please if you can improve this I would love to see it added below.

Code: Select all
#
# Shelly Dimmer Used As Indigo Action Server
# CliveS 18 April 2020
# Improvements Appreciated
# Caveat
# Shelly Dimmer Needs Brightness to Be 0
#
# Trigger Settings
# Type :   Device State Changed

# Device:   Your Shelly Device
#         Brightness Level
#            Becomes Greater Than 0

# Condition:Always

# Actions:   Execute Script (This Script)

# Use Your Own Device And Action Groups

devShellyDimmer         = indigo.devices[1423936141]      # "Shellydimmer-CC50E3F3A8BA"

actNullAction         = indigo.actionGroups[368675060]  # "NullAction"
actDriveLightsOn      = indigo.actionGroups[267790534]  # "Drive Lights On"
actDriveLightsOff      = indigo.actionGroups[148839790]  # "Drive Lights Off"
actBedroom1LightOn      = indigo.actionGroups[1305866272] # "Bedroom 1 Ceiling Light On"
actBedroom1LightOff      = indigo.actionGroups[1848420604] # "Bedroom 1 Ceiling Light Off"
actConservatoryLightOn   = indigo.actionGroups[1194598329] # "Conservatory Light On"
actConservatoryLightOff   = indigo.actionGroups[1137618911] # "Conservatory Light Off"
actDiningRoomLightOn   = indigo.actionGroups[1024095698] # "Dining Room Lights On"
actDiningRoomLightOff   = indigo.actionGroups[684964061]  # "Dining Room Lights Off"
actKitchenLightOn      = indigo.actionGroups[1397879272] # "Kitchen Spot Lights On"
actKitchenLightOff      = indigo.actionGroups[1928612426] # "Kitchen Spot Lights Off"
actLivingRoomLightsOn   = indigo.actionGroups[92742435]   # "Living Room On and Hall Lamp 50% No Time Check"
actLivingRoomLightsOff   = indigo.actionGroups[1534354226] # "Living Room and Hall Lamp Off No Time Check"
actPanasonicTVOn      = indigo.actionGroups[148983306]  # "TV On"
actPanasonicTVOff      = indigo.actionGroups[720380761]  # "TV Off"
actFrontDoorOpen      = indigo.actionGroups[41446900]   # "Unlock Front Door"
actGarageOpen         = indigo.actionGroups[311559716]  # "Garage Door Left Open"
actGarageClose         = indigo.actionGroups[710225838]  # "Garage Door Left Close

State   = "brightnessLevel"
dev      = indigo.devices[devShellyDimmer]
x      = dev.states[State]

indigo.server.log(" ")

if x < 2 or x > 99:
   # indigo.server.log(unicode(dev.states[State]))
   # indigo.server.log("Not Between 2 and 99")
   pass
else:   
   # indigo.server.log(unicode(dev.states[State]))
   # indigo.server.log("Between 2 and 99")
   # indigo.server.log("x = " + str(x))
   
   if x == 2:
      indigo.server.log("x = 2")
      
   if x == 3:
      indigo.server.log("x = 3")
      
   if x == 4:
      indigo.server.log("x = 4")
      
   if x == 20:
      # indigo.server.log("Dining Room Light On")
      indigo.actionGroup.execute(actDiningRoomLightOn)

   if x == 21:
      # indigo.server.log("Dining Room Light Off")
      indigo.actionGroup.execute(actDiningRoomLightOff)

   if x == 22:
      # indigo.server.log("Kitchen Light On")
      indigo.actionGroup.execute(actKitchenLightOn)

   if x == 23:
      # indigo.server.log("Kitchen Light Off")
      indigo.actionGroup.execute(actKitchenLightOff)

   if x == 24:
      # indigo.server.log("Living Room Light On")
      indigo.actionGroup.execute(actLivingRoomLightsOn)

   if x == 25:
      # indigo.server.log("Living Room Light Off")
      indigo.actionGroup.execute(actLivingRoomLightsOff)

   if x == 26:
      # indigo.server.log("Conservatory Light On")
      indigo.actionGroup.execute(actConservatoryLightOn)

   if x == 27:
      # indigo.server.log("Conservatory Light Off")
      indigo.actionGroup.execute(actConservatoryLightOff)

   if x == 28:
      # indigo.server.log("Bedroom 1 Light On")
      indigo.actionGroup.execute(actBedroom1LightOn)

   if x == 29:
      # indigo.server.log("Bedroom 1 Light Off")
      indigo.actionGroup.execute(actBedroom1LightOff)

   if x == 30:
      # indigo.server.log("Drive Lights On")
      indigo.actionGroup.execute(actDriveLightsOn)

   if x == 31:
      # indigo.server.log("Drive Lights Off")
      indigo.actionGroup.execute(actDriveLightsOff)

   if x == 80:
      # indigo.server.log("Panasonic TV On")
      indigo.actionGroup.execute(actPanasonicTVOn)

   if x == 81:
      # indigo.server.log("Panasonic TV Off")
      indigo.actionGroup.execute(actPanasonicTVOff)

   if x == 90:
      # indigo.server.log("Open Front Door")
      indigo.actionGroup.execute(actFrontDoorOpen)

   if x == 98:
      # indigo.server.log("Open Garage Door")
      indigo.actionGroup.execute(actGarageOpen)
   
   if x == 99:
      # indigo.server.log("Close Garage Door")
      indigo.actionGroup.execute(actGarageClose)
   
if x != 0:   
   indigo.device.turnOff(dev)
   #indigo.server.log(unicode(dev.states[State]))
   pass
else:
   pass


Finally add a Trigger with the following setup
Code: Select all
# Trigger Settings
# Type :   Device State Changed

# Device:   Your Shelly Device
#           Brightness Level
#           Becomes Greater Than 0

# Condition:Always

# Actions:   Execute Script (Name You Gave Above Script)


When you first run a new Shortcut it will ask for permission but remembers after that
E962C624-FBA4-48F2-81B2-192A959FCDDE_1_101_o.jpeg
Permission Required
E962C624-FBA4-48F2-81B2-192A959FCDDE_1_101_o.jpeg (255.06 KiB) Viewed 2930 times


You will end up with Shortcuts in the Widget (if required) and Hey Siri will do what you want :)

Anyone know how to change the button colours, my OCD hates the two colours, I would like them all one colour :roll:

B54919C2-A75D-4C6A-8D13-E21365571018_1_101_o.jpeg
Widget Menu
B54919C2-A75D-4C6A-8D13-E21365571018_1_101_o.jpeg (392.43 KiB) Viewed 2930 times


Just as a test I added "Hey Siri, Shelly" and my drive lights came on and "Hey Siri, Indigo" turned them off again, usually I would use Turn On Drive Lights or Drive Lights On but impressed Siri now does not need Open/Close/Turn On/Off commands.

Code: Select all
"Hey Siri, Shelly"
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 30%
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 30%
   Script                           
   Action Group                    Drive Lights On
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" off

"Hey Siri, Indigo"
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 31%
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 31%
   Script                           
   Action Group                    Drive Lights Off
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" off

I have asked Aaron about silencing the logging per device and he is adding that option in a few days so the "Shellydimmer-CC50E3F3A8BA" on to 30% and "Shellydimmer-CC50E3F3A8BA" off should be silent.

My thanks to Aaron for a great plugin and Joe for the MQTT Connector.

Hope someone finds this helpful and if you do and can improve my basic python, great!
Last edited by CliveS on Sun Apr 19, 2020 6:45 am, edited 2 times in total.

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : 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

Posted on
Sat Apr 18, 2020 8:31 am
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: When is a Shelly Dimmer not a Shelly Dimmer

This is was not one of the ways I imagined the plugin being used, but it is definitely a neat way of interacting to Indigo without using HomeKit.

Anyone know how to change the button colours, my OCD hates the two colours, I would like them all one colour :roll:

I think you can set the color by editing the action, clicking on the icon, and then you can select a custom "colour". Maybe you could have your On/Open one color/colour and your Off/Close another color/colour :D

I have asked Aaron about silencing the logging per device and he is adding that option in a few days so the "Shellydimmer-CC50E3F3A8BA" on to 30% and "Shellydimmer-CC50E3F3A8BA" off should be silent.

Yes, individual device muting is on my mind, so hopefully I can get an elegant solution figured out. No "ah-ha!" moments as of yet though...

Out of curiosity, your logs show:
Code: Select all
"Hey Siri, Shelly"
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 30%
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 30%               <-------- Whats up with this duplicate on?
   Script                           
   Action Group                    Drive Lights On
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" off

Is this second "on" getting logged with every brightness set? I would expect that line to be logged once.


My thanks to Aaron for a great plugin and Joe for the MQTT Connector.

I'm glad you are finding it useful. When Joe showed off MQTT Connector aimed as a utility of other plugins, I was curious to see how it would be used by the plugin developers. As it turns out, I have been able to make, in my opinion, a pretty neat plugin with it.

Posted on
Sat Apr 18, 2020 8:37 am
Colly offline
Posts: 535
Joined: Jan 16, 2016
Location: Ireland

Re: When is a Shelly Dimmer not a Shelly Dimmer

Great work.. now I’m wondering if I should update my latest Shelly order to include a dimmer..


Sent from my iPhone using Tapatalk

Posted on
Sat Apr 18, 2020 11:31 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: When is a Shelly Dimmer not a Shelly Dimmer

aaronlionsheep wrote:

Out of curiosity, your logs show:
Code: Select all
"Hey Siri, Shelly"
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 30%
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" on to 30%               <-------- Whats up with this duplicate on?
   Script                           
   Action Group                    Drive Lights On
   ShellyMQTT                      "Shellydimmer-CC50E3F3A8BA" off



The first line is the Trigger, the second is the Action, if I just change the value from the dimmer GUI it only fires once.

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : 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

Posted on
Sat Apr 18, 2020 11:43 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: When is a Shelly Dimmer not a Shelly Dimmer

Colly wrote:
Great work.. now I’m wondering if I should update my latest Shelly order to include a dimmer..


Sent from my iPhone using Tapatalk


Not sure if you have a Shelly 2.5 spare but if so I am sure you could use

Code: Select all
http://192.168.0.40/roller/0?roller_pos=30 Will Open at 30%

And use roller_pos = 2-98 and possibly roller/1 as well for another 100, not sure as I don't have one to test.

Just imagine what you could do with an RGBW
Code: Select all
http://192.168.0.50/color/0?turn=on&red=255&green=86&blue=112&white=0
 That lot would give 1000 and if you run out just add another 100 with
http://192.168.0.50/color/0?turn=on&gain=27 Change the intensity or RGB to 27%

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : 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

Posted on
Sat Apr 18, 2020 2:51 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: When is a Shelly Dimmer not a Shelly Dimmer

Not to be a downer here, but couldn't you do this exact thing with the HTTPd plugin and no Shelly devices at all?

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

Posted on
Sat Apr 18, 2020 3:28 pm
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: When is a Shelly Dimmer not a Shelly Dimmer

FlyingDiver wrote:
Not to be a downer here, but couldn't you do this exact thing with the HTTPd plugin and no Shelly devices at all?


Joe, I am sure you can but I have no idea how to set it up, read the wiki and still none the wiser what httpd actually does or what it is used for except you used it to interface IFFTT to Indigo.

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : 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

Posted on
Sat Apr 18, 2020 3:39 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: When is a Shelly Dimmer not a Shelly Dimmer

CliveS wrote:
Joe, I am sure you can but I have no idea how to set it up, read the wiki and still none the wiser what httpd actually does or what it is used for except you used it to interface IFFTT to Indigo.


It's used to handle incoming HTTP requests just like you're doing in the first post. In that case, you're sending it to the Shelly device. Using the plugin, you would be sending it directly to the Indigo server.

I think I'll set up some actions using your iOS shortcut method and the HTTPd plugin, instead of using HKB and post the setup for comparison.

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

Posted on
Sat Apr 18, 2020 4:09 pm
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: When is a Shelly Dimmer not a Shelly Dimmer

Sounds good , more things to learn during lockdown

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : 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

Posted on
Sat Apr 18, 2020 6:47 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: When is a Shelly Dimmer not a Shelly Dimmer

See viewtopic.php?f=216&t=23833&p=190742#p190742 for my way of doing it. ;)

And thanks for pointing out that IOS shortcuts can do a web request. I had no idea. I can actually use this to remove a bunch of stuff from HKB.

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

Posted on
Sat Apr 18, 2020 9:09 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: When is a Shelly Dimmer not a Shelly Dimmer

FlyingDiver wrote:
See viewtopic.php?f=216&t=23833&p=190742#p190742 for my way of doing it. ;)

And thanks for pointing out that IOS shortcuts can do a web request. I had no idea. I can actually use this to remove a bunch of stuff from HKB.


Thanks for the writeup, I think this has brought to light a new way to interface from iOS to Indigo.

HomeKit seems to work "well" when it works well. I think a few people will start experimenting with this now.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron