Background:
I wondered how Smarthome's HouseLinc 2 software maintained synchronization between it's internal link database and that of wireless INSTEON devices. I wondered if it required a user to physically press and hold the SET button on those devices every time they wanted to change settings or device-to-device links. It turns out that you don't have to when using HouseLinc 2 (except for the first time you sync the device). The way they do this is by delaying all link database and device configuration tasks until the device is awoken by some kind of user interaction (e.g. motion detected, causing the device to wake up and send an ON command). The motion sensors and TriggerLincs both stay awake for a very short time after sending any command, which allows another device (like a PowerLinc Modem) to send configuration commands to it while it's still awake. The wireless device will stay awake for as long as it's receiving communication from other devices (plus a few hundred milliseconds after the last received message).
Indigo Solution:
Let's say you want to keep track of the battery level in a frequently used motion sensor. You could wait for the motion sensor to send the Group 3 ON message (indicating low battery), but you might rather monitor the battery voltage on a regular basis.
EDIT: Be sure your motion sensor jumper 5 is connected before doing any of this. That jumper must be connected to do any remote management.
Use the below steps to do that.
- Create an Indigo variable to store the motion sensor's battery level info (e.g. "hallway_motion_battery")
- Create a new trigger in Indigo, perhaps named something like "hallway motion battery check". In the Trigger tab, specify the Type as "INSTEON Command Received". Select the motion sensor device you wish to monitor. Set the Received command to "On", "Group 1 (motion detected)".
- In the Conditions tab, select "Always". The frequency at which Indigo requests battery status can be limited in the next tab.
- In the Actions tab, select "Execute Script" as the Type of action. Select the "Embedded" radio button, making sure "Python" is the script type. Enter the following Python code into the text entry area, making sure to replace the actual device name for your motion sensor where "hallway motion" appears in the first line and replacing "hallway_motion_battery" for the variable name you chose in step 1 above.
- Code: Select all
instnAddr = indigo.devices["hallway motion"].address
serverBattery = indigo.variables["hallway_motion_battery"]
indigo.server.log("Checking motion sensor battery level.")
reply = indigo.insteon.sendRawExtended(instnAddr, [0x2E, 0x00], waitForExtendedReply=True)
batteryLevel = reply.replyBytes[13]
indigo.server.log("Battery level (approx. Volts): " + str(float(batteryLevel / 10.0)))
indigo.variable.updateValue(serverBattery, str(float(batteryLevel / 10.0)))
- Click "OK" to save the trigger (We'll get to limiting the battery check frequency in the next steps, but clicking "OK" here is necessary in order for the next steps to work).
- Double-click on the trigger you just created ("hallway motion battery check" if you named it like in this example) to edit it.
- Click on the Actions tab and click the "Add New" button at the bottom.
- Set the new action Type to "Disable Trigger" and select the trigger you're editing ("hallway motion battery check" in this example) as the trigger to disable. Put a check in the box for "Auto-enable after" and enter a delay before the trigger re-enables itself. For a high traffic area, a delay of 120 minutes should keep the Indigo variable updated with the battery level frequently enough.
- Click "OK". You're done.
You can duplicate this trigger for other motion sensors, changing the trigger name as well as the device name, variable name, and trigger selection in the Actions tab.
You can also use the same method to query the current ambient light sensor value, change the motion sensor's red LED brightness (or turn it off altogether), change the motion sensor's mode and adjust the motion sensor's timeout period before sending an OFF command, all using the Python code I posted in this thread in place of the above code.
Disclaimer:
Keep in mind that sending the INSTEON extended data command as shown above takes more time than a basic INSTEON ON or OFF command, so whenever this trigger is activated, you may notice a longer delay for other triggers activated by the same motion sensor. That's why the trigger shouldn't be activated for every time a motion sensor is activated.