tigger shell script automation

Discussions about RaZberry - Z-Wave board for Raspberry computer
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: tigger shell script automation

Post by pz1 »

good to hear you got it working
Quax1507
Posts: 46
Joined: 31 Mar 2015 12:19

Re: tigger shell script automation

Post by Quax1507 »

I tried this for my notifications. It is working with a binary sensor.

I have the Problem, that every event is sent twice.

Any ideas why that happens?
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Re: tigger shell script automation

Post by jstaffon »

I have the same problem. That's my next task, although I have to admit I'm not sure where to start just yet. I wonder if it's a timing issue. I don't fully understand js and how it activates the code segment when the sensor is triggered. I wonder if there's a call in js to return immediately following the system call instead of falling through the code. It's not much code but it does seem odd that it would execute twice.
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Re: tigger shell script automation

Post by jstaffon »

pz1,
Thanks so much for your help!

Jeff.
Quax1507
Posts: 46
Joined: 31 Mar 2015 12:19

Re: tigger shell script automation

Post by Quax1507 »

OK - I can see it is always sent twice:

[2015-06-14 17:10:35.605] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1.level = True
[2015-06-14 17:10:35.605] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1 = Empty
[2015-06-14 17:10:35.685] [D] [zway] SETDATA devices.25.data.lastReceived = 0 (0x00000000)
[2015-06-14 17:10:35.686] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1.level = True
[2015-06-14 17:10:35.686] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1 = Empty
[2015-06-14 17:10:35.909] [D] [zway] SETDATA devices.25.data.lastPacketInfo.delivered = True
[2015-06-14 17:10:35.909] [D] [zway] SETDATA devices.25.data.lastPacketInfo.packetLength = 4 (0x00000004)
[2015-06-14 17:10:35.910] [D] [zway] SETDATA devices.25.data.lastPacketInfo.deliveryTime = 294 (0x00000126)
[2015-06-14 17:10:35.910] [D] [zway] SETDATA devices.25.data.lastPacketInfo = **********
[2015-06-14 17:10:35.911] [D] [zway] SETDATA devices.25.data.lastSend = 662980 (0x000a1dc4)
[2015-06-14 17:10:35.921] [D] [zway] SETDATA devices.25.data.isFailed = False
[2015-06-14 17:10:35.923] [D] [zway] SETDATA devices.25.data.failureCount = 0 (0x00000000)
[2015-06-14 17:10:35.923] [D] [zway] SETDATA devices.25.data.lastSend = 662981 (0x000a1dc5)
[2015-06-14 17:10:36.072] [D] [zway] SETDATA devices.25.data.lastPacketInfo.delivered = True
[2015-06-14 17:10:36.073] [D] [zway] SETDATA devices.25.data.lastPacketInfo.packetLength = 4 (0x00000004)
[2015-06-14 17:10:36.073] [D] [zway] SETDATA devices.25.data.lastPacketInfo.deliveryTime = 76 (0x0000004c)
[2015-06-14 17:10:36.073] [D] [zway] SETDATA devices.25.data.lastPacketInfo = **********
[2015-06-14 17:10:36.074] [D] [zway] SETDATA devices.25.data.lastSend = 662996 (0x000a1dd4)
[2015-06-14 17:11:47.166] [D] [zway] SETDATA devices.25.data.lastReceived = 0 (0x00000000)
[2015-06-14 17:11:47.167] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1.level = False
[2015-06-14 17:11:47.168] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1 = Empty
[2015-06-14 17:11:47.247] [D] [zway] SETDATA devices.25.data.lastReceived = 0 (0x00000000)
[2015-06-14 17:11:47.249] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1.level = False
[2015-06-14 17:11:47.249] [D] [zway] SETDATA devices.25.instances.1.commandClasses.48.data.1 = Empty
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Re: tigger shell script automation

Post by jstaffon »

I tried a couple things to tweak the js code and it didn't make a difference. Mine is sent twice also. It's beyond my current capabilities. I'll sift through the forum....unless pz1 has any ideas.

--- /var/log/z-way-server.log

