Skip to content

Commit b7d096e

Browse files
authored
Merge pull request #23 from domoticz/development
merge
2 parents b60437c + 467892e commit b7d096e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+172
-54
lines changed

.travis.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ before_install:
2222
# OpenZWave
2323
- git clone https://github.com/OpenZWave/open-zwave.git open-zwave-read-only
2424
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
25-
brew update;
26-
brew upgrade boost;
27-
fi
25+
brew update;
26+
brew upgrade boost;
27+
fi;
2828

2929
# Build matrix definition
3030
# * Two builds
@@ -61,9 +61,12 @@ matrix:
6161
- libdigest-sha-perl
6262
- python3-dev
6363
script:
64-
- wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz >> /dev/null 2>&1
65-
- tar xfz boost_1_67_0.tar.gz
66-
- cd boost_1_67_0/
64+
- curl -sSL https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3-Linux-x86_64.tar.gz -o cmake.tar.gz;
65+
- sudo tar xf cmake.tar.gz --strip 1 -C /usr/local;
66+
- export PATH=/usr/local/bin:$PATH;
67+
- wget https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz >> /dev/null 2>&1
68+
- tar xfz boost_1_70_0.tar.gz
69+
- cd boost_1_70_0/
6770
- ./bootstrap.sh
6871
- ./b2 stage threading=multi link=static --with-thread --with-system --with-chrono >> /dev/null 2>&1
6972
- sudo ./b2 install threading=multi link=static --with-thread --with-system --with-chrono >> /dev/null 2>&1
@@ -85,6 +88,7 @@ matrix:
8588
# - brew link openssl --force
8689
# - brew install md5sha1sum
8790
# - brew upgrade python
91+
# - brew upgrade cmake
8892
# - export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
8993
# script:
9094
# - CPPFLAGS="-std=c++11" cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)/Headers -DPYTHON_LIBRARY=$(python3-config --prefix)/lib/libpython3.6.dylib

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#set to minimum version that supports clean build on cygwin
2-
cmake_minimum_required(VERSION 2.8.4)
1+
#set to minimum version that supports clean build
2+
cmake_minimum_required(VERSION 3.14.0)
33

44
project(domoticz)
55

66
## required min. libBoost version
7-
SET(DOMO_MIN_LIBBOOST_VERSION 106000)
7+
SET(DOMO_MIN_LIBBOOST_VERSION 1.60.0)
88
##
99

1010
MACRO(Gitversion_GET_REVISION dir variable)
@@ -576,14 +576,16 @@ set(Boost_USE_STATIC_LIBS ${USE_STATIC_BOOST})
576576
set(Boost_USE_MULTITHREADED ON)
577577
unset(Boost_INCLUDE_DIR CACHE)
578578
unset(Boost_LIBRARY_DIRS CACHE)
579-
find_package(Boost REQUIRED COMPONENTS thread system)
580579

581580
if(USE_STATIC_BOOST)
582581
message(STATUS "Linking against boost static libraries")
583582
else(USE_STATIC_BOOST)
584583
message(STATUS "Linking against boost dynamic libraries")
585584
endif(USE_STATIC_BOOST)
586585

586+
find_package(Boost REQUIRED COMPONENTS thread system)
587+
target_link_libraries(domoticz Boost::thread Boost::system)
588+
587589
# compare found vs required libBoost version
588590
if(Boost_VERSION VERSION_LESS DOMO_MIN_LIBBOOST_VERSION)
589591
message(FATAL_ERROR "Found libBoost version ${Boost_VERSION}, ${DOMO_MIN_LIBBOOST_VERSION} or newer required")

