if I enter the command:
pi@domoticz1:~ $ hcitool name <mac_address_of_my_phone>
it will give me the Bluetooth name of my phone (if within reach)
If I try in a script:
Code: Select all
return {
on = {
timer = {
'every minute',
},
shellCommandResponses = {
scriptVar,
},
},
logging = {
level = domoticz.LOG_DEBUG,
marker = 'Ben ik thuis',
},
execute = function(domoticz, item)
domoticz.log('Timer event was triggered by ' .. item.trigger, domoticz.LOG_INFO)
if item.isTimer then
domoticz.log('Item is Timer')
domoticz.executeShellCommand(
{
command = 'hcitool name xx:xx:xx:xx:xx:xx',
callback = scriptVar,
timeout = 20,
})
elseif item.isShellCommandResponse then
domoticz.log('Response from shell command')
end
domoticz.utils.dumpTable(item)
end
}
The callback is always nil and shellCommandResponses is never triggered.
the log:
- Spoiler: show
- 2021-05-16 17:08:00.416 Status: dzVents: Info: Ben ik thuis: ------ Start external script: BenIkThuisv_0_2.lua:, trigger: "every minute"
2021-05-16 17:08:00.416 Status: dzVents: Info: Ben ik thuis: Timer event was triggered by every minute
2021-05-16 17:08:00.416 Status: dzVents: Info: Ben ik thuis: Item is Timer
2021-05-16 17:08:00.416 Status: dzVents: Debug: Ben ik thuis: ExecuteShellCommand: command = hcitool name xx:xx:xx:xx:xx:xx
2021-05-16 17:08:00.417 Status: dzVents: Debug: Ben ik thuis: ExecuteShellCommand: callback = nil
2021-05-16 17:08:00.417 Status: dzVents: Debug: Ben ik thuis: ExecuteShellCommand: timeout = 20
2021-05-16 17:08:00.417 Status: dzVents: Debug: Ben ik thuis: ExecuteShellcommand: path = /home/pi/domoticz/scripts/dzVents/data/
2021-05-16 17:08:00.417 Status: dzVents: > isShellCommandResponse: false
2021-05-16 17:08:00.417 Status: dzVents: > isDevice: false
2021-05-16 17:08:00.417 Status: dzVents: > isScene: false
2021-05-16 17:08:00.417 Status: dzVents: > isGroup: false
2021-05-16 17:08:00.417 Status: dzVents: > isHTTPResponse: false
2021-05-16 17:08:00.417 Status: dzVents: > isSystem: false
2021-05-16 17:08:00.417 Status: dzVents: > baseType: timer
2021-05-16 17:08:00.417 Status: dzVents: > isTimer: true
2021-05-16 17:08:00.417 Status: dzVents: > dump()
2021-05-16 17:08:00.417 Status: dzVents: > trigger: every minute
2021-05-16 17:08:00.417 Status: dzVents: > isSecurity: false
2021-05-16 17:08:00.417 Status: dzVents: > isHardware: false
2021-05-16 17:08:00.417 Status: dzVents: > isVariable: false
2021-05-16 17:08:00.417 Status: dzVents: > isCustomEvent: false
2021-05-16 17:08:00.417 Status: dzVents: Info: Ben ik thuis: ------ Finished BenIkThuisv_0_2.lua
Domoticz 2021.1 (build 13251)
dzVents Version: 3.1.8
What am I doing wrong here?