Get username in lua

Moderator: leecollings

Post Reply
Clemen
Posts: 75
Joined: Saturday 05 December 2015 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Europe
Contact:

Get username in lua

Post by Clemen »

Hi,

Is it posible to get the username of the person activating a switch command in lua?

I can see in the log, that the user is tied to the switch command.

I want to make a push notification when my kids activate/deactivate the alarm to my device, but i dont want to get a push when my wife or myself are activating the switch command.

We all do have different domoticz users.
User avatar
jvdz
Posts: 2476
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Get username in lua

Post by jvdz »

Don't think that information is available. Not sure how you are Activation/deactivating exactly via a switch, but you could have 2 separate switches where you for one enable the notification.

Jos
Clemen
Posts: 75
Joined: Saturday 05 December 2015 15:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Europe
Contact:

Re: Get username in lua

Post by Clemen »

I have a virtual switch to activate/deactivate,

I think it would be a nice feature in multiple of my scripts to get username of the person activating the switch. Its available in the log.
2016-03-08 18:44:09.598 User: clemen initiated a switch command
User avatar
jvdz
Posts: 2476
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Get username in lua

Post by jvdz »

That line is only shown when you have to login with a userid/password, but could be a nice feature. In the mean time you do have that option to create 2 virtual switches and select one of yourselve and partner and select the other for the kids, which you can then send notifications for.

Jos
Post Reply