mirror of
https://github.com/Fishwaldo/open-zwave.git
synced 2025-07-08 14:08:51 +00:00
Change HID debugging symbol to HIDDEBUG to reduce extra output unless
necessary. Add missing ioctls for Linux HID support. Remove these when a newer linux/hidraw.h is available. Add more defensive checks in device add/remove processing. Not all controllers fill in the node field. Provide group notifications on initial group discovery. Add Aeon Labs Home Energy Monitor device defintion as well as update device info for Everspring SM103. Make sure ACT Zir010 has default values specified in configuration for initial case.
This commit is contained in:
parent
b7603998d7
commit
06c6adbd8c
8 changed files with 112 additions and 28 deletions
|
@ -1,18 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Product>
|
||||
<!-- Configuration Parameters -->
|
||||
<CommandClass id="112">
|
||||
<Value type="list" index="17" genre="config" label="Mode">
|
||||
<Value type="list" index="17" genre="config" label="Mode" value="0" >
|
||||
<Item label="Lighting" value="0" />
|
||||
<Item label="Alarm" value="1" />
|
||||
<Item label="Sensor" value="2" />
|
||||
</Value>
|
||||
<Value type="byte" index="18" genre="config" label="Off/Idle Delay" units="minutes" min="0" max="255" />
|
||||
<Value type="list" index="19" genre="config" label="Unsolicited Commands">
|
||||
<Value type="byte" index="18" genre="config" label="Off/Idle Delay" units="minutes" min="0" max="255" value="0" />
|
||||
<Value type="list" index="19" genre="config" label="Unsolicited Commands" value="1" >
|
||||
<Item label="No" value="0" />
|
||||
<Item label="Yes" value="1" />
|
||||
</Value>
|
||||
<Value type="byte" index="22" genre="config" label="Awake Time" units="seconds" min="15" max="45" />
|
||||
<Value type="byte" index="22" genre="config" label="Awake Time" units="seconds" min="15" max="45" value="30" />
|
||||
</CommandClass>
|
||||
|
||||
<!-- Association Groups -->
|
||||
|
|
57
config/aeon_labs/hem.xml
Normal file
57
config/aeon_labs/hem.xml
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Product>
|
||||
<!-- Configuration Parameters -->
|
||||
<CommandClass id="112">
|
||||
<Value type="short" index="1" genre="config" label="Country Voltage" units="volts" min="0" max="300" value="120" />
|
||||
<Value type="bool" index="3" genre="config" label="Power changed" units="" min="0" max="1" value="0" />
|
||||
<Value type="short" index="4" genre="config" label="Wattage Threshold" units="watts" value="50" />
|
||||
<Value type="short" index="5" genre="config" label="Wattage Threshold C1" units="watts" value="50" />
|
||||
<Value type="short" index="6" genre="config" label="Wattage Threshold C2" units="watts" value="50" />
|
||||
<Value type="short" index="7" genre="config" label="Wattage Threshold C3" units="watts" value="50" />
|
||||
<Value type="byte" index="8" genre="config" label="Wattage Percentage Change" units="%" value="10" />
|
||||
<Value type="byte" index="9" genre="config" label="Wattage Percentage Change C1" units="%" value="10" />
|
||||
<Value type="byte" index="10" genre="config" label="Wattage Percentage Change C2" units="%" value="10" />
|
||||
<Value type="byte" index="11" genre="config" label="Wattage Percentage Change C3" units="%" value="10" />
|
||||
<Value type="bool" index="12" genre="config" label="Accumulate energy" units="" min="0" max="1" value="0" />
|
||||
<Value type="bool" index="20" genre="config" label="USB powered" units="" min="0" max="1" />
|
||||
<Value type="int" index="100" genre="config" label="Reset #101-103" units="" value="0" />
|
||||
<! -- Content of Reporting
|
||||
Byte 1 (msb): Reserved
|
||||
Byte 2: Reserved
|
||||
Byte 3: Bit 7: reserved
|
||||
Bit 6: reserved
|
||||
Bit 5: Auto Send Meter Report (for kWh) at the group time interval (Clamp 3)
|
||||
Bit 4: Auto Send Meter Report (for kWh) at the group time interval (Clamp 2)
|
||||
Bit 3: Auto Send Meter Report (for kWh) at the group time interval (Clamp 1)
|
||||
Bit 2: Auto Send Meter Report (for watts) at the group time interval (Clamp 3)
|
||||
Bit 1: Auto Send Meter Report (for watts) at the group time interval (Clamp 2)
|
||||
Bit 0: Auto Send Meter Report (for watts) at the group time interval (Clamp 1)
|
||||
Byte 4 (lsb): Bit 7: reserved
|
||||
Bit 6: reserved
|
||||
Bit 5: reserved
|
||||
Bit 4: reserved
|
||||
Bit 3: Auto Send Meter Report (for kWh) at the group time interval (whole HEM)
|
||||
Bit 2: Auto Send Meter Report (for watts) at the group time interval (whole HEM)
|
||||
Bit 1: Auto Send Multilevel Sensor Report (for watts) at the group time interval (whole HEM)
|
||||
Bit 0: Auto Send Battery Report at the group time interval (whole HEM)
|
||||
-->
|
||||
<Value type="int" index="101" genre="config" label="Group 1 Reports" units="" value="0" />
|
||||
<Value type="int" index="102" genre="config" label="Group 2 Reports" units="" value="0" />
|
||||
<Value type="int" index="103" genre="config" label="Group 3 Reports" units="" value="0" />
|
||||
<Value type="int" index="110" genre="config" label="Reset #111-113" units="" value="0" />
|
||||
<Value type="int" index="111" genre="config" label="Group 1 Interval" units="seconds" value="720" />
|
||||
<Value type="int" index="112" genre="config" label="Group 2 Interval" units="seconds" value="720" />
|
||||
<Value type="int" index="113" genre="config" label="Group 3 Interval" units="seconds" value="720" />
|
||||
<Value type="int" index="253" genre="config" label="Unit Recalibration (dangerous)" units="" value="0" />
|
||||
<Value type="short" index="254" genre="config" label="Device Tag" units="" value="0" />
|
||||
<Value type="int" index="255" genre="config" label="Reset default configuration" units="" value="0" />
|
||||
</CommandClass>
|
||||
|
||||
<!-- Association Groups -->
|
||||
<CommandClass id="133">
|
||||
<Associations num_groups="1">
|
||||
<Group index="1" max_associations="5" label="Report" auto="true" />
|
||||
</Associations>
|
||||
</CommandClass>
|
||||
</Product>
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Product>
|
||||
<!-- Configuration Parameters -->
|
||||
<CommandClass id="112">
|
||||
<Value type="byte" index="1" genre="config" label="On Level" units="" min="0" max="99" value="99">
|
||||
<Value type="byte" index="1" genre="config" label="On Level" units="" min="0" max="127" value="99">
|
||||
<Help>
|
||||
Defines the level in the event sent when the sensor is triggered. Default is 99 (full brightness for a Z-Wave dimmer).
|
||||
Defines the level in the event sent when the sensor is triggered. Default is 99 (full brightness for a Z-Wave dimmer). 100-127 will set device on to the last value it was when turned off.
|
||||
</Help>
|
||||
</Value>
|
||||
<Value type="byte" index="2" genre="config" label="Off Time" units="seconds" min="0" max="127" value="1">
|
||||
|
@ -12,6 +12,11 @@
|
|||
On Time sets the number of seconds the sensor stays alerted before the off event is sent.
|
||||
</Help>
|
||||
</Value>
|
||||
<Value type="byte" index="3" genre="config" label="Power Saving" units="" min="0" max="127" value="0">
|
||||
<Help>
|
||||
Enable/Disable power saving mode. 0 enables.
|
||||
</Help>
|
||||
</Value>
|
||||
</CommandClass>
|
||||
|
||||
<!-- COMMAND_CLASS_ALARM. This class is supported but is missing from the list reported by the SM103 -->
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<Product type="0003" id="0006" name="Smart Energy Switch" />
|
||||
<Product type="0001" id="0007" name="Z-Stick S2 Lite" />
|
||||
<Product type="0003" id="0008" name="Smart Energy Illuminator" />
|
||||
<Product type="0002" id="0009" name="Home Energy Meter" />
|
||||
<Product type="0002" id="0009" name="Home Energy Meter" config="aeon_labs/hem.xml" />
|
||||
<Product type="0003" id="000a" name="Smart Energy 220V Utility Switch" />
|
||||
<Product type="0003" id="000b" name="Smart Energy Strip" />
|
||||
<Product type="0003" id="000c" name="Micro Smart Energy Switch" />
|
||||
|
@ -101,6 +101,7 @@
|
|||
<Product type="000C" id="0001" name="SE812 Siren" />
|
||||
<Product type="000D" id="0001" name="SF812 Smoke Alarm" />
|
||||
<Product type="0006" id="0001" name="ST814 Temperature and Humidity Sensor" />
|
||||
<Product type="0202" id="0001" name="SM103 Door/Window Sensor" config="everspring/sm103.xml" />
|
||||
</Manufacturer>
|
||||
<Manufacturer id="0036" name="Exceptional Innv">
|
||||
</Manufacturer>
|
||||
|
|
|
@ -43,6 +43,15 @@
|
|||
|
||||
#include "hidapi.h"
|
||||
|
||||
/*
|
||||
* Added here until linux/hidraw.h has them. These definitions require a version
|
||||
* 2.6.39 based kernel as well.
|
||||
*/
|
||||
#ifndef HIDIOCSFEATURE
|
||||
#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
|
||||
#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
|
||||
#endif
|
||||
|
||||
struct hid_device_ {
|
||||
int device_handle;
|
||||
int blocking;
|
||||
|
|
|
@ -778,6 +778,8 @@ void Driver::RemoveMsg
|
|||
)
|
||||
{
|
||||
// get current message from the queue
|
||||
if ( m_sendQueue.size() == 0 )
|
||||
return;
|
||||
m_sendMutex->Lock();
|
||||
Msg *msg = m_sendQueue.front();
|
||||
|
||||
|
@ -788,7 +790,7 @@ void Driver::RemoveMsg
|
|||
{
|
||||
// check to see if this is a "retry." If so, don't signal query stage complete
|
||||
Node* node = GetNodeUnsafe( nodeId );
|
||||
if( !node->m_queryRetries )
|
||||
if( node != NULL && !node->m_queryRetries )
|
||||
{
|
||||
// look for more messages for this node in the send queue (to see if query stage is complete)
|
||||
bool bMoreForThisNode = false;
|
||||
|
@ -2081,6 +2083,7 @@ void Driver::HandleRemoveNodeFromNetworkRequest
|
|||
case REMOVE_NODE_STATUS_LEARN_READY:
|
||||
{
|
||||
Log::Write( "REMOVE_NODE_STATUS_LEARN_READY" );
|
||||
m_controllerCommandNode = 0;
|
||||
if( m_controllerCallback )
|
||||
{
|
||||
m_controllerCallback( ControllerState_Waiting, m_controllerCallbackContext );
|
||||
|
@ -2154,14 +2157,23 @@ void Driver::HandleRemoveNodeFromNetworkRequest
|
|||
{
|
||||
Log::Write( "REMOVE_NODE_STATUS_DONE" );
|
||||
|
||||
Notification* notification = new Notification( Notification::Type_NodeRemoved );
|
||||
notification->SetHomeAndNodeIds( m_homeId, m_controllerCommandNode );
|
||||
QueueNotification( notification );
|
||||
if ( m_controllerCommandNode == 0 ) // never received "removing" update
|
||||
{
|
||||
if ( _data[4] != 0 ) // but message has the clue
|
||||
m_controllerCommandNode = _data[4];
|
||||
}
|
||||
|
||||
LockNodes();
|
||||
delete m_nodes[m_controllerCommandNode];
|
||||
m_nodes[m_controllerCommandNode] = NULL;
|
||||
ReleaseNodes();
|
||||
if ( m_controllerCommandNode != 0 )
|
||||
{
|
||||
Notification* notification = new Notification( Notification::Type_NodeRemoved );
|
||||
notification->SetHomeAndNodeIds( m_homeId, m_controllerCommandNode );
|
||||
QueueNotification( notification );
|
||||
|
||||
LockNodes();
|
||||
delete m_nodes[m_controllerCommandNode];
|
||||
m_nodes[m_controllerCommandNode] = NULL;
|
||||
ReleaseNodes();
|
||||
}
|
||||
|
||||
if( m_controllerCallback )
|
||||
{
|
||||
|
@ -2687,14 +2699,6 @@ void Driver::CommonAddNodeStatusRequestHandler
|
|||
{
|
||||
Log::Write( "ADD_NODE_STATUS_DONE" );
|
||||
|
||||
// not sure at this point what the extra two bytes after _data[3] are for...
|
||||
// so far they're generally both 0x00. So flag with a log message if they aren't
|
||||
// for diagnostic purposes
|
||||
if( _data[4] || _data[5] )
|
||||
{
|
||||
Log::Write( "WARNING: Unusual payload in response (usually 06 00 00)" );
|
||||
}
|
||||
|
||||
if( m_controllerCommandNode != 0xff )
|
||||
InitNode( m_controllerCommandNode );
|
||||
if( m_controllerCallback )
|
||||
|
|
|
@ -249,6 +249,14 @@ void Group::OnGroupChanged
|
|||
m_associations.clear();
|
||||
notify = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle initial group creation case
|
||||
if ( _associations.size() == 0 && m_associations.size() == 0 )
|
||||
{
|
||||
notify = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the new associations.
|
||||
uint8 oldSize = (uint8)m_associations.size();
|
||||
|
|
|
@ -226,7 +226,7 @@ uint32 HidControllerImpl::Read
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef HIDDEBUG
|
||||
Log::Write("HID read requested %d", _length);
|
||||
#endif
|
||||
if ( m_hidFeatureReportReadBufferPtr == NULL )
|
||||
|
@ -238,7 +238,7 @@ uint32 HidControllerImpl::Read
|
|||
memset( m_hidFeatureReportReadBuffer, 0, PACKET_BUFFER_LENGTH );
|
||||
m_hidFeatureReportReadBufferBytes = GetFeatureReport( FEATURE_REPORT_LENGTH, 0x5, m_hidFeatureReportReadBuffer );
|
||||
CHECK_HIDAPI_RESULT( m_hidFeatureReportReadBufferBytes, HidPortError );
|
||||
#ifdef DEBUG
|
||||
#ifdef HIDDEBUG
|
||||
char nstr[16];
|
||||
snprintf( nstr, sizeof(nstr), "%d", m_hidFeatureReportReadBufferBytes );
|
||||
string str = "HID read(";
|
||||
|
@ -269,7 +269,7 @@ uint32 HidControllerImpl::Read
|
|||
m_hidFeatureReportReadBufferBytes -= _length;
|
||||
if ( m_hidFeatureReportReadBufferBytes == 0 )
|
||||
m_hidFeatureReportReadBufferPtr = NULL;
|
||||
#ifdef DEBUG
|
||||
#ifdef HIDDEBUG
|
||||
Log::Write( "HID read returning %d", _length );
|
||||
#endif
|
||||
return _length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue