Configure from Rule?

Sent to support@, because I half-suspect the real solution will require a change in the driver, but posting here in case there's a solution or workaround I could get before Monday....

Iā€™m in the process of migrating areas of my house from SmartThings to Hubitat, and my latest device to move is an Aeotec Smart Switch 6. In SmartThings, I was using jbissonā€™s DTH, which exposed commands to WebCore to switch the device between Momentary, Energy, and Night Light mode. I then used a virtual switch to flip it between Momentary and Night Light. Itā€™s the night light in my sonā€™s room; automations turned it on/off based on a combination of time, mode, and a contact sensor on his door. Via the virtual switch, it could also be voice controlled from phone or Google Home.

Having moved it to Hubitat, itā€™s supported without a custom driver ā€“ yay! I can switch it between Momentary and Night Light from the settings, so thatā€™s a start. However, I canā€™t seem to change that via Rule Manager. Iā€™m trying to add it as a custom command, and the closest option I see is a ā€œconfigure()ā€ method, but thereā€™s nothing I can find that tells me what the arguments are to this command.

I can see from Live Logging that itā€™s flipping ā€œparameterNumber:81ā€ to 2 for Night Light and 1 for Momentary, but configure(81,1) gets a NullPointerException, so thatā€™s not it. Comparing to the ST DTH, I don't think configure() actually does what I want it to do (and this thread suggests the same thing) -- what I need is to send a particular config change to the device.

Is there anything I can do to generate a settings change from Rule Machine, or is this something that has to come from a code change in the driver to expose these as custom commands?

If you used the custom driver, you could use RM to create a custom command for whatever changed the settings. You'd just have to port the driver over, which is easier than you think for most of them. There's a thread with the common changes required for most drivers and it's worked for all the ones I've tried to do and I know next to nothing about groovy.

Good suggestion - it turned out to be a straight find/replace of the first item in that thread to make the driver work. I'd obviously like to see this added to the in-box driver, but this seems like a functional workaround for now.

1 Like