Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock State is always UNKNOWN #48

Open
clearwave1 opened this issue Nov 10, 2024 · 10 comments
Open

Lock State is always UNKNOWN #48

clearwave1 opened this issue Nov 10, 2024 · 10 comments

Comments

@clearwave1
Copy link

Even though the Status sensor is being set correctly (most of the time it reads Locked), the state of the Lock (cover) is always UNKNOWN.

I looked at the code and don't see state being set anywhere and the async_update code does nothing.

I am assuming it is related but the button icons for open and close are the same.

@clearwave1
Copy link
Author

@rospogrigio , @formatBCE - any thoughts?

@formatBCE
Copy link
Contributor

I have no idea... Probably, the lock protocol changed during this year's. My lock is long gone, @rospogrigio abandoned this repo I guess...

@rospogrigio
Copy link
Owner

Actually I haven't abandoned this repo, but I'm still stuck with the problem I reported in #46 so my appliance is still not working and I've been having personal issues so I never had the time to dive deeply into it and fix it. BTW I don't know if you have any suggestion @formatBCE on how I can debug it... thank you.
If I get to have my device up and running again I can check if I have the same issue that you @clearwave1 are reporting.

@djk314
Copy link

djk314 commented Nov 15, 2024

Is it possible to force open or close without looking at the status ? When i use my real key it's appear Jammed, if i use original app to close or open it it work again, i don't need the status lock or close, just want to force it to close or open.

@rospogrigio
Copy link
Owner

rospogrigio commented Nov 15, 2024

Is it possible to force open or close without looking at the status ? When i use my real key it's appear Jammed, if i use original app to close or open it it work again, i don't need the status lock or close, just want to force it to close or open.

Yes, you should comment out the if self._device.curr_state == LOCK_STATE_OPERATING: line (the following indented block) in cover.py, in async_open and async_close methods. Give it a try.

@formatBCE
Copy link
Contributor

@rospogrigio sorry, looks like it's me who abandoned it. :(
I will try to help with ESP!

@djk314
Copy link

djk314 commented Nov 15, 2024

Is it possible to force open or close without looking at the status ? When i use my real key it's appear Jammed, if i use original app to close or open it it work again, i don't need the status lock or close, just want to force it to close or open.

Yes, you should comment out the if self._device.curr_state == LOCK_STATE_OPERATING: line (the following indented block) in cover.py, in async_open and async_close methods. Give it a try.

I'm on thx, i will tell if it worked.
Edit : It not work when i comment out "if self._device.curr_state == LOCK_STATE_OPERATING: "
The button in home assisant is greyed and can't open or close anymore, do i need to comment all ?

async def async_open_cover(self, **kwargs):
"""Open the cover."""
if self._device.curr_state == LOCK_STATE_OPERATING:
_LOGGER.warning("Operation already in progress: please wait")
raise Exception("Operation already in progress: please wait")
return

    _LOGGER.debug("Launching command to open")
    await self._device.operateLock(1)

async def async_close_cover(self, **kwargs):
    """Close cover."""
    if self._device.curr_state == LOCK_STATE_OPERATING:
        _LOGGER.warning("Operation already in progress: please wait")
        raise Exception("Operation already in progress: please wait")
        return

    _LOGGER.debug("Launching command to close")
    await self._device.operateLock(2)

Or do i need to change LOCK_STATE somewhere ? I tried only the line not all this block.

Or do something like that ?

async def async_open_cover(self, **kwargs):
"""Open the cover."""
_LOGGER.debug("Launching command to open")
await self._device.operateLock(1)

async def async_close_cover(self, **kwargs):
"""Close cover."""
_LOGGER.debug("Launching command to close")
await self._device.operateLock(2)

So i did that in custom_device.py
@Property
def isjammed(self) -> bool | None:
if self.curr_state == LOCK_STATE_LOCKED:
return True
else:
return False

Now HA entity work, but i need to jam it to see if it work.

@clearwave1
Copy link
Author

While that is not my original issue, I have had my lock start showing JAMMED at least once a day as well.

You code above will not help this. Here is my code base on what @rospogrigio suggested:

"""
if self._device.curr_state == LOCK_STATE_OPERATING:
_LOGGER.warning("Operation already in progress: please wait")
raise Exception("Operation already in progress: please wait")
return
"""

The 3 quotes are how you comment out a multi-line block in Python. I have done this in both the open and close methods.

After I made the change I had another JAMMED state and the lock will now open anyway.

I hope this helps.

@clearwave1
Copy link
Author

@rospogrigio - if you can let me know where the cover state should be updated, I can code and test on my side since I have a working lock and then make a PR for the changes.

@djk314
Copy link

djk314 commented Nov 20, 2024

This one work after a Jammed status :
custom_device.py

def isjammed(self) -> bool | None:
if self.curr_state == LOCK_STATE_LOCKED:
return True
else:
return False
But statuts is locked if it's jammed, it work so i don't care status for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants