From 8d070186ecf0b19f964a21a550df1e10e53b0db7 Mon Sep 17 00:00:00 2001 From: Michael Cronenworth Date: Jan 25 2018 18:12:18 +0000 Subject: Patch for Boost 1.66 (RHBZ#1538585) --- diff --git a/domoticz-boost-1.66.patch b/domoticz-boost-1.66.patch new file mode 100644 index 0000000..2027d3e --- /dev/null +++ b/domoticz-boost-1.66.patch @@ -0,0 +1,33 @@ +From 388c7b51716cdb6221ec292cc2456ceca6ee9b02 Mon Sep 17 00:00:00 2001 +From: Rob Peters +Date: Wed, 24 Jan 2018 12:03:24 +0100 +Subject: [PATCH] Make compatible with boost 1.66 + +--- + msbuild/domoticz.vcxproj | 2 +- + webserver/proxyclient.cpp | 2 +- + webserver/server.cpp | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/webserver/server.cpp b/webserver/server.cpp +index fe001e811..c0eec2166 100644 +--- a/webserver/server.cpp ++++ b/webserver/server.cpp +@@ -152,7 +152,7 @@ void server::handle_accept(const boost::system::error_code& e) { + ssl_server::ssl_server(const ssl_server_settings & ssl_settings, request_handler & user_request_handler) : + server_base(ssl_settings, user_request_handler), + settings_(ssl_settings), +- context_(io_service_, ssl_settings.get_ssl_method()) ++ context_(ssl_settings.get_ssl_method()) + { + #ifdef DEBUG_WWW + _log.Log(LOG_STATUS, "[web:%s] create ssl_server using ssl_server_settings : %s", ssl_settings.listening_port.c_str(), ssl_settings.to_string().c_str()); +@@ -165,7 +165,7 @@ ssl_server::ssl_server(const ssl_server_settings & ssl_settings, request_handler + ssl_server::ssl_server(const server_settings & settings, request_handler & user_request_handler) : + server_base(settings, user_request_handler), + settings_(dynamic_cast(settings)), +- context_(io_service_, dynamic_cast(settings).get_ssl_method()) { ++ context_(dynamic_cast(settings).get_ssl_method()) { + #ifdef DEBUG_WWW + _log.Log(LOG_STATUS, "[web:%s] create ssl_server using server_settings : %s", settings.listening_port.c_str(), settings.to_string().c_str()); + #endif diff --git a/domoticz-ozw-barrier-support-0001.patch b/domoticz-ozw-barrier-support-0001.patch new file mode 100644 index 0000000..d889d93 --- /dev/null +++ b/domoticz-ozw-barrier-support-0001.patch @@ -0,0 +1,300 @@ +From a325940d059dd564a16b424cf1020aac6d10f69e Mon Sep 17 00:00:00 2001 +From: jowerg +Date: Sat, 22 Apr 2017 08:44:08 -0400 +Subject: [PATCH] Initial support for devices using + COMMAND_CLASS_BARRIER_OPERATOR. Tested using Linear GD00Z-4 + +--- + README.md | 5 ++ + hardware/OpenZWave.cpp | 54 +++++++++++++++++++++- + hardware/ZWaveCommands.h | 1 + + hardware/openzwave/command_classes/Alarm.h | 2 +- + hardware/openzwave/command_classes/CentralScene.h | 46 +++++++++--------- + .../openzwave/command_classes/SceneActivation.h | 1 + + hardware/openzwave/control_panel/zwavelib.cpp | 2 + + 7 files changed, 85 insertions(+), 26 deletions(-) + +diff --git a/README.md b/README.md +index 8ee56fecd..4e7ef9f02 100644 +--- a/README.md ++++ b/README.md +@@ -2,6 +2,11 @@ + + Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device + ++## OpenZWave Library - BARRIER OPERATOR support ++You will need to apply the patch implemented by @srirams as described on: ++https://github.com/OpenZWave/open-zwave/issues/490 ++ ++ + ## Multi platform: Linux/Windows/Embedded Devices + + This system is designed to operate in various operating systems. +diff --git a/hardware/OpenZWave.cpp b/hardware/OpenZWave.cpp +index 186d51134..4c046d806 100644 +--- a/hardware/OpenZWave.cpp ++++ b/hardware/OpenZWave.cpp +@@ -250,10 +250,12 @@ const char *cclassStr(uint8 cc) + return "MULTI INSTANCE"; + case 0x62: + return "DOOR LOCK"; + case 0x63: + return "USER CODE"; ++ case 0x66: ++ return "BARRIER OPERATOR"; + case 0x70: + return "CONFIGURATION"; + case 0x71: + return "ALARM"; + case 0x72: +@@ -1229,27 +1231,47 @@ bool COpenZWave::SwitchLight(const int nodeID, const int instanceID, const int c + bool bFound = (GetValueByCommandClass(nodeID, instanceID, COMMAND_CLASS_SWITCH_BINARY, vID) == true); + if (!bFound) + bFound = (GetValueByCommandClass(nodeID, instanceID, COMMAND_CLASS_DOOR_LOCK, vID) == true); + if (!bFound) + bFound = (GetValueByCommandClassLabel(nodeID, instanceID, COMMAND_CLASS_SWITCH_MULTILEVEL, "Level", vID) == true); ++ if (!bFound) ++ bFound = (GetValueByCommandClass(nodeID, instanceID, COMMAND_CLASS_BARRIER, vID) == true); + if (bFound) + { +- OpenZWave::ValueID::ValueType vType = vID.GetType(); +- _log.Log(LOG_NORM, "OpenZWave: Domoticz has send a Switch command! NodeID: %d (0x%02x)", nodeID, nodeID); +- if (vType == OpenZWave::ValueID::ValueType_Bool) +- { +- if (svalue == 0) { +- //Off +- m_pManager->SetValue(vID, false); +- pDevice->intvalue = 0; +- } +- else { +- //On +- m_pManager->SetValue(vID, true); +- pDevice->intvalue = 255; +- } +- } ++ OpenZWave::ValueID::ValueType vType = vID.GetType(); ++ _log.Log(LOG_NORM, "OpenZWave: Domoticz has send a Switch command! NodeID: %d (0x%02x)", nodeID, nodeID); ++ if (vType == OpenZWave::ValueID::ValueType_Bool) ++ { ++ if (svalue == 0) { ++ //Off ++ _log.Log(LOG_NORM, "OpenZWave: Domoticz has send an OFF Switch command! NodeID: %d (FALSE) Command: 0x%02x", nodeID,commandClass); ++ m_pManager->SetValue(vID, false); ++ pDevice->intvalue = 0; ++ } ++ else { ++ //On ++ _log.Log(LOG_NORM, "OpenZWave: Domoticz has send an ON Switch command! NodeID: %d (TRUE) Command: 0x%02x", nodeID, commandClass); ++ m_pManager->SetValue(vID, true); ++ pDevice->intvalue = 255; ++ } ++ } ++ else if (vType == OpenZWave::ValueID::ValueType_List) ++ { ++ std::string BarrierOpen = "Open"; ++ std::string BarrierClose = "Close"; ++ ++ if (svalue == 0) { ++ //Off ++ _log.Log(LOG_NORM, "OpenZWave: Domoticz has send an OFF Switch command! NodeID: %d (Closed) Command: 0x%02x", nodeID, commandClass); ++ m_pManager->SetValueListSelection(vID, BarrierClose); ++ } ++ else { ++ //On ++ _log.Log(LOG_NORM, "OpenZWave: Domoticz has send an ON Switch command! NodeID: %d (Open) Command: 0x%02x", nodeID, commandClass); ++ m_pManager->SetValueListSelection(vID, BarrierOpen); ++ } ++ } + else + { + if (svalue == 0) { + //Off + m_pManager->SetValue(vID, 0); +@@ -2216,10 +2238,39 @@ void COpenZWave::AddValue(const OpenZWave::ValueID &vID, const NodeInfo *pNodeIn + else + _device.intvalue = 0; + InsertDevice(_device); + } + } ++ } ++ else if (commandclass == COMMAND_CLASS_BARRIER) ++ { ++ ++ if (vLabel == "Open" ) ++ { ++ // We are going to define a Domoticz Control for the Garage opener ++ _device.devType = ZDTYPE_SWITCH_NORMAL; ++ ++ ++ if (m_pManager->GetValueAsBool(vID, &bValue) == true) ++ { ++ if (bValue == true) ++ _device.intvalue = 255; ++ else ++ _device.intvalue = 0; ++ } ++ else if (m_pManager->GetValueAsByte(vID, &byteValue) == true) ++ { ++ if (byteValue == 0) ++ _device.intvalue = 0; ++ else ++ _device.intvalue = 255; ++ } ++ InsertDevice(_device); ++ ++ } ++ ++ + } + else + { + //Unhandled + _log.Log(LOG_STATUS, "OpenZWave: Unhandled class: 0x%02X (%s), NodeID: %d (0x%02x), Index: %d, Instance: %d", commandclass, cclassStr(commandclass), NodeID, NodeID, vOrgIndex, vOrgInstance); +@@ -2746,10 +2797,23 @@ void COpenZWave::UpdateValue(const OpenZWave::ValueID &vID) + intValue = 0; + else + intValue = 255; + pDevice->intvalue = intValue; + } ++ else if (commandclass == COMMAND_CLASS_BARRIER) ++ { ++ if (vLabel == "Barrier State Numeric") ++ { ++ int intValue = 0; ++ if (byteValue == 0) ++ intValue = 0; ++ else ++ intValue = 255; ++ pDevice->intvalue = intValue; ++ _log.Log(LOG_STATUS, "GetValue BARRIER CLASS byteValue: %d , Node (0x%02x) , Label: %s", byteValue, NodeID, vLabel.c_str()); ++ } ++ } + else if (commandclass == COMMAND_CLASS_ALARM) + { + /* + _log.Log(LOG_STATUS, "------------------------------------"); + _log.Log(LOG_STATUS, "Label: %s", vLabel.c_str()); +diff --git a/hardware/ZWaveCommands.h b/hardware/ZWaveCommands.h +index 9e80713de..0daf0db31 100644 +--- a/hardware/ZWaveCommands.h ++++ b/hardware/ZWaveCommands.h +@@ -51,6 +51,7 @@ + #define COMMAND_CLASS_MULTI_INSTANCE 0x60 + #define COMMAND_CLASS_DOOR_LOCK 0x62 + #define COMMAND_CLASS_USER_CODE 0x63 ++#define COMMAND_CLASS_BARRIER 0x66 + + #define COMMAND_CLASS_CONFIGURATION 0x70 + #define COMMAND_CLASS_ALARM 0x71 +diff --git a/hardware/openzwave/command_classes/Alarm.h b/hardware/openzwave/command_classes/Alarm.h +index 528fd022d..9cbdd6bd4 100644 +--- a/hardware/openzwave/command_classes/Alarm.h ++++ b/hardware/openzwave/command_classes/Alarm.h +@@ -56,7 +56,7 @@ namespace OpenZWave + virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); } + /** \brief Handle a response to a message associated with this command class. (Inherited from CommandClass) */ + virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 ); +- ++ virtual bool SetValue( Value const& _value ); + virtual uint8 GetMaxVersion(){ return 3; } + + protected: +diff --git a/hardware/openzwave/command_classes/CentralScene.h b/hardware/openzwave/command_classes/CentralScene.h +index f9a34fd22..0a869c438 100644 +--- a/hardware/openzwave/command_classes/CentralScene.h ++++ b/hardware/openzwave/command_classes/CentralScene.h +@@ -35,45 +35,45 @@ namespace OpenZWave + class ValueByte; + + /** \brief Implements COMMAND_CLASS_CENTRAL_SCENE (0x5B), a Z-Wave device command class. +- */ +- class CentralScene : public CommandClass ++ */ ++ class CentralScene: public CommandClass + { + public: +- static CommandClass* Create(uint32 const _homeId, uint8 const _nodeId) { return new CentralScene(_homeId, _nodeId); } +- virtual ~CentralScene() {} ++ static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new CentralScene( _homeId, _nodeId ); } ++ virtual ~CentralScene(){} + + /** \brief Get command class ID (1 byte) identifying this command class. */ +- static uint8 const StaticGetCommandClassId() { return 0x5B; } ++ static uint8 const StaticGetCommandClassId(){ return 0x5B; } + /** \brief Get a string containing the name of this command class. */ +- static string const StaticGetCommandClassName() { return "COMMAND_CLASS_CENTRAL_SCENE"; } ++ static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_CENTRAL_SCENE"; } + + // From CommandClass + /** \brief Get command class ID (1 byte) identifying this command class. (Inherited from CommandClass) */ +- virtual uint8 const GetCommandClassId()const { return StaticGetCommandClassId(); } ++ virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); } + /** \brief Get a string containing the name of this command class. (Inherited from CommandClass) */ +- virtual string const GetCommandClassName()const { return StaticGetCommandClassName(); } +- virtual uint8 GetMaxVersion() { return 3; } ++ virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); } ++ virtual uint8 GetMaxVersion(){ return 3; } + /** \brief Handle a response to a message associated with this command class. (Inherited from CommandClass) */ +- virtual bool HandleMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1); ++ virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 ); + /** \brief Create Default Vars for this CC */ +- void CreateVars(uint8 const _instance); ++ void CreateVars( uint8 const _instance ); + /** +- * Creates the ValueIDs for the keyAttributes +- * @param identical +- * @param keyAttributes +- * @param sceneNumber +- * @return +- */ ++ * Creates the ValueIDs for the keyAttributes ++ * @param identical ++ * @param keyAttributes ++ * @param sceneNumber ++ * @return ++ */ + void createSupportedKeyAttributesValues(uint8 keyAttributes, uint8 sceneNumber, uint8 index, uint8 instance); +- void ReadXML(TiXmlElement const* _ccElement); +- void WriteXML(TiXmlElement* _ccElement); +- bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue); +- bool RequestValue(uint32 const _requestFlags, uint8 const _what, uint8 const _instance, Driver::MsgQueue const _queue); ++ void ReadXML( TiXmlElement const* _ccElement ); ++ void WriteXML( TiXmlElement* _ccElement ); ++ bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue ); ++ bool RequestValue( uint32 const _requestFlags, uint8 const _what, uint8 const _instance, Driver::MsgQueue const _queue ); + private: +- CentralScene(uint32 const _homeId, uint8 const _nodeId); ++ CentralScene( uint32 const _homeId, uint8 const _nodeId ); + int32 m_scenecount; + }; + + } // namespace OpenZWave + +-#endif +\ No newline at end of file ++#endif +diff --git a/hardware/openzwave/command_classes/SceneActivation.h b/hardware/openzwave/command_classes/SceneActivation.h +index b2a73716f..cb4a30682 100644 +--- a/hardware/openzwave/command_classes/SceneActivation.h ++++ b/hardware/openzwave/command_classes/SceneActivation.h +@@ -54,6 +54,7 @@ namespace OpenZWave + virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); } + /** \brief Handle a response to a message associated with this command class. (Inherited from CommandClass) */ + virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 ); ++ void CreateVars( uint8 const _instance ); + + private: + SceneActivation( uint32 const _homeId, uint8 const _nodeId ): CommandClass( _homeId, _nodeId ){} +diff --git a/hardware/openzwave/control_panel/zwavelib.cpp b/hardware/openzwave/control_panel/zwavelib.cpp +index f6659d2e8..82debb7aa 100644 +--- a/hardware/openzwave/control_panel/zwavelib.cpp ++++ b/hardware/openzwave/control_panel/zwavelib.cpp +@@ -219,6 +219,8 @@ uint8 cclassNum(char const *str) + return 0x62; + else if (strcmp(str, "USER CODE") == 0) + return 0x63; ++ else if (strcmp(str, "BARRIER OPERATOR") == 0) ++ return 0x66; + else if (strcmp(str, "CONFIGURATION") == 0) + return 0x70; + else if (strcmp(str, "ALARM") == 0) diff --git a/domoticz-ozw-barrier-support-0002.patch b/domoticz-ozw-barrier-support-0002.patch new file mode 100644 index 0000000..a190a07 --- /dev/null +++ b/domoticz-ozw-barrier-support-0002.patch @@ -0,0 +1,86 @@ +From 0d65f8fdcc320d8cc154c1a491a4984ef83a9040 Mon Sep 17 00:00:00 2001 +From: jowerg +Date: Sat, 22 Apr 2017 08:45:11 -0400 +Subject: [PATCH] Initial COMMAND_CLASS_BARRIER_OPERATOR support + +--- + .../openzwave/command_classes/BarrierOperator.h | 70 ++++++++++++++++++++++ + 1 file changed, 70 insertions(+) + create mode 100644 hardware/openzwave/command_classes/BarrierOperator.h + +diff --git a/hardware/openzwave/command_classes/BarrierOperator.h b/hardware/openzwave/command_classes/BarrierOperator.h +new file mode 100644 +index 000000000..0899304a1 +--- /dev/null ++++ b/hardware/openzwave/command_classes/BarrierOperator.h +@@ -0,0 +1,70 @@ ++//----------------------------------------------------------------------------- ++// ++// BarrierOperator.h ++// ++// Implementation of the COMMAND_CLASS_BARRIER_OPERATOR ++// ++// Copyright (c) 2016 srirams (https://github.com/srirams) ++// ++// SOFTWARE NOTICE AND LICENSE ++// ++// This file is part of OpenZWave. ++// ++// OpenZWave is free software: you can redistribute it and/or modify ++// it under the terms of the GNU Lesser General Public License as published ++// by the Free Software Foundation, either version 3 of the License, ++// or (at your option) any later version. ++// ++// OpenZWave is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU Lesser General Public License for more details. ++// ++// You should have received a copy of the GNU Lesser General Public License ++// along with OpenZWave. If not, see . ++// ++//----------------------------------------------------------------------------- ++ ++#ifndef _BarrierOperator_H ++#define _BarrierOperator_H ++ ++#include "command_classes/CommandClass.h" ++ ++namespace OpenZWave ++{ ++ class ValueByte; ++ class ValueBool; ++ ++ /** \brief Implements COMMAND_CLASS_BARRIER_OPERATOR (0x66), a Z-Wave device command class. ++ * \ingroup CommandClass ++ */ ++ class BarrierOperator: public CommandClass ++ { ++ public: ++ static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new BarrierOperator( _homeId, _nodeId ); } ++ virtual ~BarrierOperator(){} ++ ++ static uint8 const StaticGetCommandClassId(){ return 0x66; } ++ static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_BARRIER_OPERATOR"; } ++ ++ // From CommandClass ++ virtual bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue ); ++ virtual bool RequestValue( uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue ); ++ bool RequestSignalSupport( uint8 const _instance, Driver::MsgQueue const _queue ); ++ virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); } ++ virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); } ++ virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 ); ++ virtual bool SetValue(Value const& _value); ++ ++ virtual uint8 GetMaxVersion(){ return 3; } ++ ++ protected: ++ virtual void CreateVars( uint8 const _instance ); ++ ++ private: ++ BarrierOperator( uint32 const _homeId, uint8 const _nodeId ); ++ }; ++ ++} // namespace OpenZWave ++ ++#endif diff --git a/domoticz.spec b/domoticz.spec index e62e9b2..23d058a 100644 --- a/domoticz.spec +++ b/domoticz.spec @@ -1,6 +1,6 @@ Name: domoticz Version: 3.8153 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Open source Home Automation System License: GPLv3+ and ASL 2.0 and Boost and BSD and MIT @@ -19,6 +19,11 @@ Patch3: %{name}-openzwave.patch Patch4: %{name}-openzwave-Dev.patch # Fix python detection (https://github.com/domoticz/domoticz/pull/1749) Patch5: %{name}-python.patch +# Add OpenZWave Barrier support (https://github.com/jowerg/domoticz) +Patch6: %{name}-ozw-barrier-support-0001.patch +Patch7: %{name}-ozw-barrier-support-0002.patch +# Boost 1.66 support (https://github.com/domoticz/domoticz/issues/2034) +Patch8: %{name}-boost-1.66.patch BuildRequires: boost-devel BuildRequires: cmake @@ -87,6 +92,9 @@ any mobile device %patch3 -p1 -b.openzwave %patch4 -p1 -b.openzwave-Dev %patch5 -p1 -b.python +%patch6 -p1 -b.ozw-barrier1 +%patch7 -p1 -b.ozw-barrier2 +%patch8 -p1 -b.boost-166 rm -f hardware/openzwave/*.h rm -rf hardware/openzwave/aes rm -rf hardware/openzwave/command_classes @@ -179,6 +187,10 @@ usermod -G domoticz,dialout domoticz %changelog +* Thu Jan 25 2018 Michael Cronenworth - 3.8153-4 +- Add OpenZWave Command Class Barrier support +- Boost 1.66 support (RHBZ#1538585) + * Fri Sep 08 2017 Michael Cronenworth - 3.8153-3 - Fix OpenZWave control panel symlink (RHBZ#1482266) - Fix Python detection