projects
/
weathermon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3c1772b
)
Исправлена ошибка, из-за которой программа падала на некорректном (без разделителей...
author
Roman Bazalevsky
<rvb@rvb.name>
Fri, 16 Sep 2016 22:43:38 +0000
(
01:43
+0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Fri, 16 Sep 2016 22:43:38 +0000
(
01:43
+0300)
weathermon.lua
patch
|
blob
|
history
diff --git
a/weathermon.lua
b/weathermon.lua
index b2ca89897c47834c7bc6a93d8c71f0131f13c3ef..d1917c1c4ef203be8bef441b79a362ad4bbafb51 100755
(executable)
--- a/
weathermon.lua
+++ b/
weathermon.lua
@@
-139,8
+139,8
@@
end
function processLine(str)
msg=splitStr(line,':')
function processLine(str)
msg=splitStr(line,':')
- msg_type=msg[1] or
nil
- msg_body=msg[2] or
nil
+ msg_type=msg[1] or
''
+ msg_body=msg[2] or
''
if msg_type=="STATUS" then
printLog("Status: "..msg_body)
elseif msg_type=="ERROR" then
if msg_type=="STATUS" then
printLog("Status: "..msg_body)
elseif msg_type=="ERROR" then
@@
-154,8
+154,8
@@
function processLine(str)
sensor_id = web_devid
for i,rec in ipairs(sens) do
recrd=splitStr(rec,'=')
sensor_id = web_devid
for i,rec in ipairs(sens) do
recrd=splitStr(rec,'=')
- key=recrd[1] or
nil
- value=recrd[2] or
nil
+ key=recrd[1] or
''
+ value=recrd[2] or
''
if value then
if key=="TYPE" then
sensor_type=value
if value then
if key=="TYPE" then
sensor_type=value
@@
-197,8
+197,8
@@
function processLine(str)
mqtt_param = {}
for i,rec in ipairs(sens) do
recrd=splitStr(rec,'=')
mqtt_param = {}
for i,rec in ipairs(sens) do
recrd=splitStr(rec,'=')
- key=recrd[1] or
nil
- value=recrd[2] or
nil
+ key=recrd[1] or
''
+ value=recrd[2] or
''
if value then
if key=="TYPE" then
alarm_type=value
if value then
if key=="TYPE" then
alarm_type=value