the JSONPATH was wrong (I am still learning…).
I changed the var names to something unique
However the result is not chamged
11:16:08.085 [INFO ] [g.openhab.io.net.exec.ExecUtil:66 ] - executed commandLine ‘/home/pi/heatmiser-wifi-read-only/openhabscripts/hw_status.sh’
11:16:08.215 [ERROR] [o.o.c.t.actions.Transformation:47 ] - Error executing the transformation ‘JSONPATH’: the given parameters ‘JSonPath’ and ‘source’ must not be null
11:16:08.297 [INFO ] [g.openhab.io.net.exec.ExecUtil:66 ] - executed commandLine ‘/home/pi/heatmiser-wifi-read-only/openhabscripts/hw_status.sh’
11:16:08.440 [ERROR] [o.o.c.t.actions.Transformation:47 ] - Error executing the transformation ‘JSONPATH’: the given parameters ‘JSonPath’ and ‘source’ must not be null
11:16:08.580 [ERROR] [o.o.c.t.actions.Transformation:47 ] - Error executing the transformation ‘JSONPATH’: the given parameters ‘JSonPath’ and ‘source’ must not be null
11:16:08.851 [WARN ] [.c.i.events.EventPublisherImpl:80 ] - given new state is NULL, couldn’t post update for ‘HW_RoomTemperature’
I am also trying to output it via
logInfo(“HM”,status)
logInfo(“HM”,result)
however in the log (I am starting in start_debug) I cannot see anything.
update:
Nothing to do…
this is my rule:
rule “Initialization”
when
System started
then
var String sta = executeCommandLine("/home/pi/heatmiser-wifi-read-only/openhabscripts/hw_status.sh")
logInfo(“Testing”, “executecommandline”)
logInfo(“Testing”, sta)
postUpdate(dummy , sta)
var String res = transform(“JSONPATH”, “$.[‘192.168.2.251’].heating.target”, sta)
logInfo(“Testing”, “json”)
logInfo(“Testing”, res)
postUpdate(dummy , sta)
this is the log:
pi@openhab /var/opt/openhab/logs $ tail openhab.log
2015-12-30 10:22:47.373 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘hm.rules’
2015-12-30 10:22:47.575 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine ‘/home/pi/heatmiser-wifi-read-only/openhabscripts/hw_status.sh’
2015-12-30 10:22:47.612 [INFO ] [g.openhab.model.script.Testing] - executecommandline
2015-12-30 10:22:47.658 [INFO ] [g.openhab.model.script.Testing] - null
2015-12-30 10:22:47.774 [ERROR] [o.o.c.t.actions.Transformation] - Error executing the transformation ‘JSONPATH’: the given parameters ‘JSonPath’ and ‘source’ must not be null
2015-12-30 10:22:47.810 [INFO ] [g.openhab.model.script.Testing] - json
2015-12-30 10:22:47.855 [INFO ] [g.openhab.model.script.Testing] - null
2015-12-30 10:22:47.942 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine ‘/home/pi/heatmiser-wifi-read-only/openhabscripts/hw_status.sh’
2015-12-30 10:22:48.015 [ERROR] [o.o.c.t.actions.Transformation] - Error executing the transformation ‘JSONPATH’: the given parameters ‘JSonPath’ and ‘source’ must not be null
2015-12-30 10:22:48.065 [ERROR] [o.o.c.t.actions.Transformation] - Error executing the transformation ‘JSONPATH’: the given parameters ‘JSonPath’ and ‘source’ must not be null
files are ownership of pi user and group.
openhab is run as root so…
I even changed the script to printout directly a JSON string:
more /home/pi/heatmiser-wifi-read-only/openhabscripts/t
where t is the output of the heatmiser_json_oh.pl script put on one line:
{ “192.168.2.251” : { “comfort” : [ [ { “target” : 22, “time” : “06:30:00” }, { “target” : 22, “time” : “08:30:00” }, { “target” : 23, “time” : “12:30:00” }, { “target” : 22, “time” : “23:00:00” } ], [ { “target” : 22, “time” : “07:30:00” }, { “target” : 20, “time” : “23:30:00” } ] ], “config” : { “caloffset” : 0, “locklimit” : 0, “optimumstart” : 0, “outputdelay” : 0, “progmode” : “5/2”, “sensor” : “internal”, “switchdiff” : 1, “units” : “C” }, “dcblength” : 72, “enabled” : 1, “errorcode” : null, “frostprotect” : { “enabled” : 1, “target” : 12 }, “heating” : { “hold” : 0, “on” : 0, “target” : 22 }, “holiday” : { “enabled” : 0, “time” : “2015-12-30 09:59:00” }, “keylock” : 0, “product” : { “model” : “PRT”, “vendor” : “Heatmiser”, “version” : 1.9 }, “rateofchange” : 20, “runmode” : “heating”, “temperature” : { “floor” : null, “internal” : 22, “remote” : null }, “time” : “2015-12-30 09:59:57” } }
it is clear to me that although the executecommandline is logged as executed either the output is not getting passed to the sta String variable or there is no output from the command as the sta variable is null.
but… why