Error executing command / script from Domoticz
Posted: Friday 27 October 2023 15:57
Hi there - looking for a bit of help please with an error that happens with a script that runs the Ookla speedtest on my Pi.
I've installed the Ookla speedtest client and it runs fine from the command line, generating a JSON response (which is ideal for me to pick apart in dzvents; dots removed / replaced due to posting restriction):
Similarly all working OK when I run it from a script:
And and also if started from crontab with output directed to a file.
But if called from dzvents, either natively:
Or via a script:
It errors with:
If I add some debug code to the bash script, I know it is being run - it's the subsequent execution of /usr/bin/speedtest that is erroring, but only if originally called from dzvents.
Any help appreciated.
I've installed the Ookla speedtest client and it runs fine from the command line, generating a JSON response (which is ideal for me to pick apart in dzvents; dots removed / replaced due to posting restriction):
Code: Select all
pi@raspberrypi:~/speedtest $ /usr/bin/speedtest --accept-license --accept-gdpr --format=json
{"type":"result","timestamp":"2023-10-26T11:06:45Z","ping":{"jitter":0 362,"latency":5 257,"low":5 200,"high":6 603},"download":{"bandwidth":50847063,"bytes":545216888,"elapsed":11304,"latency":{"iqm":17 822,"low":4 913,"high":50 733,"jitter":0 857}},"upload":{"bandwidth":55170152,"bytes":551157241,"elapsed":10500,"latency":{"iqm":5 620,"low":4 971,"high":7 171,"jitter":0 334}},"packetLoss":0,"isp":"Gigaclear Limited","interface":{"internalIp":"192 168 1 186","name":"eth0","macAddr":"AA:AA:AA:AA:AA:AA","isVpn":false,"externalIp":"88 88 178 194"},"server":{"id":57318,"host":"speedtest zzoomm com","port":8080,"name":"Zzoomm Plc","location":"Slough","country":"United Kingdom","ip":"88 88 9 14"},"result":{"id":"e377b336-de75-4b7a-a23f-ffffffffff","url":"https://www speedtest net/result/c/e377b336-de75-4b7a-a23f-ffffffffffff","persisted":true}}
Code: Select all
#!/bin/bash
/usr/bin/speedtest --accept-license --accept-gdpr --format=json
But if called from dzvents, either natively:
Code: Select all
domoticz<dot>executeShellCommand({
command = '/usr/bin/speedtest --accept-license --accept-gdpr --format=json',
callback = 'myResponse',
timeout = 100,
})
Code: Select all
domoticz<dot>executeShellCommand({
command = '/home/pi/speedtest/runSpeedtest<dot>sh',
callback = 'myResponse',
timeout = 100,
})
Code: Select all
2023-10-25 16:06:52 045 Error: dzVents: Error: (3 1 8) Speedtest: {["isCustomEvent"]=false, ["callback"]="myResponse", ["isScene"]=false, ["isGroup"]=false, ["isTimer"]=false, ["isJSON"]=false, ["hasLines"]=false, ["statusCode"]=134, ["shellCommandResponse"]="myResponse", ["timeoutOccurred"]=false, ["isSecurity"]=false, ["baseType"]="shellcommandResponse", ["trigger"]="myResponse", ["isHTTPResponse"]=false, ["dump"]=function, ["isXML"]=false, ["statusText"]="terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not validAborted", ["data"]="", ["isSystem"]=false, ["ok"]=false, ["isVariable"]=false, ["isHardware"]=false, ["errorText"]="terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not validAborted", ["isShellCommandResponse"]=true, ["isDevice"]=false}
Any help appreciated.