[2015-06-14 17:37:06.408] [D] [zway] RECEIVED: ( 01 09 00 04 00 05 03 30 03 FF 38 )
[2015-06-14 17:37:06.409] [D] [zway] SENT ACK
[2015-06-14 17:37:06.409] [D] [zway] SETDATA devices.5.data.lastReceived = 0 (0x00000000)
[2015-06-14 17:37:06.410] [D] [zway] SETDATA devices.5.instances.0.commandClasses.48.data.1.level = True
[2015-06-14 17:37:06.410] [D] [zway] SETDATA devices.5.instances.0.commandClasses.48.data.1 = Empty
[2015-06-14 17:37:06.539] [D] [zway] RECEIVED: ( 01 09 00 04 00 05 03 20 01 FF 2A )
[2015-06-14 17:37:06.539] [D] [zway] SENT ACK
[2015-06-14 17:37:06.540] [D] [zway] SETDATA devices.5.data.lastReceived = 0 (0x00000000)
[2015-06-14 17:37:06.540] [D] [zway] SETDATA devices.1.instances.0.commandClasses.32.data.srcNodeId = 5 (0x00000005)
[2015-06-14 17:37:06.540] [D] [zway] SETDATA devices.1.instances.0.commandClasses.32.data.srcInstanceId = 0 (0x00000000)
[2015-06-14 17:37:06.540] [D] [zway] SETDATA devices.1.instances.0.commandClasses.32.data.level = 255 (0x000000ff)
[2015-06-14 17:37:06.541] [D] [zway] SETDATA devices.5.instances.0.commandClasses.48.data.1.level = True
[2015-06-14 17:37:06.541] [D] [zway] SETDATA devices.5.instances.0.commandClasses.48.data.1 = Empty
[2015-06-14 17:40:20.015] [D] [zway] RECEIVED: ( 01 09 00 04 00 05 03 30 03 00 C7 )
[2015-06-14 17:40:20.016] [D] [zway] SENT ACK
[2015-06-14 17:40:20.016] [D] [zway] SETDATA devices.5.data.lastReceived = 0 (0x00000000)
[2015-06-14 17:40:20.016] [D] [zway] SETDATA devices.5.instances.0.commandClasses.48.data.1.level = False
[2015-06-14 17:40:20.017] [D] [zway] SETDATA devices.5.instances.0.commandClasses.48.data.1 = Empty

--- end log

Jeff.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: tigger shell script automation

Post by pz1 »

I've no idea why it is sent twice
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: tigger shell script automation

Post by PoltoS »

The device sends two packets:
1) Sensor Binary Report
2) Basic Set

The latter is mapped to Sensor Binary Report since some devices do not send Reports themselves. That's why you get it twice. Some devices like Aeon Multisensor allows to configure whether to send Basic or not. In other devices you need to remove RaZberry from control group and keep only in lifeline group.
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Re: tigger shell script automation

Post by jstaffon »

That makes sense. I also have the Aeon Multisensor and it only sends one text. I'll try that. Thanks
simonc
Posts: 16
Joined: 16 Aug 2015 18:43

Re: tigger shell script automation

Post by simonc »

Hi,

I'm new to this platform but, in some way and thank to your code and informations, I've succeded to configure a bash script to be executed when my door sensor it's True , the goal is to send one email .

I have a Fibaro sensor, it sends two emails like you said , but this is not the main problem for me, I have some strange behavior using "mutt" to send the email in my bash script.

It seems that launching the script in the z-way-server environment has something different from bash, I don't know how to describe it exactly but if I launch the script manually from bash everything it's fine, if the script is launched from the z-way-server everything works exept the mutt line that it's something like:

initially it was:

echo -e " Body message here" | mutt -s "$SUBJECT" -- "$DESTINATIONEMAIL"

this line launched form z way server when the sensor was triggered never worked...

Changing it to:

mutt -s "$SUBJECT" "$DESTINATIONEMAIL" < /path/to/message.txt

Started working but I tried to add an attachment (one image from webcam) with the "-a" option and now it's not working anymore:

mutt -s "$SUBJECT" -a /path/to/image.jpg "$DESTINATIONEMAIL" < /path/to/message.txt

All this commands work perfectly directly from bash...

Can you help me? Is there other alternatives to send email with attachments ?

thanks in advance,

Simone
Post Reply