Lua script, do i miss something?

Moderator: leecollings

Post Reply
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Lua script, do i miss something?

Post by francisb »

Hello,

I have copied a small lua script to trigger a shell script, but it seems not to work. The .sh script on itself works, tested in a shell under the same username as where Domticz is running in.

Code: Select all

commandArray = {}
  if (devicechanged['Deurbel']=='On') then
      os.execute('/home/pi/domoticz/scripts/SentSnapshot.sh')
      print('Script Deurbel is ingedrukt')
  end
return commandArray
I have put this ual script in the following folder on Rasberry Pi: /home/pi/domoticz/scripts/lua/script_device_Deurbel.lua.

My questions are:

Is there something wrong with the script?
The device name in the script, is this the same name you give when you add the device in Domoticz?
According to some documentation i should see a log in /var/log/domoticz, is this correct? i do not seem to have this.
Any other suggestions?

As you can see i am not sure how the mechanism of the domoticz and ual scripts is working, i found some documentation but most are about the ual scripting itself.

Any help is appriciated.

Francis
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Lua script, do i miss something?

Post by ThinkPad »

What does the log of Domoticz show you? You can view it through the webinterface, it is somewhere under the 'Setup' menu button.

I would turn the print and os.execute around, so that the print statement is executed first. This way it is easier to spot it in the log.
Device name should be an exact match of the name of the switch in Domoticz indeed.
I am not active on this forum anymore.
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Re: Lua script, do i miss something?

Post by francisb »

When i triggered the Doorbell, i can see the notification from the device itself not from the script.
No entry of the script in the log, also not after changing the print command as you stated in your reply.
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Re: Lua script, do i miss something?

Post by francisb »

could it be that the doorbell is on "group on" and if so how can i change that?
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
Kjakan
Posts: 14
Joined: Wednesday 11 March 2015 14:03
Target OS: Linux
Domoticz version: 2024.2
Location: Norway
Contact:

Re: Lua script, do i miss something?

Post by Kjakan »

You can change Doorbell Command in Setup -> Settings -> Other
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Re: Lua script, do i miss something?

Post by francisb »

And that my friend is the solution....it works now.

What is the group on for by the way? And can you change the ual script so it can also work on group on?
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Re: Lua script, do i miss something?

Post by francisb »

Ok, i cheered to early (dutch saying)

When i go the doorbell on the Domoticz website then it works, but when i actually press the doorbell it does not. The log is showing an entry.
2016-01-07 17:49:52.064 Notification sent (http) => Success
2016-01-07 17:49:51.765 (RFXCom) Lighting 2 (Deurbel)

So why does it not act correctly.....
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Re: Lua script, do i miss something?

Post by francisb »

Ok i investigate further and its the "group on" giving the problem. When i press within Domoticz website on the doorbell then i see in the log the on command.
But when de doorbell itself is pressed i see group on in the log.

So why is that?
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
francisb
Posts: 13
Joined: Wednesday 09 December 2015 21:29
Target OS: -
Domoticz version:
Contact:

Re: Lua script, do i miss something?

Post by francisb »

ok solved it, changed the ual script.

Code: Select all

if (devicechanged['Deurbel']=='Group On') then
So changed it to Group on.
Raspberry Pi 2B, rfxcom rfxtrx433e, COCO switches, oregon scientific temp/hum sensors, Foscam 8904W, Foscam 9821W v2,
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Lua script, do i miss something?

Post by ThinkPad »

Good to hear you got it fixed.

If you also want to trigger it from the website, you could make the script like this:

Code: Select all

if ((devicechanged['Deurbel']=='Group On') or (devicechanged['Deurbel']=='On')) then
rest of your script
I am not active on this forum anymore.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests