Command in Hubitat

I am trying to run a command on a device in Hubitat. The device is a door/window sensor. I want to use the command “resetToClosed”, but I cant figure out how to do it.

This is the output from maker API.

{"name":"Xiaomi Door/Window Sensor","label":"Altand\u00f6rr","type":"Xiaomi Door/Window Sensor","id":"119","date":"2020-08-30T17:47:21+0000","model":null,"manufacturer":null,"capabilities":["Battery","ContactSensor","Sensor"],"attributes":{"battery":"100","dataType":"STRING","values":null,"batteryLastReplaced":"Wed Aug 12 16:47:19 CEST 2020","contact":"open","lastCheckin":"1598809590653","lastClosed":"1598797553589","lastOpened":"1598809641314"},"commands":[{"command":"resetBatteryReplacedDate"},{"command":"resetToClosed"},{"command":"resetToOpen"}]}

I use these sensors and was trying to get the battery replaced date reset to work but couldn’t. I gave up because of the rarity I have to do it and I could just do it through Hubitat easily.

May I ask why you are looking to do the reset to open/close? Do you have trouble with them?

I don’t have any trouble with them yet. I have set my rules up not to arm if a contact is open. If I would get any trouble with a contact sensor, it would be easy just to force it via Homeremote.

I have the same issue with my Daikin heatpump where I want to send “fanRateSilence”.

I solved it by adding the “DoorControl” capability to the driver code. Then I made a copy of the “resetToClosed” method and named it “close”.
Should work for the reset battery as well by just picking a random supported capability and then use a control method for that capability for the reset code.

May not be the best solution but it works! :slight_smile:

1 Like

Great to see you’ve found a solution. Yeah, I don’t really have a better way to accomplish this. The ContactSensor capability does not currently support any commands. It’s a read-only attribute. I may try to add those for a future release.