devicechanged is nil

Moderator: leecollings

Post Reply
jrich523
Posts: 63
Joined: Monday 18 January 2016 21:43
Target OS: Windows
Domoticz version: 3.5196
Location: Seattle, WA
Contact:

devicechanged is nil

Post by jrich523 »

so i was trying to see what sort of message/data my scene remote would send so i can try and capture the button events, so i jsut setup a very simple test,

Code: Select all

commandArray = {}

print ("we're going to check the state of the button");

if (devicechanged['R1B2s'] == 'On') then
    print("captured change to On");
end

print("change tested");

return commandArray
It seems to think that the devicechanged is nil
attempt to index global 'devicechanged' (a nil value)
which i guess could maybe be possible but i firgured the whole reason the event triggered in the first place was because there was a changed device.
I think i recall having an issue with devicechanged before, and it doesnt show up in the intellisense.

is this object still valid? what am i missing?
[ Domoticz 3.5196 | Win10 | AeoTec Z-Stick Gen5 ]
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: devicechanged is nil

Post by Westcott »

Is it by any chance a 'time' script?
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
jrich523
Posts: 63
Joined: Monday 18 January 2016 21:43
Target OS: Windows
Domoticz version: 3.5196
Location: Seattle, WA
Contact:

Re: devicechanged is nil

Post by jrich523 »

so I would guess so because im noticing the time stamp on the errors are all on the minute (give or take a few ms)

I dont see anything that defines it as a 'time' script? how would i make it an 'event' script vs 'time' script?
[ Domoticz 3.5196 | Win10 | AeoTec Z-Stick Gen5 ]
SweetPants

Re: devicechanged is nil

Post by SweetPants »

jrich523 wrote:I dont see anything that defines it as a 'time' script? how would i make it an 'event' script vs 'time' script?
If file based, it's in the filename. If written usign Domoticz Editor, below eventname you have LUA and below that you can select All, Device, Security, Time, UserVariable. You should select device if using devicechanged
jrich523
Posts: 63
Joined: Monday 18 January 2016 21:43
Target OS: Windows
Domoticz version: 3.5196
Location: Seattle, WA
Contact:

Re: devicechanged is nil

Post by jrich523 »

oh, interesting!
I guess i never really look at that box since "all" seemed like a fine value to leave things at. So i've changed it to device but now its not triggering. I wonder if because its looking for a state change and not incoming events?

The "switch" (buttons show up as a switch device) but they are always on. there is no way to shut it off (it cant send the command so it fails) and it doesnt seem to be picking up a "device" event when i push the button.

The log does detect that the button was pressed though.
2017-02-10 11:33:59.555 (Z-Stick) Light/Switch (R1B2s)
so its capturing the event, but not triggering the script because, well, i dont know why, but i assume because the state goes from "on" to "on" and dom over looks it?
[ Domoticz 3.5196 | Win10 | AeoTec Z-Stick Gen5 ]
SweetPants

Re: devicechanged is nil

Post by SweetPants »

jrich523 wrote:I wonder if because its looking for a state change and not incoming events?
Yep, It's looking for a change from Off to On of your device
jrich523 wrote:so its capturing the event, but not triggering the script because, well, i dont know why, but i assume because the state goes from "on" to "on" and dom over looks it?

See above, it has to change from Off to On
jrich523
Posts: 63
Joined: Monday 18 January 2016 21:43
Target OS: Windows
Domoticz version: 3.5196
Location: Seattle, WA
Contact:

Re: devicechanged is nil

Post by jrich523 »

well thats a bummer, is there any way to do this? A timer seems bad since it triggers every minute and that would be way to slow response wise.
[ Domoticz 3.5196 | Win10 | AeoTec Z-Stick Gen5 ]
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: devicechanged is nil

Post by Westcott »

Make sure it is a 'device' script, and try this to see what has triggered it -

Code: Select all

commandArray = {}
print ("we're going to check the state of the trigger")
for deviceName,deviceValue in pairs(otherdevices) do
    print(deviceName..' = '..deviceValue)
end
print("change tested")
return commandArray
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
jrich523
Posts: 63
Joined: Monday 18 January 2016 21:43
Target OS: Windows
Domoticz version: 3.5196
Location: Seattle, WA
Contact:

Re: devicechanged is nil

Post by jrich523 »

yeah the "device" event type doesnt get triggered in this case so i cant get it to list the devices.

Its a scene controller so maybe i could create a scene with virtual switches and try that.
[ Domoticz 3.5196 | Win10 | AeoTec Z-Stick Gen5 ]
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest