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.
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.
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
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
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!