Get device name in LUA script of the device changed

Moderator: leecollings

Post Reply
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Get device name in LUA script of the device changed

Post by rgroothuis »

Is it possible to get the name of the device that has changed?

I've one IF statement in which I check multiple door sensors. If one of them is triggered I want to print/use the name of which door sensor was triggered. Something like print ("Door sensor: " .. devicechanged[]) has been opened).

Any idea?
JareckiB12
Posts: 1
Joined: Monday 13 April 2015 22:15
Target OS: Linux
Domoticz version:
Contact:

Re: Get device name in LUA script of the device changed

Post by JareckiB12 »

If devicechanged['name of device'] then print(....) end

Jarecki
rgroothuis
Posts: 347
Joined: Friday 03 April 2015 17:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Get device name in LUA script of the device changed

Post by rgroothuis »

JareckiB12 wrote:If devicechanged['name of device'] then print(....) end

Jarecki
I know that trick indeed. But that means I get 3 or more if statements. It would be nice and good if there is one print statement with the device name as a variable. That is more efficient coding wise. And I want to use this trick at other places as well.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest