heggink / domoticz-nuki

python plugin for the nuki locks
MIT License
9 stars 5 forks source link

Door open function #5

Closed salopette closed 4 years ago

salopette commented 4 years ago

Hi, is it possible to build a function for opening the door? For example, I take a Xiaomi button and when pressed the lap is pulled in shortly and door is open?

heggink commented 4 years ago

I looked at it but the standard Domoticz lock doesn't give me the option to do that so I would need to ask for a change. Alternatively, I could create another device but that's a pretty ugly solution. Thoughts?

salopette commented 4 years ago

Maybe a simple push on button?

salopette commented 4 years ago

Vielleicht ein einfacher Knopfdruck?

Hi how does it look Just a button for it?

Endran commented 4 years ago

Yeah, seems like the best way to go to me as well. It isn't that ugly, is it? For open-close use a switch device, and for Unlatch and LockNGo, use Push On TypeName?

salopette commented 4 years ago

you can also make open as a name.

salopette commented 4 years ago

@heggink

Hi, would it be possible to open a button? I miss it very much

heggink commented 4 years ago

Hi salopette,

Apologies for my delay in response. The challenge I have is I enlisted in a fund raising thing for cancer research, treatment and care (https://www.opgevenisgeenoptie.nl/fundraisers/HermanEggink11388). The quid pro quo is that I have committed to (try to) get up the Alpe d'Huez 4 times on a bike resulting in me having to train usually 5 times a week (ranging from 2 to 4hrs per training).

Add that I am the commercial director (CCO) for a software company adding near weekly international travel to my schedule (including US trips) and you can imagine that I am struggling to complete this :-(.

I have looked at this and the solution itself is not that complex: 1) on startup, add a new device per lock for unlatching 2) add an onCommand action to unlatch the lock (http://{IP}:{port}/lockAction?nukiId={nuki_id}&deviceType=0&action=3&token={TOKEN}) 3) after issuing the command, return the domoticz device to the off state so you can retrigger it again

The only complexity I have is that I have numbered the domoticz devices successively (ie every lock has a device number of previous lock + 1) so I cannot just add a device as it will mess up existing installations as well as mess up the current lockactions. This needs a little thought before I am confident I can implement without messing up your current installation requiring you to reinstall the plugin.

Give me some time to think about it and try to test in my home situation and I will let you know. All help welcome of course. and, please please sponsor the cancer research :-):-).

H

heggink commented 4 years ago

btw: I have an android phone and Nuki support widgets so I have a widget on screen to unlatch the door itself. I am pretty sure they support the same on IOS. Maybe an workable interim solution for you?

heggink commented 4 years ago

Yeah, seems like the best way to go to me as well. It isn't that ugly, is it? For open-close use a switch device, and for Unlatch and LockNGo, use Push On TypeName?

My current thinking is to indeed create a push button since that does not require the 3rd step to return the device to the off state. Need to figure out how to create it in the python framework.

heggink commented 4 years ago

OK, so I gave it a try and added a new test branch called feature-unlatch. This creates an unlatch device per lock. I tested the unlatch with 1 of my locks (which worked) but, since I don't have multiple lucks on a single bridge, I cannot test that.

Have a try and see if it works for you. Do recognise that this has inherent security risks the moment you make widges of this on a mobile device. Imagine opening a door by accident...

heggink commented 4 years ago

And please select debug=true before you update the plugin so you can see what happens in case of any issues!!

olafmarcos commented 4 years ago

Yeah heggink! Tested and working. One bridge with one lock device and now the user who uses the function most (my wife) can do it all from domoticz app. Thank you very much!!

heggink commented 4 years ago

Great. I'll keep it in beta for a few more weeks.

If possible, please sponsor my cancer fundraising. Every euro counts, even if only 1!

heggink commented 4 years ago

Closed as no issues reported., Merge into main.