FutureTense / lock-manager

Home Assistant Lock Manager
55 stars 19 forks source link

ISSUE: Incorrect mapping between access_control sensor and message (BE469) #57

Closed mew1033 closed 3 years ago

mew1033 commented 3 years ago

It's possible I'm not understanding exactly what should be happening, but I think there is a mistake in the Status Report automation, at least for my BE469. I can see the correct values being reported in ozw-admin and in the event logs on Home Assistant, but the values of the status_report input_text don't seem to match up. Here's a list of all the values I've seen so far: image There should definitely be some manual lock/unlock actions in that list. Here's an event showing a manual unlock:

{
    "event_type": "state_changed",
    "data": {
        "entity_id": "sensor.front_door_lock_access_control_frontdoor",
        "old_state": {
            "entity_id": "sensor.front_door_lock_access_control_frontdoor",
            "state": "0",
            "attributes": {
                "node_id": nodeidnum,
                "label": "Clear",
                "friendly_name": "Front Door Lock: Access Control"
            },
            "last_changed": "2020-11-05T00:21:58.178727+00:00",
            "last_updated": "2020-11-05T00:21:58.178727+00:00",
            "context": {
                "id": "",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "sensor.front_door_lock_access_control_frontdoor",
            "state": "2",
            "attributes": {
                "node_id": nodeidnum,
                "label": "Manual Unlock Operation",
                "friendly_name": "Front Door Lock: Access Control"
            },
            "last_changed": "2020-11-05T07:13:59.546654+00:00",
            "last_updated": "2020-11-05T07:13:59.546654+00:00",
            "context": {
                "id": "",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2020-11-05T07:13:59.546663+00:00",
    "context": {
        "id": "",
        "parent_id": null,
        "user_id": null
    }
}

Any way I can help figure these out? I can trigger the events on my lock and report back if needed.

firstof9 commented 3 years ago

Based on just looking at the codes, it looks like User Code and Access Control seem to be swapped some how. 22/23 are codes your lock should not throw, but what's being reported as user codes there 0, 1, 2, 5, these look like the proper codes the lock should be throwing.

                 '1':'Manual Lock',
                '2':'Manual Unlock',
                '5':'Keypad Lock',
mew1033 commented 3 years ago

Makes sense. I've used codes 1, 2, and 5 a few times in this time frame. Let me know if I can help any more.

firstof9 commented 3 years ago

would you be able to post the CommandClass 113 from your zwcfg_xxxx.xml file for your lock?

mew1033 commented 3 years ago

@firstof9 I'm running ozw, so I have an ozwcache_xxxx.xml. I assume that is equivalent? If so, here's the CommandClass:

<CommandClass id="113" name="COMMAND_CLASS_NOTIFICATION">
    <Compatibility />
    <State>
        <CCVersion>3</CCVersion>
        <Encrypted>true</Encrypted>
        <StaticRequests>0</StaticRequests>
    </State>
    <Instance index="1" />
    <Value type="list" genre="user" instance="1" index="6" label="Access Control" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="9">
        <Help>Access Control Alerts</Help>
        <Item label="Clear" value="0" />
        <Item label="Manual Lock Operation" value="1" />
        <Item label="Manual Unlock Operation" value="2" />
        <Item label="Keypad Lock Operation" value="5" />
        <Item label="Keypad Unlock Operation" value="6" />
        <Item label="Auto Lock" value="9" />
        <Item label="Lock Jammed" value="11" />
        <Item label="Keypad Disabled" value="16" />
        <Item label="New Program Code Entered" value="18" />
    </Value>
    <Value type="list" genre="user" instance="1" index="7" label="Home Security" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="2">
        <Help>Home Security Alerts</Help>
        <Item label="Clear" value="0" />
        <Item label="Intrusion at Unknown Location" value="2" />
    </Value>
    <Value type="list" genre="user" instance="1" index="8" label="Power Management" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="3">
        <Help>Power Management Alerts</Help>
        <Item label="Clear" value="0" />
        <Item label="Replace Battery Soon" value="10" />
        <Item label="Replace Battery Now" value="11" />
    </Value>
    <Value type="list" genre="user" instance="1" index="9" label="System" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" vindex="0" size="3">
        <Help>System Alerts</Help>
        <Item label="Clear" value="0" />
        <Item label="Hardware Failure" value="1" />
        <Item label="Heartbeat" value="5" />
    </Value>
    <Value type="byte" genre="user" instance="1" index="256" label="Previous Event Cleared" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="0">
        <Help>Previous Event that was sent</Help>
    </Value>
    <Value type="byte" genre="user" instance="1" index="260" label="User Code" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="0">
        <Help>User Code ID that was used</Help>
    </Value>
    <Value type="string" genre="user" instance="1" index="261" label="User Code" units="" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="0" value="">
        <Help>User Code that was used</Help>
    </Value>
    <Value type="int" genre="config" instance="1" index="514" label="Automatically Clear Events" units="ms" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="-2147483648" max="2147483647" value="5000">
        <Help>Automatically Clear Events sent by a device after a number of Milliseconds</Help>
    </Value>
    <TriggerRefreshValue Index="6">
        <RefreshClassValue CommandClass="98" RequestFlags="0" Index="1" />
    </TriggerRefreshValue>
</CommandClass>
firstof9 commented 3 years ago

Exactly what I needed, thanks.

Basically your lock should only report the following codes:

        <Item label="Clear" value="0" />
        <Item label="Manual Lock Operation" value="1" />
        <Item label="Manual Unlock Operation" value="2" />
        <Item label="Keypad Lock Operation" value="5" />
        <Item label="Keypad Unlock Operation" value="6" />
        <Item label="Auto Lock" value="9" />
        <Item label="Lock Jammed" value="11" />
        <Item label="Keypad Disabled" value="16" />
        <Item label="New Program Code Entered" value="18" />

So I'm not sure where 22 is coming from. Maybe from when you had been using zwave? I do see we're missing Code 18, so I can get that added.

mew1033 commented 3 years ago

I've never had the zwave integration, only ever ozw. This lock was connected to SmartThings before moving to ozw.

firstof9 commented 3 years ago

Very odd, because as you can see, your lock only reports, 1 2 5 6 9 11 16 18 as codes 🤷‍♂️

mew1033 commented 3 years ago

Weird. Do you know how to fix the automation so it reports the correct message based on the code received by the access_control sensor? I was reading the automation that builds it and it's quite complex.

firstof9 commented 3 years ago

It is currently built to handle the codes from your lock already, minus code 18, that I'll submit a PR for.