Fix OpenZWave control panel and update openzwave dev patch

This commit is contained in:
Michael Cronenworth 2017-07-31 19:53:06 -05:00
parent 415d1f40d0
commit d689dd14ab
2 changed files with 119 additions and 68 deletions

View File

@ -1,80 +1,74 @@
--- a/hardware/OpenZWave.cpp 2017-07-19 06:53:18.000000000 -0500
+++ b/hardware/OpenZWave.cpp 2017-07-22 21:49:53.220479619 -0500
@@ -956,7 +956,7 @@
}
// Create the OpenZWave Manager.
// The first argument is the path to the config files (where the manufacturer_specific.xml file is located
- // The second argument is the path for saved Z-Wave network state and the log file. If you leave it NULL
+ // The second argument is the path for saved Z-Wave network state and the log file. If you leave it NULL
// the log file will appear in the program's working directory.
_log.Log(LOG_STATUS, "OpenZWave: using config in: %s", ConfigPath.c_str());
OpenZWave::Options::Create(ConfigPath, UserPath, "--SaveConfiguration=true ");
@@ -1641,19 +1641,80 @@
diff --git a/hardware/OpenZWave.cpp b/hardware/OpenZWave.cpp
index 1f5c341c..51b2865b 100644
--- a/hardware/OpenZWave.cpp
+++ b/hardware/OpenZWave.cpp
@@ -1641,19 +1641,83 @@ void COpenZWave::AddValue(const OpenZWave::ValueID &vID, const NodeInfo *pNodeIn
if (newInstance != 0)
{
_device.instanceID = newInstance;
- if (m_pManager->GetValueAsByte(vID, &byteValue) == true)
- {
+ //Door lock device
+ if (
+ (vLabel == "Access Control") ||
+ (vLabel == "UserCode")
+ )
{
- _device.devType = ZDTYPE_SWITCH_NORMAL;
- if (byteValue == 0)
- _device.intvalue = 0;
- else
- _device.intvalue = 255;
- InsertDevice(_device);
- }
+ if( ValueID::ValueType_Byte == vID.GetType() )
+ {
+ if (m_pManager->GetValueAsByte(vID, &byteValue) == true)
+ {
+ _device.devType = ZDTYPE_SWITCH_NORMAL;
+ if (byteValue == 0)
+ _device.intvalue = 0;
+ else
+ _device.intvalue = 255;
+ InsertDevice(_device);
+ }
+ }
+ else if( ValueID::ValueType_List == vID.GetType() )
+ {
+ //COpenZWave::NodeInfo *pNode = GetNodeInfo(HomeID, NodeID);
+ //pNode->aList.clear();
+ //m_pManager->GetValueListItems(vID, &pNode->aList);
+ //if (!pNode->aList.empty())
+ std::vector<string> aList;
+ aList.clear();
+ m_pManager->GetValueListItems(vID, &aList);
+ if (!aList.empty())
+ if( ValueID::ValueType_List == vID.GetType() )
+ {
+ //std::vector<std::string>::const_iterator itt;
+ //for (itt = aList.begin(); itt != aList.end(); ++itt)
+ //{
+ //_log.Log(LOG_STATUS, "OpenZWave: Value_Added: Unhandled List Value: %s", *itt->c_str());
+ //}
+
+ try
+ {
+ std::string vListStr;
+ if (m_pManager->GetValueListSelection(vID, &vListStr))
+ {
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: Unhandled List Selection: %s", vListStr.c_str());
+ //int32 vMode = Lookup_ZWave_Thermostat_Modes(pNode->tModes, vListStr);
+ //if (vMode != -1)
+ //{
+ //pNode->tMode = vMode;
+ //_device.intvalue = vMode;
+ //_device.commandClassID = COMMAND_CLASS_THERMOSTAT_MODE;
+ //_device.devType = ZDTYPE_SENSOR_THERMOSTAT_MODE;
+ //InsertDevice(_device);
+ //SendDevice2Domoticz(&_device);
+ //}
+ _device.devType = ZDTYPE_SWITCH_NORMAL;
+ _device.Alarm_Type = 6;
+ _device.intvalue = 0;
+ if (vListStr == "Access Control - RF Lock")
+ _device.intvalue = 24;
+ else if (vListStr == "Access Control - RF Unlock")
+ _device.intvalue = 25;
+ else if (vListStr == "Access Control - Manual Lock")
+ _device.intvalue = 21;
+ else if (vListStr == "Access Control - Manual Unlock")
+ _device.intvalue = 22;
+ else if (vListStr == "Access Control - KeyPad Lock")
+ _device.intvalue = 18;
+ else if (vListStr == "Access Control - KeyPad Unlock")
+ _device.intvalue = 19;
+ else if (vListStr == "Not Active")
+ _device.intvalue = 1;
+ else
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: Unhandled List Selection: %s", vListStr.c_str());
+ InsertDevice(_device);
+ }
+ }
+ catch (...)
+ {
+
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: GetValueListSelection Exception");
+ }
+ }
+ }
+ else {
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: Unhandled Value for Label: %s", vLabel.c_str());
+ }
+ }
+ else if( ValueID::ValueType_Byte == vID.GetType() )
+ {
+ if (m_pManager->GetValueAsByte(vID, &byteValue) == true)
+ {
+ _device.devType = ZDTYPE_SWITCH_NORMAL;
+ if (byteValue == 0)
+ _device.intvalue = 0;
+ else
+ _device.intvalue = 255;
+ InsertDevice(_device);
+ }
}
+ else
+ {
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: Unhandled Value: X, Type: %i", vID.GetType());
@ -84,19 +78,69 @@
{
- if (vLabel != "SourceNodeId")
+ if (vLabel == "UserCode") {
+ if ((vType == OpenZWave::ValueID::ValueType_Raw) || (vType == OpenZWave::ValueID::ValueType_String))
+ {
+ std::string strValue;
+ if (m_pManager->GetValueAsString(vID, &strValue) == true)
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: UserCode: %s", strValue.c_str());
+ }
+ else
+ {
+ if (m_pManager->GetValueAsByte(vID, &byteValue) == true)
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: UserCode: %i", byteValue);
+ }
+ }
+ if ((vType == OpenZWave::ValueID::ValueType_Raw) || (vType == OpenZWave::ValueID::ValueType_String))
+ {
+ std::string strValue;
+ if (m_pManager->GetValueAsString(vID, &strValue) == true)
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: UserCode: %s", strValue.c_str());
+ }
+ else
+ {
+ if (m_pManager->GetValueAsByte(vID, &byteValue) == true)
+ _log.Log(LOG_STATUS, "OpenZWave: Value_Added: UserCode: %i", byteValue);
+ }
+ }
+ else if (vLabel != "SourceNodeId")
{
_log.Log(LOG_STATUS, "OpenZWave: Value_Added: Unhandled Label: %s, Unit: %s", vLabel.c_str(), vUnits.c_str());
}
@@ -2395,7 +2459,7 @@ void COpenZWave::UpdateValue(const OpenZWave::ValueID &vID)
unsigned char byteValue = 0;
int32 intValue = 0;
std::string strValue = "";
- int32 lValue = 0;
+ std::string lValue = "";
if (vType == OpenZWave::ValueID::ValueType_Decimal)
{
@@ -2833,16 +2897,40 @@ void COpenZWave::UpdateValue(const OpenZWave::ValueID &vID)
}
else if (vLabel == "Access Control")
{
+ if (!lValue.empty()) {
+ if (lValue == "Access Control - RF Lock")
+ byteValue = 24;
+ else if (lValue == "Access Control - RF Unlock")
+ byteValue = 25;
+ else if (lValue == "Access Control - Manual Lock")
+ byteValue = 21;
+ else if (lValue == "Access Control - Manual Unlock")
+ byteValue = 22;
+ else if (lValue == "Access Control - KeyPad Lock")
+ byteValue = 18;
+ else if (lValue == "Access Control - KeyPad Unlock")
+ byteValue = 19;
+ else if (lValue == "Not Active")
+ byteValue = 0;
+ else
+ byteValue = 0;
+ }
+
switch (byteValue) {
case 0x00: // Previous Events cleared
case 0x06: //Keypad unlock/Arm Home
+ case 0x12: // KeyPad lock
+ case 0x15: // Manual Lock
case 0x17: // Door closed
+ case 0x18: // RF operated lock
case 0xfe: // Unkown event; returned when retrieving the current state.
intValue = 0;
break;
case 0x05: //Keypad Lock/Arm Away
+ case 0x13: // KeyPad unlock
case 0x16: // Door open
+ case 0x19: // RF operated unlock
default: // all others, interpret as alarm
intValue = 255;
break;

View File

@ -1,6 +1,6 @@
Name: domoticz
Version: 3.8153
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Open source Home Automation System
License: GPLv3+ and ASL 2.0 and Boost and BSD and MIT
@ -135,6 +135,10 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/DroidSans
ln -s %{_fontdir}/google-droid/DroidSans.ttf \
$RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/
# OpenZWave Control Panel temp file
ln -s %{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml \
$RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml
%pre
getent group domoticz >/dev/null || groupadd -r domoticz
@ -168,6 +172,9 @@ usermod -G domoticz,dialout domoticz
%changelog
* Mon Jul 31 2017 Michael Cronenworth <mike@cchtml.com> - 3.8153-2
- Fix OpenZWave control panel
* Mon Jul 31 2017 Michael Cronenworth <mike@cchtml.com> - 3.8153-1
- New upstream version
- Unbundle tinyxpath