diff --git a/.gitignore b/.gitignore index ef35caf..c3e4f03 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/domoticz-4.11671.tar.gz +/domoticz-2020.1.tar.gz diff --git a/domoticz-appversion b/domoticz-appversion index 6dd1b33..5dd5d5c 100644 --- a/domoticz-appversion +++ b/domoticz-appversion @@ -1,3 +1,3 @@ -#define APPVERSION 11671 -#define APPHASH "df9de70" -#define APPDATE 1580601600 +#define APPVERSION 11804 +#define APPHASH "77b93f1" +#define APPDATE 1584835200 diff --git a/domoticz-openzwave.patch b/domoticz-openzwave.patch index c53bb90..9773aed 100644 --- a/domoticz-openzwave.patch +++ b/domoticz-openzwave.patch @@ -42,7 +42,7 @@ index ffd8d742..79c708ce 100644 +#include +#include +#include - #include "..//main/Logger.h" + #include "../../../main/Logger.h" #include diff --git a/hardware/openzwave/control_panel/ozwcp.h b/hardware/openzwave/control_panel/ozwcp.h @@ -53,8 +53,8 @@ index 29ebc0e3..7a027815 100644 #include #include --#include "Driver.h" --#include "Notification.h" +-#include "../Driver.h" +-#include "../Notification.h" +#include +#include diff --git a/domoticz-ozw-barrier-support-0001.patch b/domoticz-ozw-barrier-support-0001.patch deleted file mode 100644 index d889d93..0000000 --- a/domoticz-ozw-barrier-support-0001.patch +++ /dev/null @@ -1,300 +0,0 @@ -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 deleted file mode 100644 index a190a07..0000000 --- a/domoticz-ozw-barrier-support-0002.patch +++ /dev/null @@ -1,86 +0,0 @@ -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-python37.patch b/domoticz-python37.patch deleted file mode 100644 index 4127d99..0000000 --- a/domoticz-python37.patch +++ /dev/null @@ -1,568 +0,0 @@ -From 5f61c5be95bb44f2ff3b913678c7bfdd3196ff69 Mon Sep 17 00:00:00 2001 -From: dnpwwo -Date: Sun, 1 Jul 2018 13:29:03 +1000 -Subject: [PATCH] Initial version working with Python 3.7 - ---- - hardware/plugins/DelayedLink.h | 15 +++++++++++++++ - hardware/plugins/PluginManager.cpp | 11 ++++++++++- - hardware/plugins/PluginManager.h | 5 +++-- - hardware/plugins/PluginMessages.h | 3 +++ - hardware/plugins/Plugins.cpp | 14 +++++++++++++- - hardware/plugins/Plugins.h | 1 + - main/EventsPythonModule.cpp | 24 +++++++++++++++++------- - 7 files changed, 62 insertions(+), 11 deletions(-) - -diff --git a/hardware/plugins/DelayedLink.h b/hardware/plugins/DelayedLink.h -index ecc7ec579..de9327a13 100644 ---- a/hardware/plugins/DelayedLink.h -+++ b/hardware/plugins/DelayedLink.h -@@ -86,8 +86,13 @@ namespace Plugins { - DECLARE_PYTHON_SYMBOL(PyObject*, PyImport_ImportModule, const char*); - DECLARE_PYTHON_SYMBOL(PyObject*, PyObject_CallObject, PyObject* COMMA PyObject*); - DECLARE_PYTHON_SYMBOL(int, PyFrame_GetLineNumber, PyFrameObject*); -+ DECLARE_PYTHON_SYMBOL(void, PyEval_InitThreads, ); -+ DECLARE_PYTHON_SYMBOL(PyThreadState*, PyThreadState_Get, ); - DECLARE_PYTHON_SYMBOL(PyThreadState*, PyEval_SaveThread, void); - DECLARE_PYTHON_SYMBOL(void, PyEval_RestoreThread, PyThreadState*); -+ DECLARE_PYTHON_SYMBOL(void, PyEval_ReleaseLock, ); -+ DECLARE_PYTHON_SYMBOL(PyThreadState*, PyThreadState_Swap, PyThreadState*); -+ DECLARE_PYTHON_SYMBOL(int, PyGILState_Check, ); - DECLARE_PYTHON_SYMBOL(void, _Py_NegativeRefcount, const char* COMMA int COMMA PyObject*); - DECLARE_PYTHON_SYMBOL(PyObject*, _PyObject_New, PyTypeObject*); - #ifdef _DEBUG -@@ -197,8 +202,13 @@ namespace Plugins { - RESOLVE_PYTHON_SYMBOL(PyImport_ImportModule); - RESOLVE_PYTHON_SYMBOL(PyObject_CallObject); - RESOLVE_PYTHON_SYMBOL(PyFrame_GetLineNumber); -+ RESOLVE_PYTHON_SYMBOL(PyEval_InitThreads); -+ RESOLVE_PYTHON_SYMBOL(PyThreadState_Get); - RESOLVE_PYTHON_SYMBOL(PyEval_SaveThread); - RESOLVE_PYTHON_SYMBOL(PyEval_RestoreThread); -+ RESOLVE_PYTHON_SYMBOL(PyEval_ReleaseLock); -+ RESOLVE_PYTHON_SYMBOL(PyThreadState_Swap); -+ RESOLVE_PYTHON_SYMBOL(PyGILState_Check); - RESOLVE_PYTHON_SYMBOL(_Py_NegativeRefcount); - RESOLVE_PYTHON_SYMBOL(_PyObject_New); - #ifdef _DEBUG -@@ -365,8 +375,13 @@ extern SharedLibraryProxy* pythonLib; - #define PyImport_ImportModule pythonLib->PyImport_ImportModule - #define PyObject_CallObject pythonLib->PyObject_CallObject - #define PyFrame_GetLineNumber pythonLib->PyFrame_GetLineNumber -+#define PyEval_InitThreads pythonLib->PyEval_InitThreads -+#define PyThreadState_Get pythonLib->PyThreadState_Get - #define PyEval_SaveThread pythonLib->PyEval_SaveThread - #define PyEval_RestoreThread pythonLib->PyEval_RestoreThread -+#define PyEval_ReleaseLock pythonLib->PyEval_ReleaseLock -+#define PyThreadState_Swap pythonLib->PyThreadState_Swap -+#define PyGILState_Check pythonLib->PyGILState_Check - #define _Py_NegativeRefcount pythonLib->_Py_NegativeRefcount - #define _PyObject_New pythonLib->_PyObject_New - #define PyArg_ParseTuple pythonLib->PyArg_ParseTuple -diff --git a/hardware/plugins/PluginManager.cpp b/hardware/plugins/PluginManager.cpp -index 72c04575f..e896b8bcc 100644 ---- a/hardware/plugins/PluginManager.cpp -+++ b/hardware/plugins/PluginManager.cpp -@@ -141,6 +141,9 @@ namespace Plugins { - Py_Initialize(); - m_InitialPythonThread = PyEval_SaveThread(); - -+ // Initialise threads. Python 3.7+ does this inside Py_Initialize so done here for compatibility -+ PyEval_InitThreads(); -+ - m_bEnabled = true; - _log.Log(LOG_STATUS, "PluginSystem: Started, Python version '%s'.", sVersion.c_str()); - } -@@ -319,7 +322,13 @@ namespace Plugins { - } - } - // Free the memory for the message -- if (Message) delete Message; -+ if (Message) -+ { -+ CPlugin* pPlugin = (CPlugin*)Message->Plugin(); -+ pPlugin->RestoreThread(); -+ delete Message; -+ pPlugin->ReleaseThread(); -+ } - } - sleep_milliseconds(50); - } -diff --git a/hardware/plugins/PluginManager.h b/hardware/plugins/PluginManager.h -index 99e126e41..df66f63f6 100644 ---- a/hardware/plugins/PluginManager.h -+++ b/hardware/plugins/PluginManager.h -@@ -36,10 +36,11 @@ namespace Plugins { - std::map* GetHardware() { return &m_pPlugins; }; - CDomoticzHardwareBase* RegisterPlugin(const int HwdID, const std::string &Name, const std::string &PluginKey); - void DeregisterPlugin(const int HwdID); -- bool StopPluginSystem(); -- void AllPluginsStarted() { m_bAllPluginsStarted = true; }; -+ bool StopPluginSystem(); -+ void AllPluginsStarted() { m_bAllPluginsStarted = true; }; - static void LoadSettings(); - void DeviceModified(uint64_t ID); -+ void* PythonThread() { return m_InitialPythonThread; }; - }; - }; - -diff --git a/hardware/plugins/PluginMessages.h b/hardware/plugins/PluginMessages.h -index f4e902553..b254c969e 100644 ---- a/hardware/plugins/PluginMessages.h -+++ b/hardware/plugins/PluginMessages.h -@@ -73,6 +73,7 @@ namespace Plugins { - boost::lock_guard l(PythonMutex); - m_pPlugin->RestoreThread(); - ProcessLocked(); -+ m_pPlugin->ReleaseThread(); - }; - virtual const char* PythonName() { return m_Callback.c_str(); }; - }; -@@ -367,6 +368,7 @@ static std::string get_utf8_from_ansi(const std::string &utf8, int codepage) - boost::lock_guard l(PythonMutex); - m_pPlugin->RestoreThread(); - ProcessLocked(); -+ m_pPlugin->ReleaseThread(); - }; - }; - -@@ -454,6 +456,7 @@ static std::string get_utf8_from_ansi(const std::string &utf8, int codepage) - boost::lock_guard l(PythonMutex); - m_pPlugin->RestoreThread(); - ProcessLocked(); -+ m_pPlugin->ReleaseThread(); - } - }; - -diff --git a/hardware/plugins/Plugins.cpp b/hardware/plugins/Plugins.cpp -index 329080b0a..9647a8c91 100644 ---- a/hardware/plugins/Plugins.cpp -+++ b/hardware/plugins/Plugins.cpp -@@ -35,6 +35,7 @@ extern std::string szWWWFolder; - extern std::string szAppVersion; - extern std::string szAppHash; - extern std::string szAppDate; -+extern MainWorker m_mainworker; - - namespace Plugins { - -@@ -867,6 +868,7 @@ namespace Plugins { - - try - { -+ PyEval_RestoreThread((PyThreadState*)m_mainworker.m_pluginsystem.PythonThread()); - m_PyInterpreter = Py_NewInterpreter(); - if (!m_PyInterpreter) - { -@@ -973,6 +975,7 @@ namespace Plugins { - } - _log.Log(LOG_STATUS, "(%s) Initialized %s", Name.c_str(), sExtraDetail.c_str()); - -+ PyEval_SaveThread(); - return true; - } - catch (...) -@@ -981,6 +984,7 @@ namespace Plugins { - } - - Error: -+ PyEval_SaveThread(); - m_bIsStarting = false; - return false; - } -@@ -1488,7 +1492,14 @@ namespace Plugins { - - void CPlugin::RestoreThread() - { -- if (m_PyInterpreter) PyEval_RestoreThread((PyThreadState*)m_PyInterpreter); -+ if (m_PyInterpreter) -+ PyEval_RestoreThread((PyThreadState*)m_PyInterpreter); -+ } -+ -+ void CPlugin::ReleaseThread() -+ { -+ if (m_PyInterpreter) -+ PyEval_SaveThread(); - } - - void CPlugin::Callback(std::string sHandler, void * pParams) -@@ -1537,6 +1548,7 @@ namespace Plugins { - if (m_SettingsDict) Py_XDECREF(m_SettingsDict); - if (m_PyInterpreter) Py_EndInterpreter((PyThreadState*)m_PyInterpreter); - Py_XDECREF(m_PyModule); -+ PyEval_ReleaseLock(); - } - catch (std::exception *e) - { -diff --git a/hardware/plugins/Plugins.h b/hardware/plugins/Plugins.h -index 0145747ee..d8808e147 100644 ---- a/hardware/plugins/Plugins.h -+++ b/hardware/plugins/Plugins.h -@@ -78,6 +78,7 @@ namespace Plugins { - void DisconnectEvent(CEventBase*); - void Callback(std::string sHandler, void* pParams); - void RestoreThread(); -+ void ReleaseThread(); - void Stop(); - - void WriteDebugBuffer(const std::vector& Buffer, bool Incoming); -diff --git a/main/EventsPythonModule.cpp b/main/EventsPythonModule.cpp -index a839cb546..bdde645a9 100644 ---- a/main/EventsPythonModule.cpp -+++ b/main/EventsPythonModule.cpp -@@ -122,6 +122,7 @@ - } - - boost::lock_guard l(PythonMutex); -+ PyEval_RestoreThread((PyThreadState*)m_mainworker.m_pluginsystem.PythonThread()); - m_PyInterpreter = Py_NewInterpreter(); - if (!m_PyInterpreter) - { -@@ -144,7 +145,8 @@ - PythonEventsInitalized = 1; - - PyObject* pModule = Plugins::PythonEventsGetModule(); -- if (!pModule) { -+ PyEval_SaveThread(); -+ if (!pModule) { - _log.Log(LOG_ERROR, "EventSystem - Python: Failed to initialize module."); - return false; - } -@@ -159,7 +161,8 @@ - if (Plugins::Py_IsInitialized()) - Py_EndInterpreter((PyThreadState*)m_PyInterpreter); - m_PyInterpreter = NULL; -- _log.Log(LOG_STATUS, "EventSystem - Python stopped..."); -+ PyEval_ReleaseLock(); -+ _log.Log(LOG_STATUS, "EventSystem - Python stopped..."); - return true; - } else - return false; -@@ -217,7 +220,8 @@ - - if (!pModuleDict) { - _log.Log(LOG_ERROR, "Python EventSystem: Failed to open module dictionary."); -- return; -+ PyEval_SaveThread(); -+ return; - } - - if (Plugins::PyDict_SetItemString(pModuleDict, "changed_device_name", Plugins::PyUnicode_FromString(m_devicestates[DeviceID].deviceName.c_str())) == -1) { -@@ -230,13 +234,15 @@ - if (Plugins::PyDict_SetItemString(pModuleDict, "Devices", (PyObject*)m_DeviceDict) == -1) - { - _log.Log(LOG_ERROR, "Python EventSystem: Failed to add Device dictionary."); -- return; -+ PyEval_SaveThread(); -+ return; - } - Py_DECREF(m_DeviceDict); - - if (Plugins::PyType_Ready(&Plugins::PDeviceType) < 0) { - _log.Log(LOG_ERROR, "Python EventSystem: Unable to ready DeviceType Object."); -- return; -+ PyEval_SaveThread(); -+ return; - } - - // Mutex -@@ -332,7 +338,8 @@ - if (Plugins::PyDict_SetItemString(pModuleDict, "user_variables", (PyObject*)m_uservariablesDict) == -1) - { - _log.Log(LOG_ERROR, "Python EventSystem: Failed to add uservariables dictionary."); -- return; -+ PyEval_SaveThread(); -+ return; - } - Py_DECREF(m_uservariablesDict); - -@@ -401,7 +408,10 @@ - } else { - _log.Log(LOG_ERROR, "Python EventSystem: Module not available to events"); - } -- } else { -+ -+ PyEval_SaveThread(); -+ -+ } else { - _log.Log(LOG_ERROR, "EventSystem: Python not initalized"); - } - -From 64750ee9d6b9388d0d4c48f32679b2fb52bb9931 Mon Sep 17 00:00:00 2001 -From: dnpwwo -Date: Sun, 1 Jul 2018 20:29:24 +1000 -Subject: [PATCH] 1st level Python tracing added - ---- - hardware/plugins/DelayedLink.h | 6 ++ - hardware/plugins/Plugins.cpp | 133 +++++++++++++++++++++++++++++++++ - hardware/plugins/Plugins.h | 1 + - 3 files changed, 140 insertions(+) - -diff --git a/hardware/plugins/DelayedLink.h b/hardware/plugins/DelayedLink.h -index de9327a13..bdb9d0ec3 100644 ---- a/hardware/plugins/DelayedLink.h -+++ b/hardware/plugins/DelayedLink.h -@@ -119,6 +119,8 @@ namespace Plugins { - DECLARE_PYTHON_SYMBOL(long, PyLong_AsLong, PyObject*); - DECLARE_PYTHON_SYMBOL(PyObject*, PyUnicode_AsUTF8String, PyObject*); - DECLARE_PYTHON_SYMBOL(PyObject*, PyImport_AddModule, const char*); -+ DECLARE_PYTHON_SYMBOL(void, PyEval_SetProfile, Py_tracefunc COMMA PyObject*); -+ DECLARE_PYTHON_SYMBOL(void, PyEval_SetTrace, Py_tracefunc COMMA PyObject*); - - #ifdef _DEBUG - // In a debug build dealloc is a function but for release builds its a macro -@@ -238,6 +240,8 @@ namespace Plugins { - RESOLVE_PYTHON_SYMBOL(PyLong_AsLong); - RESOLVE_PYTHON_SYMBOL(PyUnicode_AsUTF8String); - RESOLVE_PYTHON_SYMBOL(PyImport_AddModule); -+ RESOLVE_PYTHON_SYMBOL(PyEval_SetProfile); -+ RESOLVE_PYTHON_SYMBOL(PyEval_SetTrace); - } - } - _Py_NoneStruct.ob_refcnt = 1; -@@ -414,4 +418,6 @@ extern SharedLibraryProxy* pythonLib; - #define PyLong_AsLong pythonLib->PyLong_AsLong - #define PyUnicode_AsUTF8String pythonLib->PyUnicode_AsUTF8String - #define PyImport_AddModule pythonLib->PyImport_AddModule -+#define PyEval_SetProfile pythonLib->PyEval_SetProfile -+#define PyEval_SetTrace pythonLib->PyEval_SetTrace - } -diff --git a/hardware/plugins/Plugins.cpp b/hardware/plugins/Plugins.cpp -index 9647a8c91..05ef29b97 100644 ---- a/hardware/plugins/Plugins.cpp -+++ b/hardware/plugins/Plugins.cpp -@@ -120,6 +120,96 @@ namespace Plugins { - if (pTraceback) Py_XDECREF(pTraceback); - } - -+ int PyDomoticz_ProfileFunc(PyObject *self, PyFrameObject *frame, int what, PyObject *arg) -+ { -+ module_state* pModState = ((struct module_state*)PyModule_GetState(self)); -+ if (!pModState) -+ { -+ _log.Log(LOG_ERROR, "CPlugin:%s, unable to obtain module state.", __func__); -+ } -+ else if (!pModState->pPlugin) -+ { -+ _log.Log(LOG_ERROR, "CPlugin:%s, illegal operation, Plugin has not started yet.", __func__); -+ } -+ else -+ { -+ int lineno = PyFrame_GetLineNumber(frame); -+ std::string sFuncName = "Unknown"; -+ PyCodeObject* pCode = frame->f_code; -+ if (pCode && pCode->co_filename) -+ { -+ PyBytesObject* pFileBytes = (PyBytesObject*)PyUnicode_AsASCIIString(pCode->co_filename); -+ sFuncName = pFileBytes->ob_sval; -+ } -+ if (pCode && pCode->co_name) -+ { -+ if (sFuncName.length()) sFuncName += "\\"; -+ PyBytesObject* pFuncBytes = (PyBytesObject*)PyUnicode_AsASCIIString(pCode->co_name); -+ sFuncName = pFuncBytes->ob_sval; -+ } -+ -+ switch (what) -+ { -+ case PyTrace_CALL: -+ _log.Log(LOG_NORM, "(%s) Calling function at line %d in '%s'", pModState->pPlugin->Name.c_str(), lineno, sFuncName.c_str()); -+ break; -+ case PyTrace_RETURN: -+ _log.Log(LOG_NORM, "(%s) Returning from line %d in '%s'", pModState->pPlugin->Name.c_str(), lineno, sFuncName.c_str()); -+ break; -+ case PyTrace_EXCEPTION: -+ _log.Log(LOG_NORM, "(%s) Exception at line %d in '%s'", pModState->pPlugin->Name.c_str(), lineno, sFuncName.c_str()); -+ break; -+ } -+ } -+ -+ return 0; -+ } -+ -+ int PyDomoticz_TraceFunc(PyObject *self, PyFrameObject *frame, int what, PyObject *arg) -+ { -+ module_state* pModState = ((struct module_state*)PyModule_GetState(self)); -+ if (!pModState) -+ { -+ _log.Log(LOG_ERROR, "CPlugin:%s, unable to obtain module state.", __func__); -+ } -+ else if (!pModState->pPlugin) -+ { -+ _log.Log(LOG_ERROR, "CPlugin:%s, illegal operation, Plugin has not started yet.", __func__); -+ } -+ else -+ { -+ int lineno = PyFrame_GetLineNumber(frame); -+ std::string sFuncName = "Unknown"; -+ PyCodeObject* pCode = frame->f_code; -+ if (pCode && pCode->co_filename) -+ { -+ PyBytesObject* pFileBytes = (PyBytesObject*)PyUnicode_AsASCIIString(pCode->co_filename); -+ sFuncName = pFileBytes->ob_sval; -+ } -+ if (pCode && pCode->co_name) -+ { -+ if (sFuncName.length()) sFuncName += "\\"; -+ PyBytesObject* pFuncBytes = (PyBytesObject*)PyUnicode_AsASCIIString(pCode->co_name); -+ sFuncName = pFuncBytes->ob_sval; -+ } -+ -+ switch (what) -+ { -+ case PyTrace_CALL: -+ _log.Log(LOG_NORM, "(%s) Calling function at line %d in '%s'", pModState->pPlugin->Name.c_str(), lineno, sFuncName.c_str()); -+ break; -+ case PyTrace_LINE: -+ _log.Log(LOG_NORM, "(%s) Executing line %d in '%s'", pModState->pPlugin->Name.c_str(), lineno, sFuncName.c_str()); -+ break; -+ case PyTrace_EXCEPTION: -+ _log.Log(LOG_NORM, "(%s) Exception at line %d in '%s'", pModState->pPlugin->Name.c_str(), lineno, sFuncName.c_str()); -+ break; -+ } -+ } -+ -+ return 0; -+ } -+ - static PyObject* PyDomoticz_Debug(PyObject *self, PyObject *args) - { - module_state* pModState = ((struct module_state*)PyModule_GetState(self)); -@@ -355,6 +445,47 @@ namespace Plugins { - return Py_None; - } - -+ static PyObject* PyDomoticz_Trace(PyObject *self, PyObject *args) -+ { -+ module_state* pModState = ((struct module_state*)PyModule_GetState(self)); -+ if (!pModState) -+ { -+ _log.Log(LOG_ERROR, "CPlugin:%s, unable to obtain module state.", __func__); -+ } -+ else if (!pModState->pPlugin) -+ { -+ _log.Log(LOG_ERROR, "CPlugin:%s, illegal operation, Plugin has not started yet.", __func__); -+ } -+ else -+ { -+ int bTrace = 0; -+ if (!PyArg_ParseTuple(args, "p", &bTrace)) -+ { -+ _log.Log(LOG_ERROR, "(%s) failed to parse parameter, True/False expected.", pModState->pPlugin->Name.c_str()); -+ LogPythonException(pModState->pPlugin, std::string(__func__)); -+ } -+ else -+ { -+ pModState->pPlugin->m_bTracing = (bool)bTrace; -+ _log.Log(LOG_NORM, "(%s) Low level Python tracing %s.", pModState->pPlugin->Name.c_str(), (pModState->pPlugin->m_bTracing ? "ENABLED" : "DISABLED")); -+ -+ if (pModState->pPlugin->m_bTracing) -+ { -+ PyEval_SetProfile(PyDomoticz_ProfileFunc, self); -+ PyEval_SetTrace(PyDomoticz_TraceFunc, self); -+ } -+ else -+ { -+ PyEval_SetProfile(NULL, NULL); -+ PyEval_SetTrace(NULL, NULL); -+ } -+ } -+ } -+ -+ Py_INCREF(Py_None); -+ return Py_None; -+ } -+ - static PyMethodDef DomoticzMethods[] = { - { "Debug", PyDomoticz_Debug, METH_VARARGS, "Write a message to Domoticz log only if verbose logging is turned on." }, - { "Log", PyDomoticz_Log, METH_VARARGS, "Write a message to Domoticz log." }, -@@ -363,6 +494,7 @@ namespace Plugins { - { "Debugging", PyDomoticz_Debugging, METH_VARARGS, "Set logging level. 1 set verbose logging, all other values use default level" }, - { "Heartbeat", PyDomoticz_Heartbeat, METH_VARARGS, "Set the heartbeat interval, default 10 seconds." }, - { "Notifier", PyDomoticz_Notifier, METH_VARARGS, "Enable notification handling with supplied name." }, -+ { "Trace", PyDomoticz_Trace, METH_VARARGS, "Enable/Disable line level Python tracing." }, - { NULL, NULL, 0, NULL } - }; - -@@ -439,6 +571,7 @@ namespace Plugins { - Name = sName; - m_bIsStarted = false; - m_bIsStarting = false; -+ m_bTracing = false; - } - - CPlugin::~CPlugin(void) -diff --git a/hardware/plugins/Plugins.h b/hardware/plugins/Plugins.h -index d8808e147..d184e2be3 100644 ---- a/hardware/plugins/Plugins.h -+++ b/hardware/plugins/Plugins.h -@@ -108,6 +108,7 @@ namespace Plugins { - PluginDebugMask m_bDebug; - bool m_stoprequested; - bool m_bIsStarting; -+ bool m_bTracing; - }; - - class CPluginNotifier : public CNotificationBase - -From 463bb8e28be5ec7a6cfc452a5318f89f2d65a14d Mon Sep 17 00:00:00 2001 -From: dnpwwo -Date: Sun, 1 Jul 2018 22:56:32 +1000 -Subject: [PATCH] 2nd version, Python 3.7 and 3.6 - ---- - hardware/plugins/DelayedLink.h | 3 +++ - hardware/plugins/PluginManager.cpp | 8 ++++++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/hardware/plugins/DelayedLink.h b/hardware/plugins/DelayedLink.h -index bdb9d0ec3..44bcb118e 100644 ---- a/hardware/plugins/DelayedLink.h -+++ b/hardware/plugins/DelayedLink.h -@@ -87,6 +87,7 @@ namespace Plugins { - DECLARE_PYTHON_SYMBOL(PyObject*, PyObject_CallObject, PyObject* COMMA PyObject*); - DECLARE_PYTHON_SYMBOL(int, PyFrame_GetLineNumber, PyFrameObject*); - DECLARE_PYTHON_SYMBOL(void, PyEval_InitThreads, ); -+ DECLARE_PYTHON_SYMBOL(int, PyEval_ThreadsInitialized, ); - DECLARE_PYTHON_SYMBOL(PyThreadState*, PyThreadState_Get, ); - DECLARE_PYTHON_SYMBOL(PyThreadState*, PyEval_SaveThread, void); - DECLARE_PYTHON_SYMBOL(void, PyEval_RestoreThread, PyThreadState*); -@@ -205,6 +206,7 @@ namespace Plugins { - RESOLVE_PYTHON_SYMBOL(PyObject_CallObject); - RESOLVE_PYTHON_SYMBOL(PyFrame_GetLineNumber); - RESOLVE_PYTHON_SYMBOL(PyEval_InitThreads); -+ RESOLVE_PYTHON_SYMBOL(PyEval_ThreadsInitialized); - RESOLVE_PYTHON_SYMBOL(PyThreadState_Get); - RESOLVE_PYTHON_SYMBOL(PyEval_SaveThread); - RESOLVE_PYTHON_SYMBOL(PyEval_RestoreThread); -@@ -380,6 +382,7 @@ extern SharedLibraryProxy* pythonLib; - #define PyObject_CallObject pythonLib->PyObject_CallObject - #define PyFrame_GetLineNumber pythonLib->PyFrame_GetLineNumber - #define PyEval_InitThreads pythonLib->PyEval_InitThreads -+#define PyEval_ThreadsInitialized pythonLib->PyEval_ThreadsInitialized - #define PyThreadState_Get pythonLib->PyThreadState_Get - #define PyEval_SaveThread pythonLib->PyEval_SaveThread - #define PyEval_RestoreThread pythonLib->PyEval_RestoreThread -diff --git a/hardware/plugins/PluginManager.cpp b/hardware/plugins/PluginManager.cpp -index e896b8bcc..32fa2bffd 100644 ---- a/hardware/plugins/PluginManager.cpp -+++ b/hardware/plugins/PluginManager.cpp -@@ -139,10 +139,14 @@ namespace Plugins { - } - - Py_Initialize(); -- m_InitialPythonThread = PyEval_SaveThread(); - - // Initialise threads. Python 3.7+ does this inside Py_Initialize so done here for compatibility -- PyEval_InitThreads(); -+ if (!PyEval_ThreadsInitialized()) -+ { -+ PyEval_InitThreads(); -+ } -+ -+ m_InitialPythonThread = PyEval_SaveThread(); - - m_bEnabled = true; - _log.Log(LOG_STATUS, "PluginSystem: Started, Python version '%s'.", sVersion.c_str()); - diff --git a/domoticz-python38.patch b/domoticz-python38.patch index db849b8..a8ed786 100644 --- a/domoticz-python38.patch +++ b/domoticz-python38.patch @@ -2,12 +2,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 42082192..f16726f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -736,7 +736,7 @@ +@@ -662,7 +646,7 @@ message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support") endif (TELLDUSCORE_INCLUDE) --target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread ${MQTT_LIBRARIES} ${LUA_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES}) -+target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm ${MQTT_LIBRARIES} ${LUA_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES}) +-target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread ${MQTT_LIBRARIES} ${LUA_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${JSONCPP_LIBRARIES}) ++target_link_libraries(domoticz ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${CURL_LIBRARIES} pthread -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm ${MQTT_LIBRARIES} ${LUA_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${JSONCPP_LIBRARIES}) IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") target_link_libraries(domoticz -lresolv) diff --git a/domoticz-tinyxpath.patch b/domoticz-tinyxpath.patch index 84874c0..c0a8b5a 100644 --- a/domoticz-tinyxpath.patch +++ b/domoticz-tinyxpath.patch @@ -20,10 +20,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index bc231d8f6..334f203a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -512,22 +512,6 @@ - json/json_reader.cpp - json/json_value.cpp - json/json_writer.cpp +@@ -455,22 +455,6 @@ + webserver/server.cpp + webserver/Websockets.cpp + webserver/WebsocketHandler.cpp -tinyxpath/action_store.cpp -tinyxpath/htmlutil.cpp -tinyxpath/lex_util.cpp @@ -41,7 +41,7 @@ index bc231d8f6..334f203a6 100644 -tinyxpath/xpath_static.cpp -tinyxpath/xpath_syntax.cpp ) - add_executable(domoticz ${domoticz_SRCS}) + add_executable(domoticz ${domoticz_SRCS} ${domoticz_jsoncpp_SRCS}) @@ -658,6 +642,47 @@ ENDIF(LIBUSB_FOUND) @@ -91,6 +91,75 @@ index bc231d8f6..334f203a6 100644 ## support lua popen on Linux platforms #IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # SET(OperatingSystem "Linux") +--- a/hardware/openzwave/control_panel/ozwcp.cpp 2020-03-22 09:16:16.000000000 -0500 ++++ b/hardware/openzwave/control_panel/ozwcp.cpp 2020-03-24 10:53:04.968630391 -0500 +@@ -49,7 +49,7 @@ + #include + #include + #include +-#include "../../../tinyxpath/tinyxml.h" ++#include + + //#include "microhttpd.h" + #include "ozwcp.h" +--- a/hardware/plugins/PluginManager.cpp 2020-03-22 09:16:16.000000000 -0500 ++++ b/hardware/plugins/PluginManager.cpp 2020-03-24 13:53:05.305852598 -0500 +@@ -21,11 +21,12 @@ + #include "../../main/Logger.h" + #include "../../main/SQLHelper.h" + #include "../../main/WebServer.h" +-#include "../../tinyxpath/tinyxml.h" + #ifdef WIN32 ++# include "../../tinyxpath/tinyxml.h" + # include + #else + # include ++# include + #endif + + #include "DelayedLink.h" +--- a/hardware/plugins/Plugins.cpp 2020-03-22 09:16:16.000000000 -0500 ++++ b/hardware/plugins/Plugins.cpp 2020-03-24 13:45:46.056965796 -0500 +@@ -17,10 +17,11 @@ + #include "../main/SQLHelper.h" + #include "../main/mainworker.h" + #include "../main/localtime_r.h" +-#include "../tinyxpath/tinyxml.h" + + #include "../../notifications/NotificationHelper.h" + ++#include ++ + #define ADD_STRING_TO_DICT(pDict, key, value) \ + { \ + PyObject* pObj = Py_BuildValue("s", value.c_str()); \ +--- a/hardware/AnnaThermostat.cpp 2020-03-22 09:16:16.000000000 -0500 ++++ b/hardware/AnnaThermostat.cpp 2020-03-24 10:41:00.530030798 -0500 +@@ -9,7 +9,7 @@ + #include "../httpclient/HTTPClient.h" + #include "../main/mainworker.h" + +-#include "../tinyxpath/tinyxml.h" ++#include + + #define round(a) ( int ) ( a + .5 ) + +--- a/hardware/EcoDevices.cpp 2020-03-22 09:16:16.000000000 -0500 ++++ b/hardware/EcoDevices.cpp 2020-03-24 10:47:20.095926641 -0500 +@@ -33,11 +33,11 @@ + #include "hardwaretypes.h" + #include "../main/localtime_r.h" + #include "../httpclient/HTTPClient.h" +-#include "../tinyxpath/tinyxml.h" +-#include "../tinyxpath/xpath_static.h" + #include "../webserver/Base64.h" + #include "../main/json_helper.h" + #include ++#include ++#include + + #ifdef _DEBUG + #define DEBUG_EcoDevices --- a/hardware/OnkyoAVTCP.cpp 2018-06-23 09:18:06.000000000 -0500 +++ b/hardware/OnkyoAVTCP.cpp 2018-07-08 14:21:06.884163094 -0500 @@ -3,15 +3,15 @@ @@ -111,3 +180,15 @@ index bc231d8f6..334f203a6 100644 #define RETRY_DELAY 30 +--- a/hardware/RAVEn.cpp 2020-03-22 09:16:16.000000000 -0500 ++++ b/hardware/RAVEn.cpp 2020-03-24 12:55:59.616310732 -0500 +@@ -5,8 +5,8 @@ + #include "../main/Logger.h" + #include "../main/mainworker.h" + #include "../main/RFXtrx.h" +-#include "../tinyxpath/tinyxml.h" + #include "hardwaretypes.h" ++#include + + //Rainforest RAVEn USB ZigBee Smart Meter Adapter + //https://rainforestautomation.com/rfa-z106-raven/ diff --git a/domoticz-version.patch b/domoticz-version.patch deleted file mode 100644 index ecf613b..0000000 --- a/domoticz-version.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- a/appversion.default 2017-07-30 05:19:41.000000000 -0500 -+++ b/appversion.default 2017-07-31 11:36:32.150644222 -0500 -@@ -1,3 +1,3 @@ --#define APPVERSION 9700 --#define APPHASH "b97777b" --#define APPDATE 1478691222 -+#define APPVERSION 11671 -+#define APPHASH "df9de70" -+#define APPDATE 1580601600 diff --git a/domoticz.spec b/domoticz.spec index bbc362d..b63f866 100644 --- a/domoticz.spec +++ b/domoticz.spec @@ -1,28 +1,28 @@ -%global git_short_hash df9de70 -%global git_hash df9de7020c4317a484c39f7330e6d1c9ca3d9ec9 +#global git_short_hash df9de70 +#global git_hash df9de7020c4317a484c39f7330e6d1c9ca3d9ec9 Name: domoticz -Version: 4.11671 -Release: 0.git20200202.1%{?dist} +Version: 2020.1 +Release: 1%{?dist} Summary: Open source Home Automation System License: GPLv3+ and ASL 2.0 and Boost and BSD and MIT URL: http://www.domoticz.com -Source0: https://github.com/domoticz/domoticz/archive/%{git_short_hash}.tar.gz#/%{name}-%{version}.tar.gz +Source0: https://github.com/domoticz/domoticz/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +#Source0: https://github.com/domoticz/domoticz/archive/%%{git_short_hash}.tar.gz#/%%{name}-%%{version}.tar.gz Source1: %{name}.service Source2: %{name}.conf +# Manually update version reported inside app Source3: %{name}-appversion -# Manually update version reported inside app -Patch1: %{name}-version.patch # Use system tinyxpath (https://github.com/domoticz/domoticz/pull/1759) -Patch2: %{name}-tinyxpath.patch +Patch1: %{name}-tinyxpath.patch # Use system openzwave includes -Patch3: %{name}-openzwave.patch +Patch2: %{name}-openzwave.patch # Fix python detection (https://github.com/domoticz/domoticz/pull/1749) -Patch4: %{name}-python.patch +Patch3: %{name}-python.patch # Python 3.8 linking fix -Patch5: %{name}-python38.patch +Patch4: %{name}-python38.patch BuildRequires: boost-devel BuildRequires: cmake @@ -87,13 +87,13 @@ any mobile device %prep -%setup -q -n %{name}-%{git_hash} -#patch1 -p1 -b.version -%patch2 -p1 -b.tinyxpath -%patch3 -p1 -b.openzwave -%patch4 -p1 -b.python +%setup -q -n %{name}-%{version} +#setup -q -n %{name}-%{git_hash} +%patch1 -p1 -b.tinyxpath +%patch2 -p1 -b.openzwave +%patch3 -p1 -b.python %if 0%{?fedora} >= 32 -%patch5 -p1 -b.python38 +%patch4 -p1 -b.python38 %endif rm -f hardware/openzwave/*.h rm -rf hardware/openzwave/aes @@ -223,6 +223,9 @@ usermod -G domoticz,dialout domoticz %changelog +* Tue Mar 24 2020 Michael Cronenworth - 2020.1-1 +- New stable release + * Wed Feb 05 2020 Michael Cronenworth - 4.11671-0.git20200202.1 - Update git checkout diff --git a/sources b/sources index 12f1168..aa593a4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (domoticz-4.11671.tar.gz) = 0a90d4bd29876120f622992dc8a64d4ed1dcfc3eb045c1e66092e359a0d3df4277aac1703551f6d11a8b612c891f6bcc56c51359e906b22affdf1fc088b892d1 +SHA512 (domoticz-2020.1.tar.gz) = 6efc1c2b2da8d944a0501c0cb4802b46cd5998dc170507d9555ea6cd31930185bb879e9f7dba49146f896337e814ecf615b3f2fbbcb58d12404742a120466798