History.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
Version 4.beta (xx 2019)
1+
Version 4.xxxxx (xxx 2019)
2+
- Implemented: DarkSky CloudCover sensor
3+
- Implemented: EventSystem, option in Settings to enable/disable URL call logging containing full URL path
4+
5+
Version 4.10717 (May 9th 2019)
6+
- Fixed: dzVents, Allowing no error message for HTTP calls (#3191)
7+
- Fixed: EcoCompteur now uses the port specified in the hardware setup (#3184)
8+
- Fixed: Log for Weight sensor (#3192)
29
- Fixed: issue with Session ID/Login
10+
- Fixed: issue with slightly to large labels for the selector switch (#3187)
311
- Updated: dzVents (version 2.4.19, See dzVents/documentation/history.md)
412

513
Version 4.10658 (May 5th 2019)

dzVents/documentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ The domoticz object holds all information about your Domoticz system. It has glo
548548
- **fromJSON(json, fallback <sup>2.4.16</sup>)**: *Function*. Turns a json string to a Lua table. Example: `local t = domoticz.utils.fromJSON('{ "a": 1 }')`. Followed by: `print( t.a )` will print 1. Optional 2nd param fallback will be returned if json is nil or invalid.
549549
- **osExecute(cmd)**: *Function*: Execute an os command.
550550
- **round(number, [decimalPlaces])**: *Function*. Helper function to round numbers. Default decimalPlaces is 0.
551-
- **stringSplit(string, [separator ])**:<sup>2.4.19</sup> *Function*. Helper function to split a line in separate words. Default separator is space.
551+
- **stringSplit(string, [separator ])**:<sup>2.4.19</sup> *Function*. Helper function to split a line in separate words. Default separator is space. Return is a table with separate words.
552552
- **toCelsius(f, relative)**: *Function*. Converts temperature from Fahrenheit to Celsius along the temperature scale or when relative==true it uses the fact that 1F==0.56C. So `toCelsius(5, true)` returns 5F*(1/1.8) = 2.78C.
553553
- **toJSON(luaTable)**: *Function*. <sup>2.4.0</sup> Converts a Lua table to a json string.
554554
- **urlDecode(s)**: <sup>2.4.13</sup> *Function*. Simple deCoder to convert a string with escaped chars (%20, %3A and the likes) to human readable format

dzVents/documentation/README.wiki

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ The domoticz object holds all information about your Domoticz system. It has glo
546546
** '''fromJSON(json, fallback <sup>2.4.16</sup>)''': ''Function''. Turns a json string to a Lua table. Example: <code>local t = domoticz.utils.fromJSON('{ &quot;a&quot;: 1 }')</code>. Followed by: <code>print( t.a )</code> will print 1. Optional 2nd param fallback will be returned if json is nil or invalid.
547547
** '''osExecute(cmd)''': ''Function'': Execute an os command.
548548
** '''round(number, [decimalPlaces])''': ''Function''. Helper function to round numbers. Default decimalPlaces is 0.
549-
** '''stringSplit(string, [separator ])''':<sup>2.4.19</sup> ''Function''. Helper function to split a line in separate words. Default separator is space.
549+
** '''stringSplit(string, [separator ])''':<sup>2.4.19</sup> ''Function''. Helper function to split a line in separate words. Default separator is space. Return is a table with separate words.
550550
** '''toCelsius(f, relative)''': ''Function''. Converts temperature from Fahrenheit to Celsius along the temperature scale or when relative==true it uses the fact that 1F==0.56C. So <code>toCelsius(5, true)</code> returns 5F*(1/1.8) = 2.78C.
551551
** '''toJSON(luaTable)''': ''Function''. <sup>2.4.0</sup> Converts a Lua table to a json string.
552552
** '''urlDecode(s)''': <sup>2.4.13</sup> ''Function''. Simple deCoder to convert a string with escaped chars (%20, %3A and the likes) to human readable format

dzVents/runtime/Domoticz.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ local function Domoticz(settings)
205205
dumpTable = function(t, level)
206206
return utils.dumpTable(t, level)
207207
end,
208+
209+
stringSplit = function(text, sep)
210+
return utils.stringSplit(text, sep)
211+
end,
208212

209213
}
210214
}

dzVents/runtime/HTTPResponse.lua

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ local function HTTPResponce(domoticz, responseData)
99
self.baseType = domoticz.BASETYPE_HTTP_RESPONSE
1010
self.data = responseData.data
1111
self._contentType = _.get(self.headers, {'Content-Type'}, '')
12-
13-
self.isJSON = false
12+
13+
self.isJSON = false
1414

15-
self.statusText = responseData.statusText
16-
self.protocol = responseData.protocol
17-
self.statusCode = responseData.statusCode
18-
19-
self.ok = ( self.statusCode >= 200 and self.statusCode <= 299 )
15+
self.statusText = responseData.statusText
16+
self.protocol = responseData.protocol
17+
self.statusCode = responseData.statusCode
18+
19+
if self.statusCode >= 200 and self.statusCode <= 299 then
20+
self.ok = true
21+
else
22+
self.ok = false
23+
domoticz.log(self.protocol .. " response: " .. self.statusCode .. " ==>> " .. self.statusText ,domoticz.LOG_ERROR)
24+
end
2025

2126
self.isHTTPResponse = true
2227
self.isDevice = false
@@ -37,6 +42,7 @@ local function HTTPResponce(domoticz, responseData)
3742
self.json = json
3843
end
3944
end
45+
4046
return self
4147
end
4248

dzVents/runtime/device-adapters/rgbw_device.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ return {
155155
return false
156156
end
157157
if not(hue) or not(inRange(hue, 0, 360)) then
158-
domoticz.log('Brightness value need to be number from 0-100', utils.LOG_ERROR)
158+
domoticz.log('hue value need to be number from 0-360', utils.LOG_ERROR)
159159
return false
160160
end
161161
if isWhite and type(isWhite) ~= "boolean" then

dzVents/runtime/tests/testDomoticz.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,4 +985,22 @@ describe('Domoticz', function()
985985
}, domoticz.utils.fromJSON(json))
986986
end)
987987

988+
it('should convert a table to json', function()
989+
local t = { a= 1 }
990+
local res = domoticz.utils.toJSON(t)
991+
assert.is_same('{"a":1}', res)
992+
end)
993+
994+
it('should dump a table to log', function()
995+
local t = { a=1,b=2,c={d=3,e=4, "test"} }
996+
local res = domoticz.utils.dumpTable(t,"> ")
997+
assert.is_nil(res)
998+
end)
999+
1000+
it('should split a string ', function()
1001+
assert.is_same(domoticz.utils.stringSplit("A-B-C", "-")[2],"B")
1002+
assert.is_same(domoticz.utils.stringSplit("I forgot to include this in Domoticz.lua")[7],"Domoticz.lua")
1003+
end)
1004+
1005+
9881006
end)

