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

Door Condition per 1.6 specs, adds DoorSense support #2196

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config/Localization.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Localization xmlns="https://github.com/OpenZWave/open-zwave" Revision="8">
<Localization xmlns="https://github.com/OpenZWave/open-zwave" Revision="9">
<CommandClass id="113">
<!-- Please keep Localization.xml in sync with NotificationCCTypes.xml -->
<!-- If you are adding new Types or Params, Please also consider updating ValueIDIndexesDefines.def -->
Expand Down Expand Up @@ -587,6 +587,10 @@
<Help>State of the Interior Handle Control</Help>
<Label>Inside Handle Control</Label>
</Value>
<Value index="7">
<Help>State of Latch, Bolt, and Door</Help>
<Label>Door Condition</Label>
</Value>
</CommandClass>
<CommandClass id="76">
<Label>COMMAND_CLASS_DOOR_LOCK_LOGGING</Label>
Expand Down
15 changes: 14 additions & 1 deletion config/august/asl-03.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Product Revision="2" xmlns="https://github.com/OpenZWave/open-zwave">
<Product Revision="3" xmlns="https://github.com/OpenZWave/open-zwave">
<MetaData>
<MetaDataItem name="OzwInfoPage">http://www.openzwave.com/device-database/033F:0001:0001</MetaDataItem>
<MetaDataItem name="ProductPic">images/august/asl-03.png</MetaDataItem>
Expand Down Expand Up @@ -33,8 +33,21 @@ time.</MetaDataItem>
<MetaDataItem id="0001" name="FrequencyName" type="0001">U.S. / Canada / Mexico</MetaDataItem>
<ChangeLog>
<Entry author="Justin Hammond - [email protected]" date="02 Jun 2019" revision="2">Initial Metadata Import from Z-Wave Alliance Database - https://products.z-wavealliance.org/products/2624/xml</Entry>
<Entry author="Quinn Hosler - https://github.com/quinnhosler" date="26 April 2020" revision="3">DoorSense(TM) support</Entry>
</ChangeLog>
</MetaData>
<!-- Configuration Parameters -->
<CommandClass id="98">
<Value genre="config" type="list" index="7" instance="1" label="DoorSense" min="0" max="3" size="1" value="2">
<Help>
State of Door and Bolt
</Help>
<Item label="Locked/Open" value="0" />
<Item label="Locked/Closed" value="1" />
<Item label="Unlocked/Open" value="2" />
<Item label="Unlocked/Closed" value="3" />
</Value>
</CommandClass>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a Configuration CC id - Why is it required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right this isn't needed and I didn't understand why I was making that change. I removed the changes to this file.

<!-- Association Groups -->
<CommandClass id="133">
<Associations num_groups="2">
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/ValueIDIndexesDefines.def
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,8 @@ ENUM(ValueID_Index_DoorLock,
System_Config_Minutes = 3,
System_Config_Seconds = 4,
System_Config_OutsideHandles = 5,
System_Config_InsideHandles = 6
System_Config_InsideHandles = 6,
Door_Condition = 7
);
ENUM(ValueID_Index_DoorLockLogging,
System_Config_MaxRecords = 0,
Expand Down
110 changes: 1 addition & 109 deletions cpp/src/ValueIDIndexesDefines.h

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions cpp/src/command_classes/DoorLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ namespace OpenZWave
DoorLockState_Secured = 0xFF
};

enum DoorLockCondition
{
DoorLockCondition_Unlatched_Locked_Open = 0x00,
DoorLockCondition_Unlatched_Locked_Closed = 0x01,
DoorLockCondition_Unlatched_Unlocked_Open = 0x02,
DoorLockCondition_Unlatched_Unlocked_Closed = 0x03,
DoorLockCondition_Latched_Locked_Open = 0x04,
DoorLockCondition_Latched_Locked_Closed = 0x05,
DoorLockCondition_Latched_Unlocked_Open = 0x06,
DoorLockCondition_Latched_Unlocked_Closed = 0x07,
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required?

static char const* c_LockStateNames[] =
{ "Unsecure", "Unsecured with Timeout", "Inside Handle Unsecured", "Inside Handle Unsecured with Timeout", "Outside Handle Unsecured", "Outside Handle Unsecured with Timeout", "Secured", "Invalid" };

Expand Down Expand Up @@ -194,6 +206,11 @@ namespace OpenZWave
value->OnValueRefreshed(lockState);
value->Release();
}
if (Internal::VC::ValueList* value = static_cast<Internal::VC::ValueList*>(GetValue(_instance, ValueID_Index_DoorLock::Door_Condition)))
{
value->OnValueRefreshed(_data[3]);
value->Release();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few issues here:

  1. this ValueID is not created by the Class. You need to determine if the device in question supports this ValueID (probably based upon the CommandClass Version) and then create the ValueID, and subsequently, in this specific block, only do this update if the CommandClass Version is equal/above the minimum version and you should also check if index 3 is valid in the data recieved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking through the ZW docs and it appears DoorCondition is defined as far back as version 1 of the protocol and hasn't changed sense. I'm assuming this negates the need for any version checking? I added a simple validation of index 3.

return true;
}
else if (DoorLockCmd_Configuration_Report == (DoorLockCmd) _data[0])
Expand Down