To prepare this I need to know what kind of energy is used at certain times, so I tried to start with a simple trigger that logs the current energy usage.
Should be straight forward? Yes. Is it? Well...
Added a new trigger for the device for the Current Power (Watts) on any change.
Action is Write to Log and then the journey begins...
I need to enter %%d:DEVICEID:STATEKEY%% as is mentioned in the explanation. But it is a bit hard to read as the text is dark grey on a light grey background. And the first % is at the end of the preceding line.
Next I need to determine the DEVICEID. That's easy. And the STATEKEY.
But where do I get that? It is not "Current Power (Watts) as shown in the Trigger tab.
It should be "...the state identifier as found in the documentation for built-in devices...".
So let's dive into the Indigo Object Model Reference for Devices. There it lists the Device Base Class with the Base Class Properties. And one of the properties is "energyCurLevel".
However entering %%d:60534787:energyCurLevel%% is not accepted.
The only other info to be found on this page is that you can get an indigo.Dict() of the device states. So I opened a scripting shell and entered:
- Code: Select all
>>> dev = indigo.devices["Wasdroger"]
>>> for state in dev.states:
... print(state)
...
accumEnergyTimeDelta
accumEnergyTimeDelta.ui
accumEnergyTotal
accumEnergyTotal.ui
curEnergyLevel
onOffState
>>>
Aha! This looks like the info I might be looking for.
Entered %%d:60534787: curEnergyLevel%% in the Trigger Action and now it is accepted.
Searched for curEnegeryLevel on the IndigoDomo site to see if I might have missed something, but there is no mention at all of this.
I think there is some room for improvement here. It shouldn't be that difficult to create a trigger like this.
It took a lot of energy on my side to get this to work.