dzVents/runtime/tests/testHTTPResponse.lua

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,41 @@ describe('HTTPResponse', function()
4949
assert.is_true(r.ok)
5050
end)
5151

52-
it('should have a valid statuscode', function()
52+
it('should have a valid statuscode', function()
5353

5454
local r = HTTPResponse({
5555
BASETYPE_HTTP_RESPONSE = 'httpResponse'
5656
}, {
5757
headers = {['Content-Type'] = 'application/json' },
58-
statusText = 'Empty response' ,
59-
protocol = 'HTTP/1.4' ,
60-
statusCode = 404 ,
58+
statusText = 'Empty response' ,
59+
protocol = 'HTTP/1.4' ,
60+
statusCode = 404 ,
6161
data = '{"a":1}',
6262
callback = 'trigger1',
63-
63+
64+
65+
})
66+
assert.is_same('HTTP/1.4', r.protocol)
67+
assert.is_same(404, r.statusCode)
68+
assert.is_false(r.ok)
69+
assert.is.same('Empty response',r.statusText)
70+
end)
71+
72+
it('should have a valid statustext', function()
73+
74+
local r = HTTPResponse({
75+
BASETYPE_HTTP_RESPONSE = 'httpResponse'
76+
}, {
77+
headers = {['Content-Type'] = 'application/json' },
78+
data = '{"a":1}',
79+
callback = 'trigger1',
80+
6481

6582
})
66-
assert.is_same('HTTP/1.4', r.protocol)
67-
assert.is_same(404, r.statusCode)
83+
assert.is_same('', r.protocol)
84+
assert.is_same(0,r.statusCode)
6885
assert.is_false(r.ok)
69-
assert.is.same('Empty response',r.statusText)
86+
assert.is_same('',r.statusText)
7087
end)
7188

7289
end)

0 commit comments

Comments
 (0)