FutureTense / keymaster

Home Assistant integration for managing Z-Wave enabled locks
MIT License
218 stars 44 forks source link

ISSUE: auto re-lock no longer working as of 0.0.86 #343

Closed mattriney closed 7 months ago

mattriney commented 7 months ago

Logs Logger: homeassistant.components.automation.keymaster_frontdoor_lock_notifications Source: helpers/script.py:1783 Integration: Automation (documentation, issues) First occurred: 9:02:18 AM (3 occurrences) Last logged: 9:03:04 AM

keymaster_frontdoor_start_timer: Error executing script. Error for call_service at pos 4: Timer timer.keymaster_frontdoor_autolock is not running, only active timers can be changed 9:02:58 AM – (ERROR) Script

Click on SUBMIT below to confirm you have fixed this automation.

I recently re-installed keymaster as I was unable to add/remove lock codes. That issue is fixed, however now auto lock functionality will work.

mattriney commented 7 months ago

I have re-generated packages multiple times along with looking at my automation scripts, which all seem to be in order.

firstof9 commented 7 months ago

keymaster_frontdoor Lock Notifications: Error executing script. Service not found for call_service at pos 1: Unable to find service script.keymaster_frontdoor_manual_notify

This error is because you haven't created a notify script. See the wiki.

mattriney commented 7 months ago

Ahh, I re-named my device when setting back up. Thanks for the catch on that. Fixed!

I'll go ahead and edit my issue description.

firstof9 commented 7 months ago

If you changed the name, use the keymaster.generate_package service call to regenerate the template scripts. Let me know if that helps.

mattriney commented 7 months ago

If you changed the name, use the keymaster.generate_package service call to regenerate the template scripts. Let me know if that helps.

I did regenerate after every change here. No changes to the autolock, no counting when the door is closed and unlocked.

firstof9 commented 7 months ago

I'm not entirely sure as I never used the autolock or door counting stuff. What do the script/automation traces say?

cdavis289 commented 7 months ago

Having same issue as @mattriney. Looking through the Home Assistant timer documents, service: timer.change can only be used on an active timer. The autolock script is applying that service call to an idle timer which is giving the error (line 111 of keymaster_common.yaml).

firstof9 commented 7 months ago

@roblamoreaux, thoughts?

cdavis289 commented 7 months ago

@firstof9 I did some more research and found this thread on the issue. The workaround seemed to be to start the timer and then call the timer.change service. At the end of the thread there was mention that the timer start parameter was not being deprecated (See here) I have no idea if it will be removed in the future.

firstof9 commented 7 months ago

So maybe the order of operations is wrong? the timer.start needs to come before the timer.change

cdavis289 commented 7 months ago

I just did a test and if you use timer.start without setting a duration it defaults to a duration of 0. I tried running a script with timer.start and then timer.change to add time to the timer entity but I received the error about only active timers can be changed. I think the changes in release 0.086 need to be reverted back to 0.085 where timer.start was used instead of timer.change.

roblamoreaux commented 7 months ago

@roblamoreaux, thoughts?

I am not sure. my instance auto-relocks with the changes I pushed. if the change to HA was reverted and it won't break keymaster I see no reason not to revert back.

I'm just confused why it would break for others when I've had it running without issue for a week.

cdavis289 commented 7 months ago

If you unlock one of your doors that auto-relic is you aren’t seeing the timer error in your logs? My locks still auto-relock but that is probably because I had set them to auto-relock via the lock interface before I had keymaster installed.

roblamoreaux commented 7 months ago

I just did some checking and the change should be rolled back. I Missed that changing the code in the custom directory didn't change the existing scripts it created. After manually changing the created script, it broke.

So please roll back the change

firstof9 commented 7 months ago

Reverted in 0.0.87

mattriney commented 7 months ago

Resolved in 0.0.87.

Thanks!