How to copy the position of one shade to another when switch actuates

I have a scenario where I have a blind that needs to close when a virtual switch turns on and then move to the same position as the blind next to it when the switch turns off.

I got the first part no problem, the second part I'm having trouble with. I made a rule that triggers on the switch turning off, then it refreshes the blind next to it and sets a local variable to that blind's position. Then I have an action that sets the position of the original blind.

When this rule runs, the log shows an error Error: Cannot invoke method toInteger() on null object

Worse, when trying to edit the rule, the same error occurs so it is no longer editable.

Anyone have any hints as to how to do this the right way? I'm a noob here :slight_smile:

Could you show a screenshot of your whole rule, including trigger events, actions to run, and local variables you've set up? From what you've described above, that sounds like it may no longer be possible, but I figure it's worth asking. Nothing sounds egregiously wrong with what you've described.

If you can't edit the rule, your best bet may be to just delete it (click the gear/cogs/status icon in the upper right of the rule page or to the left of the rule name in the "Apps" list, and there should be a "Remove" button there even if you can't get into the rule normally; do this on the "child app"/rule, not the entire Rule Machine app). Then, create a new rule and try the same. Maybe not exactly the same if you think something was a problem, but feel free to take a screenshot and share as you progress. :slight_smile:

PS - and welcome to Hubitat!

Ok here is the rule - I recreated it.

That looks good! Can I assume it still doesn't work? If it doesn't work, what blinds are you using (device/model) and what driver ("Type:" on the device page in the admin UI) are you using?

They are iBlinds and I'm using a slightly modified driver from https://raw.githubusercontent.com/RMoRobert/Hubitat/master/drivers/iBlinds.groovy, I removed the dimmer capabilities cuz it makes a ton of extra devices in my apple home system.

Set logging to max (debug) and see what shows up in the logs.

Well, the good news is that that's my driver, so I can probably help troubleshoot it. :slight_smile: (I can say that it's unlikely to be a Rule Machine problem.) I second the advice above to turn on logging, and if you can capture a screenshot of the error that either RM or the driver throws, that would be great!

I also confess that I almost always use level instead of position for blinds (this is a dimmer-esque attribute that a lot of blinds/shades drivers implement because position is specific to those devices and not as widely usable in as many apps). I'll try to figure out what's going on, but if you don't get the same behavior with level as with position, there could be something with the way the latter is implemented.

Thank you for taking the time to offer suggestions :wink:

I tried a couple of things... first was the same setup just with logging higher:

dev:1042020-05-13 06:38:22.724 am infoBlind E24 windowShade position is closed
dev:1042020-05-13 06:38:22.705 am infoBlind E24 level is 0
dev:1042020-05-13 06:38:22.622 am infoBlind E24 switch is off
dev:1042020-05-13 06:38:22.585 am debugDimmer events:  SwitchMultilevelReport(value:99)
dev:1042020-05-13 06:38:22.581 am debugSwitchMultilevelReport: SwitchMultilevelReport(value:99)
dev:1042020-05-13 06:38:22.520 am debugparse: zw device: 1A, command: 2603, payload: 63 FF 00 , isMulticast: false
app:1122020-05-13 06:38:22.515 am errorjava.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 639 (allHandler)
app:1122020-05-13 06:38:22.197 am infoAction: Set blind23pos to Blind E23 position
app:1122020-05-13 06:38:22.065 am infoReset blind Triggered
app:1122020-05-13 06:38:22.027 am infoReset blind: On Video Call In Office switch off
dev:1082020-05-13 06:38:21.339 am infoOn Video Call In Office was turned off
dev:1042020-05-13 06:38:13.952 am debugsetPosition(0, 0)
dev:1082020-05-13 06:38:12.812 am infoOn Video Call In Office was turned on

The next, try was to put your unmodified driver back into place and use the dimmer settings instead of shade, same result tho, and after the rule runs, it is broken in the same way (can't be edited).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.