##########################################################################
# Take the snapshot
import json
EXCLUDED_PLUGIN_IDS = [
"com.perceptiveautomation.indigoplugin.devicecollection",
"com.ryanbuckner.indigoplugin.samsungtv",
"com.flyingdiver.indigoplugin.bondhome",
# Continue to add plugin ids to exclude here
]
relList = []
dimList = []
# cycle through deveices and save the state values of relays and dimmers
for device in indigo.devices.iter("indigo.relay, indigo.dimmer"):
if device.pluginId not in EXCLUDED_PLUGIN_IDS and device.enabled:
if (isinstance(device, indigo.DimmerDevice)):
dimList.append({'id': device.id, 'name': device.name, 'brightness': device.brightness })
else:
relList.append({'id': device.id, 'name': device.name, 'state': device.onState })
# save the dimmer list to a variable
indigo.variable.updateValue(1322749870, value=json.dumps(dimList))
# save the relay list to a variable
indigo.variable.updateValue(581444171, value=json.dumps(relList))
############################################################################
# Restore from snapshot
# retrieve dimList
dimRestore = json.loads(indigo.variables[1322749870].value)
# retrieve relList
relRestore = json.loads(indigo.variables[581444171].value)
# restore the state of relays
for relay in relRestore:
if relay['state']:
indigo.device.turnOn(relay['id'])
else:
indigo.device.turnOff(relay['id'])
# restore state of dimmers
for dimmer in dimRestore:
indigo.dimmer.setBrightness(dimmer['id'], value=dimmer['brightness'])
############################################################################
##########################################################################
# Take the snapshot
import json
relList = []
dimList = []
# cycle through deveices and save the state values of relays and dimmers
for device in indigo.devices.iter("indigo.relay, indigo.dimmer"):
if device.pluginId != "com.perceptiveautomation.indigoplugin.devicecollection" and device.pluginId != "com.ryanbuckner.indigoplugin.samsungtv" and device.pluginId != "com.flyingdiver.indigoplugin.bondhome" and device.enabled:
if (isinstance(device, indigo.DimmerDevice)):
dimList.append({'id': device.id, 'name': device.name, 'brightness': device.brightness })
else:
relList.append({'id': device.id, 'name': device.name, 'state': device.onState })
# save the dimmer list to a variable
indigo.variable.updateValue(1322749870, value=json.dumps(dimList))
# save the relay list to a variable
indigo.variable.updateValue(581444171, value=json.dumps(relList))
############################################################################
# Restore from snapshot
# retrieve dimList
dimRestore = json.loads(indigo.variables[1322749870].value)
# retrieve relList
relRestore = json.loads(indigo.variables[581444171].value)
# restore the state of relays
for relay in relRestore:
if relay['state']:
indigo.device.turnOn(relay['id'])
else:
indigo.device.turnOff(relay['id'])
# restore state of dimmers
for dimmer in dimRestore:
indigo.dimmer.setBrightness(dimmer['id'], value=dimmer['brightness'])
############################################################################
batteryLevel : None
blueLevel : None
brightness : 0
buttonConfiguredCount : 0
buttonGroupCount : 0
configured : True
defaultBrightness : 100
description :
deviceTypeId : bondBridge
displayStateId : brightnessLevel
displayStateImageSel : DimmerOff
displayStateValRaw : 0
displayStateValUi : 0
[color=#FF0040]enabled : True[/color]
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState :
folderId : 248442714
globalProps : MetaProps : (dict)
com.flyingdiver.indigoplugin.bondhome : (dict)
address : 192.168.1.206 (string)
token : fd5b9d4919622779 (string)
greenLevel : None
id : 359596630
lastChanged : 2022-11-10 11:12:20
lastSuccessfulComm : 2022-11-10 11:12:20
ledStates : []
model : Bond Home Bridge
name : Bond Home
onBrightensToDefaultToggle : False
onBrightensToLast : False
onState : False
ownerProps : com.flyingdiver.indigoplugin.bondhome : (dict)
address : 192.168.1.206 (string)
token : fd5b9d4919622779 (string)
pluginId : com.flyingdiver.indigoplugin.bondhome
pluginProps : emptyDict : (dict)
protocol : Plugin
redLevel : None
remoteDisplay : True
sharedProps : com.indigodomo.indigoserver : (dict)
states : States : (dict)
bondid : ZZCJ10166 (string)
brightnessLevel : 0 (integer)
devcount : (string)
fw_date : Wed Aug 11 21:00:02 UTC 2021 (string)
fw_ver : v2.21.4 (string)
location : Guest Bedroom (string)
make : Olibra (string)
model : BD-1000 (string)
name : Ryan’s Bond Bridge (string)
onOffState : off (on/off bool)
uptime_s : 4792452 (integer)
subModel :
subType :
supportsAllLightsOnOff : False
supportsAllOff : False
supportsColor : False
supportsOnState : True
supportsRGB : False
supportsRGBandWhiteSimultaneously : False
supportsStatusRequest : True
supportsTwoWhiteLevels : False
supportsTwoWhiteLevelsSimultaneously : False
supportsWhite : False
supportsWhiteTemperature : False
version : None
whiteLevel : None
whiteLevel2 : None
whiteTemperature : None
for device in indigo.devices.iter("indigo.relay, indigo.dimmer"):
if device.pluginId != "com.perceptiveautomation.indigoplugin.devicecollection":
if (isinstance(device, indigo.DimmerDevice)):
print(f"{device.name} is a dimmer")
else:
print(f"{device.name} is a relay")
>>> for device in indigo.devices.iter("indigo.relay, indigo.dimmer"):
... if (isinstance(device, indigo.DimmerDevice)):
... print(f"{device.name} is a dimmer")
... else:
... print(f"{device.name} is a relay")
...
000 KeypadLinc is a dimmer
009 - Plug-In Appliance Module's name is a relay
010 - Smart Fan was here is a dimmer
038 - Lamp Module (AD130) is a dimmer
automatic door is a relay
bestätigt für explicaría por qué está léger problème sûr c'è is a relay
Device Group Brightness >= 50% All On is a relay
Device Group Brightness On Relay On All On is a relay
Device Group Brightness On Relay On Any On is a relay
FanLinc - Light is a dimmer
Fortrezz Siren is a relay
Fortrezz Strobe is a relay
Generic X10 Appliance Module is a relay
HS-WD200+ is a dimmer
Hue Bulb is a dimmer
Hue Testing Bulb is a dimmer
Insteon Dimmer is a dimmer
Insteon On/Off (back door in alexa) is a relay
Kasa Dual #1 is a relay
Kasa Dual #2 is a relay
Kasa Plug is a relay
LZW36-SN Dimmer is a dimmer
LZW36-SN Fan is a dimmer
office outlet is a relay
Office Siren is a relay
outdoor-module is a relay
Simple Virtual On/Off is a relay
SwitchLinc Dimmer is a dimmer
Virtual On/Off Device w/ Manual State is a relay
Virtual On/Off Device w/ Var Status is a relay
ZEN30 Dimmer is a dimmer
ZEN30 Relay is a relay
ZEN32 is a relay
ZEN77 Dimmer is a dimmer
for device in indigo.devices.iter("indigo.relay, indigo.dimmer"):
if (isinstance(dev, indigo.DimmerDevice)):
# do dimmer stuff here
else:
# do relay stuff here
>>> for dev in indigo.devices:
... if (dev.subType == "Switch" or dev.subType == "Dimmer"):
... if (dev.subType == "Switch"):
... print(f"{dev.name} : {dev.subType} : {dev.onState} : {dev.id} ")
... else:
... print(f"{dev.name} : {dev.subType} : {dev.brightness} : {dev.id} ")
The other weird thing is that in the log, it shows that a totally different Schedule, one that fires at 6:15am, running at the same time, but with "(delayed action)" after it. But that Schedule has no delay on it, and it turns devices On, not Off.
os.system("open /Applications/Safari.app https://forums.indigodomo.com/viewtopic.php?f=81&t=26696")
set wakeAfterSeconds to "5"
set myPassword to "the password for your Mac account that's running Indigo"
set now to do shell script "date -r $(date +%s) '+%m/%d/%y %H:%M:%S'"
set wakeTime to do shell script "date -jv +" & wakeAfterSeconds & "S -f " & ¬
quoted form of "%m/%d/%y %H:%M:%S" & " " & quoted form of now & " " & ¬
quoted form of "+%m/%d/%y %H:%M:%S"
do shell script "pmset schedule wake " & quoted form of wakeTime password myPassword with administrator privileges
2021-11-10 06:49:56.847 Web Server Indigo Touch client connected from 192.168.86.163
2021-11-10 06:49:57.543 Action Group Nursery slow up to 50%
2021-11-10 06:49:57.570 Sent INSTEON "PowerLinc Interface" on (scene 1 - Nursery on slow)
2021-11-10 06:49:57.572 Trigger Arthur's light at night
2021-11-10 06:49:58.400 Sent INSTEON "Nursery light" on (scene 1 cleanup)
2021-11-10 06:49:59.423 Received INSTEON "Nursery light" on
2021-11-10 06:50:05.877 Domotics Pad Mobile Client Debug Push notification sent successfully
2021-11-10 06:51:28.469 Action Group All lights on
2021-11-10 06:51:28.491 Sent INSTEON "PowerLinc Interface" on to 100% (instant) (scene 3 - All lights on)
sumocomputers wrote:I did notice the cycle goes backwards from what I would expect (HIGH>MED>LOW>OFF>REPEAT) instead of (OFF>LOW>MED>HIGH>REPEAT), but maybe that is how analog fan controller remotes work...I don't have any of those.
left_garage = indigo.variables[1470346067].value
right_garage = indigo.variables[1731578180].value
if left_garage == 'true':
indigo.actionGroup.execute(589155825)
if right_garage == 'true':
indigo.actionGroup.execute(1460987012)
ryanbuckner wrote:Question: Is there an easier way to exclude 1 light without creating a virtual group of every other light in the house?
#!/sheBangs/sheBangs♫ -o hBaby | when she && mv ./es♫
\ READ FORWARD, BUILD BACKWARDS (IN SECTION BOTTOM->TOP)
## VIRTUAL DEVICE DEF
def norte_aircon:
virtualDevice "norte_aircon_vent"
exec.off"actionGroup_norte_aircon_kickstart_on_vent"
exec.on"actionGroup_norte_aircon_kickstart_on_kill"
print.status"norte_aircon_on_vent"
virtualDevice "norte_aircon_cool"
exec.on"actionGroup_norte_aircon_kickstart_on_vent"
exec.off"actionGroup_norte_aircon_kickstart_on_kill"
print.status"norte_aircon_on_cool"
## KEYPAD/BUTTON CONTROL -- DEVICE-INITIATED TRIGGERS DEF
trigger ("if norte:kpad-bttn2 sends insteonON turnOFF aircon-norte")
trig.type = insteon command received
trig.from = device.keypadLincNorte
trig.received = on.buttonGroup2
eval:
always:
is: True
exec 1:
action1.delay: 00:00:00
action1.type: exec actionGroup
action1.group: actionGroup_norte_aircon_kickstart_on_kill
else:
exec 1:
else.type: doNothing
trigger ("if norte:kpad-bttn4 sends insteonON turnON aircon-norte @vent")
trig.type = insteon command received
trig.from = device.keypadLincNorte
trig.received = on.buttonGroup4
eval:
always:
is: True
exec 1:
action1.delay: 00:00:00
action1.type: exec actionGroup
action1.group: actionGroup_norte_aircon_kickstart_on_vent
else:
exec 1:
else.type: doNothing
trigger ("if norte:kpad-bttn6 sends insteonON turnON aircon-norte @cool")
trig.type = insteon command received
trig.from = device.keypadLincNorte
trig.received = on.buttonGroup6
eval:
always:
is: True
exec 1:
action1.delay: 00:00:00
action1.type: exec actionGroup
action1.group: actionGroup_norte_aircon_kickstart_on_cool
else:
exec 1:
else.type: doNothing
## KICKSTARTERS DEF
def actionGroup_norte_aircon_kickstart_on_kill
exec 1:
action1.delay: 00:00:00
action1.type: modify variable
action1.variable: "norte_aircon_kickstart_on_kill"
action1.value: +=1
def actionGroup_norte_aircon_kickstart_on_vent
exec 1:
action1.delay: 00:00:00
action1.type: modify variable
action1.variable: "norte_aircon_kickstart_on_vent"
action1.value: +=1
def actionGroup_norte_aircon_kickstart_on_cool
exec 1:
action1.delay: 00:00:00
action1.type: modify variable
action1.variable: "norte_aircon_kickstart_on_cool"
action1.value: +=1
## KICKSTARTED CONTROL -- CONDITION-MATCHED TRIGGERS
trigger ("norte_aircon_kickstart_on_kill detection")
trig.type = variable changed
trig.variable = norte_aircon_kickstart_on_kill
trig.value = changes
eval:
always:
is: True
exec 1:
action1.delay: 00:00:00
action1.type: exec actionGroup
action1.group: "actionGroup_norte_aircon_on_kill"
exec 2:
action2.delay: 00:00:01
action2.type: enable schedule
action2.disable: "norte_aircon_on_kill_runtime"
else:
exec 1:
else.type: doNothing
trigger ("norte_aircon_kickstart_on_vent detection")
trig.type = variable changed
trig.variable = norte_aircon_kickstart_on_vent
trig.value = changes
eval:
always:
is: True
exec 1:
action1.delay: 00:00:00
action1.type: exec actionGroup
action1.group: "actionGroup_norte_aircon_on_vent"
exec 2:
action2.delay: 00:00:01
action2.type: enable schedule
action2.disable: "norte_aircon_on_vent_runtime"
else:
exec 1:
else.type: doNothing
trigger ("norte_aircon_kickstart_on_cool detection")
trig.type = variable changed
trig.variable = norte_aircon_kickstart_on_cool
trig.value = changes
eval:
if:
cond1.type: systemVariable
cond1.dark: True
or:
cond2.type: device
cond2.device: "insteon wireless thermostat, non-climate controlled area"
cond2.property: zone1temperature
cond2.value: > 34
or:
cond3.type: variable
cond3.variable: norte_aircon_enabled
cond3.value: True
or:
cond4.type: variable
cond4.variable: norte_aircon_enabled_override
cond4.value: True
exec 1:
action1.delay: 00:00:00
action1.type: exec actionGroup
action1.group: "actionGroup_norte_aircon_on_cool"
exec 2:
action2.delay: 00:00:01
action2.type: enable schedule
action2.disable: "norte_aircon_on_cool_runtime"
else: # not input anywhere, just for reference
exec:
else.type: doNothing
## L0 ACTIONGROUPS DEF
def actionGroup_norte_aircon_on_kill
exec 1:
action1.delay: 00:00:00
action1.type: modify variable
action1.variable: "norte_aircon_on_vent"
action1.value: False
exec 2:
action2.delay: 00:00:01
action2.type: modify variable
action2.variable: "norte_aircon_on_cool"
action2.value: False
exec 3:
action3.delay: 00:00:02
action1.type: disable schedule
action1.disable: "norte_aircon_on_vent_runtime"
exec 4:
action4.delay: 00:00:03
action4.type: disable schedule
action4.disable: "norte_aircon_on_cool_runtime"
exec 5:
action5.delay: 00:00:04
action5.type: modify variable
action5.variable: "norte_aircon_on"
action5.value: False
exec 6:
action6.delay: 00:00:05
action6.type: send device specific command (harmony hub actions)
action6.device: "harmonyHub"
harmonyHub.device: airconnorte
harmonyHub.commandGroup: home
harmonyHub.command: powerOFF
def actionGroup_norte_aircon_on_vent
exec 1:
action1.delay: 00:00:00
action1.type: modify variable
action1.variable: "norte_aircon_on_cool"
action1.value: False
exec 2:
action2.delay: 00:00:01
action2.type: disable schedule
action2.disable: "norte_aircon_on_kill_runtime"
exec 3:
action3.delay: 00:00:02
action3.type: disable schedule
action3.disable: "norte_aircon_on_cool_runtime"
exec 4:
action4.delay: 00:00:03
action4.type: exec actionGroup
action4.group: "actionGroup_norte_aircon_on_L2"
exec 5:
action5.delay: 00:00:04
action5.type: modify variable
action5.variable: "norte_aircon_on_vent"
action5.value: True
exec 6:
action6.delay: 00:00:06
action6.type: send device specific command (harmony hub actions)
action6.device: "harmonyHub"
harmonyHub.device: airconnorte
harmonyHub.commandGroup: miscellaneous
harmonyHub.command: fanOnly
def actionGroup_norte_aircon_on_cool
exec 1:
action1.delay: 00:00:00
action1.type: modify variable
action1.variable: "norte_aircon_on_vent"
action1.value: False
exec 2:
action2.delay: 00:00:01
action2.type: disable schedule
action2.disable: "norte_aircon_on_kill_runtime"
exec 3:
action3.delay: 00:00:02
action3.type: disable schedule
action3.disable: "norte_aircon_on_vent_runtime"
exec 4:
action4.delay: 00:00:03
action4.type: exec actionGroup
action4.group: "actionGroup_norte_aircon_on_L2"
exec 5:
action5.delay: 00:00:04
action5.type: modify variable
action5.variable: "norte_aircon_on_cool"
action5.value: True
exec 6:
action6.delay: 00:00:06
action6.type: send device specific command (harmony hub actions)
action6.device: "harmonyHub"
harmonyHub.device: airconnorte
harmonyHub.commandGroup: miscellaneous
harmonyHub.command: 28
## L2 ACTIONGROUPS DEF
# "actionGroup_norte_aircon_on_L2" & "norte_aircon_poweron_runtime" can be swapped
# in the actionsGroups above therefore, there's no need to define both.
\def actionGroup_norte_aircon_on_L2:
\ exec 1:
\ action1.delay: 00:00:00
\ action1.type: conditional_eps_super_conditions
\ conditional.conditions: variable value
\ conditional.variable: norte_aircon_on
\ conditional.value: == False
\ exec 1.1:
\ action1.type: exec actionGroup
\ action1.group: "actionGroup_norte_aircon_on_L3"
\ conditional.else:
\ exec 1.2:
\ action2.type: doNothing
## L3 ACTIONGROUPS DEF
def actionGroup_norte_aircon_on_L3:
exec 1:
action1.delay: 00:00:00
action1.device: "harmonyHub"
harmonyHub.device: airconnorte
harmonyHub.commandGroup: home
harmonyHub.command: powerON
exec 2:
action2.delay: 00:00:01
action2.type: modify variable
action2.variable: norte_aircon_on
action2.value: True
## SCHEDULES DEF
# Create schedules without actions so they can be added right away.
# Adding no actions to them allows to duplicate actionGroups to finish quicker,
# Indigo doesn't notice when a component in a program is updated, therefore
# adding the action at a later stage forces Indigo to notice things changed.
schedule("norte_aircon_on_kill_runtime") interval 300 # seconds
exec actionGroup_norte_aircon_on_kill
schedule("norte_aircon_on_vent_runtime") interval 600 # seconds
exec actionGroup_norte_aircon_on_vent
schedule("norte_aircon_on_cool_runtime") interval 600 # seconds
exec actionGroup_norte_aircon_on_cool_L0
\schedule "norte_aircon_poweron_runtime" interval 1 # seconds
\ !print(ExecutionInEventLog) # way too many at ^^^^^^^ interval!
\ eval:
\ if:
\ cond1.type: variable
\ cond1.variable: norte_aircon_on
\ cond1.value: True
\ exec 1:
\ action1.delay: 00:00:00
\ action1.type: exec actionGroup
\ action1.group: "actionGroup_norte_aircon_on_L3"
\ else:
\ exec 1:
\ else.type: doNothing
schedule (norte_aircon_enable) interval .at!Sunset
exec 1:
action1.type: modify variable
action1.variable: norte_aircon_enabled
action1.modify: True
schedule (norte_aircon_disable) interval .at!Sunrise
exec 1:
action1.type: modify variable
action1.variable: norte_aircon_enabled
action1.modify: False
exec 2:
action2.type: modify variable
action2.variable: norte_aircon_kickstart_kill
action2.modify: increment1
## VARIABLES DEF
norte_aircon_kickstart_kill = 356
norte_aircon_kickstart_vent = 356
norte_aircon_kickstart_cool = 357
norte_aircon_on = True|False
norte_aircon_on_vent = True|False
norte_aircon_on_cool = True|False
norte_aircon_enabled = True|False
norte_aircon_enabled_override = 1|0
daytime = True|False
# This is meant for devices that don't report status back to automation controllers,
# like ductless (mini split) AC units, the example here, hence all the repetition.
# Repetition also avoids manual override appliance-mounted buttons.
SCHEDULE "norte_aircon_poweron_runtime" IS A WORKAROUND FOR THE SUPERCONDITIONS PLUGIN,
IE; THE PLUGIN IS NOT DESIRED/COMPATIBLE/DISCONTINUED/ETC. THE DOWNSIDE IS THAT IT REPEATS CRAZY
FAST SO IT WOULD FKUP THE NEXT SCHEDULE READOUT BY HAVING IT ALWAYS BEING RIGHT NOW.
PowerLinc Linking - entered discovery linking mode (240 seconds)
PowerLinc Linking - sending engine version request to 50.E2.E8
PowerLinc Linking - received engine version 02 from 50.E2.E8
PowerLinc Linking - sending id request for device information to 50.E2.E8
PowerLinc Linking - received id request response from 50.E2.E8
PowerLinc Linking - initializing remote device "Basement Stairway Lights" (address 50.E2.E8, firmware version 45)
PowerLinc Linking - initialize complete
PowerLinc Linking - syncing remote device "Basement Stairway Lights" (address 50.E2.E8, firmware version 45)
PowerLinc Linking - syncing all links
PowerLinc Linking - . . . read: INSTEON dev link to controller 3D.98.1F, flags AA, group FE, data FF 1C 01
PowerLinc Linking - . . . read: INSTEON dev link to responder 3D.98.1F, flags E2, group 01, data 03 1F 00
PowerLinc Linking - . . . read: INSTEON dev link to controller 50.D7.BA, flags A2, group 01, data FF 1F 01
PowerLinc Linking - . . . read: INSTEON dev link to responder 50.D7.BA, flags E2, group 01, data 03 1F 00
PowerLinc Linking - . . found: PowerLinc responder for group 1
PowerLinc Linking - comparing local and remote links
PowerLinc Linking - . . match: remote link is identical to persistent link 50.D7.BA, flags A2, group 01
PowerLinc Linking - . . match: remote link is identical to persistent link 50.D7.BA, flags E2, group 01
PowerLinc Linking - compare complete
PowerLinc Linking - sync complete
PowerLinc Linking - device "Basement Stairway Lights" links updated
PowerLinc Linking - syncing PowerLinc links (address 3D.98.1F)
PowerLinc Linking - . . adding: INSTEON plc link to controller 50.E2.E8, flags 03, group 01, data 00 00 FF
PowerLinc Linking - . . adding: (not added -- probably already exists)
PowerLinc Linking - PowerLinc links updated
PowerLinc Linking - sync complete
PowerLinc Linking - exited linking mode
0x79 0x05 newVol newTone