[RELEASE] Auto Lock

Not sure how to use the app. It shows "null" in the app for any contact sensor I choose (Visonic or GoControl/Eco), same w/Motion sensors (Iris v2 and v3).

Logs don't show anything. I enabled OATH, wasn't sure if that's required. Feeling a bit "DOH!" here. :slight_smile:

Front door contact Sensor selected:


Motion Sensor selected:

In both cases hit the button to refresh status.

Battery info is showing up in Battery Monitor app:

image
2021-02-08 15_59_39-Battery Monitor

Just stick the contact sensor in the battery input. Doesn't need oauth.

Yup, did that. (Oops, wrong screen grab at first.) :slight_smile:

image

App shows all null...I have hit the "Refresh" button in the app.

Can you send me a link to the battery app? Maybe they're doing something different to get the battery.

1 Like

It's probably something obvious like device.currentBattery. you could change it real quick and see under contact battery handler. Change currentValue("battery") to currentBattery. If that works I'll roll it into the code.

It's in HPM...was pulled over from ST by Larry...

Forum post on it:

I have the same Visonic MCT-340 E sensors.

1 Like

Do they show battery in the Auto Lock app?

No they do not show battery in the app. But they do update battery level daily.

1 Like

Two possible solutions, copy the battery handler contents into the contact handler.

Add contactBattery mention a bit ago.

Watching the kids right now so I'm not in front of my pc at the moment.

1 Like

Is this what you meant? Changed in two places.

Or do you mean to replace the entire statement "currentValue("battery")" with "currentBattery"?

I did as above image and saved...if I did what you meant and it works, I assume battery status won't update until the next time the contact sensor reports.

You could probably get rid of the ("battery") for both on that line but of it's working no need.

No errors on the Save so I assume it's not breaking anything.

K - so I'll wait until the next battery report (likely tomorrow AM) and I'll let you know what happens. :slight_smile:

Just change it real quick and see. You could copy that line into the contactContactHandler as an if statement and trigger it by opening the door.

1 Like

Code Change:

App unchanged:
image

It's still waiting on an event though try copying that line outside of the method like somewhere in the main page and see if it updates.

Change it to an if statement and close the bracket on the end.

Doesn't really matter where you stick it. Just insert a line after one of the input lines near the top. Then save and refresh device toggle.

Bingo, bingo, bingo, and bingo is the name-o. :wink:

Change: (Added line 58)

Result: Accurate battery info!

Man - you did this w/twins in your hands!! :wink:

They're both sitting in my lap.

1 Like

I'll add contactBattery to the next build.

1 Like

You mean currentBattery - twin's typo, I assume. :smiley: