Using a Lazer Beam sensor as a push button for a fibaro relay


#1

1) Give a description of the problem
Complex problem. I’m wanting to use a Lazer Beam Break style sensor to trigger actions. Im using a fibaro dimmer S2 Scene input to detect the lazer beam is broken. The lazer beam makes a contact when broken that breaks again as soon as the beam is unbroken, this can happen quite quickly (think waving your hand through a beam) the contact is connected to the S2 connections on the fibaro dimmer and Webcore is watching for scene changes

2) What is the expected behavior?
Breaking the beam triggers webcore, Also the light should come on stay on for defined time then go off. every time the beam is broken it should reset the timer to keep the lights on. I have two other pistones one sets the light brightness to 20% at sunset, the other turns the light off at midnight. so from sunset to midnight i want the drive lights triggered to come on and then back down to 20%, from midnight to sunrise the lights need to come on and go off again. I want the lights to fade out slowly which is why i’m using the fade option. Its all working but not consistantly in future id also like to override it with a physical switch connected to S1 but im not sure how to accomplish this.

3) What is happening/not happening?
the beam needs to be broken for at least 3 seconds before Webcore sees it, otherwise nothing happens, however the fibaro dimmer sends the scene change right away. It also takes around 10 second for the light to trigger, the delay I can live with but the three second beam break is likley to cause me problems.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
Ill post some logs tonight when i get home


#2

when the beam is broken for under 3 seconds does the fibaro dimmer generate the same event as is generated when the beam is broken for more than 3 seconds? have you confirmed that from the fibaro dimmer event log?


#3

the fibaro dimmer does send different scenes for different presses. short press is one scene, long press is another. 2 presses and 3 presses also have different functions, that’s one of the reasons i used if the scene changes in my code. It shoudlnt be important which scene it changes from or to as long as it picks up a change.

do you think the different scenes could cause an issue im not thinking about?

there is a list of all the scenes available online so i could do,
if scene changes to scene 24
or
scene changes to scene 26
or
etc

if you think that might be more relaible


#4

lets try a little debugging. create a simple piston like so:

on event from
   fibaro dimmer scene
do
   with Location
   do
      log info 'A:' + $currentEventAttribute + '^ D:' + $currentEventDevice + '^ DI:' + $currentEventDeviceIndex + '^ DP:' + $currentEventDevicePhysical + '^ U:' + $currentEventUnit + '^ V:' + $currentEventValue + '^ S:' + $currentState + '^'
   end with
end on

then try the short and long break and lets see what the output looks like.

if you need any help with putting this test piston together just let me know.


#5

ok ill give it a try tonight

thanks


#6

OK I Think that worked

 7/10/2018, 8:21:28 PM +367ms
+1ms	╔Received event [Driveway].scene = 23 with a delay of 80ms
+79ms	║RunTime Analysis CS > 25ms > PS > 38ms > PE > 15ms > CE
+81ms	║Runtime (38046 bytes) successfully initialized in 38ms (v0.3.105.20180628) (79ms)
+82ms	║╔Execution stage started
+88ms	║║Comparison (string) 23 changes = true (1ms)
+89ms	║║Condition #4 evaluated true (3ms)
+90ms	║║Condition group #1 evaluated true (state did not change) (4ms)
+92ms	║║Cancelling statement #2's schedules...
+107ms	║║Calculating (string) A: + (string) scene >> (string) A:scene
+111ms	║║Calculating (string) A:scene + (string) ^ D: >> (string) A:scene^ D:
+116ms	║║Calculating (string) A:scene^ D: + (string) Driveway >> (string) A:scene^ D:Driveway
+120ms	║║Calculating (string) A:scene^ D:Driveway + (string) ^ DI: >> (string) A:scene^ D:Driveway^ DI:
+123ms	║║Calculating (string) A:scene^ D:Driveway^ DI: + (string) 1 >> (string) A:scene^ D:Driveway^ DI:1
+127ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1 + (string) ^ DP: >> (string) A:scene^ D:Driveway^ DI:1^ DP:
+130ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP: + (string) false >> (string) A:scene^ D:Driveway^ DI:1^ DP:false
+134ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false + (string) ^ U: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:
+137ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U: + (string) >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:
+140ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U: + (string) ^ V: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:
+142ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V: + (string) 23 >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23
+144ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23 + (string) ^ S: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23^ S:
+147ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23^ S: + (string) >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23^ S:
+149ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23^ S: + (string) ^ >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23^ S:^
+152ms	║║A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:23^ S:^
+153ms	║║Executed virtual command log (1ms)
+155ms	║╚Execution stage complete. (74ms)
+156ms	╚Event processed successfully (156ms)
7/10/2018, 8:21:27 PM +596ms
+0ms	╔Received event [Driveway].scene = 22 with a delay of 94ms
+67ms	║RunTime Analysis CS > 20ms > PS > 32ms > PE > 15ms > CE
+69ms	║Runtime (38048 bytes) successfully initialized in 32ms (v0.3.105.20180628) (67ms)
+69ms	║╔Execution stage started
+76ms	║║Comparison (string) 22 changes = true (1ms)
+77ms	║║Cancelling condition #4's schedules...
+78ms	║║Condition #4 evaluated true (4ms)
+79ms	║║Cancelling condition #1's schedules...
+79ms	║║Condition group #1 evaluated true (state changed) (5ms)
+81ms	║║Cancelling statement #2's schedules...
+96ms	║║Calculating (string) A: + (string) scene >> (string) A:scene
+101ms	║║Calculating (string) A:scene + (string) ^ D: >> (string) A:scene^ D:
+105ms	║║Calculating (string) A:scene^ D: + (string) Driveway >> (string) A:scene^ D:Driveway
+109ms	║║Calculating (string) A:scene^ D:Driveway + (string) ^ DI: >> (string) A:scene^ D:Driveway^ DI:
+113ms	║║Calculating (string) A:scene^ D:Driveway^ DI: + (string) 1 >> (string) A:scene^ D:Driveway^ DI:1
+116ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1 + (string) ^ DP: >> (string) A:scene^ D:Driveway^ DI:1^ DP:
+120ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP: + (string) false >> (string) A:scene^ D:Driveway^ DI:1^ DP:false
+123ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false + (string) ^ U: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:
+126ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U: + (string) >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:
+129ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U: + (string) ^ V: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:
+131ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V: + (string) 22 >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22
+134ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22 + (string) ^ S: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22^ S:
+136ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22^ S: + (string) >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22^ S:
+138ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22^ S: + (string) ^ >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22^ S:^
+141ms	║║A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:22^ S:^
+142ms	║║Executed virtual command log (1ms)
+144ms	║╚Execution stage complete. (75ms)
+145ms	╚Event processed successfully (146ms)

#7

That was me holding my hand in place for three seconds or more

below ill clear the log and do it again quickly


#8

here is my hand running through quickly

7/10/2018, 8:24:48 PM +898ms
+1ms	╔Received event [Driveway].scene = 26 with a delay of 68ms
+55ms	║RunTime Analysis CS > 11ms > PS > 32ms > PE > 11ms > CE
+57ms	║Runtime (38046 bytes) successfully initialized in 32ms (v0.3.105.20180628) (55ms)
+58ms	║╔Execution stage started
+65ms	║║Comparison (string) 26 changes = true (0ms)
+66ms	║║Condition #4 evaluated true (4ms)
+67ms	║║Condition group #1 evaluated true (state did not change) (4ms)
+68ms	║║Cancelling statement #2's schedules...
+84ms	║║Calculating (string) A: + (string) scene >> (string) A:scene
+88ms	║║Calculating (string) A:scene + (string) ^ D: >> (string) A:scene^ D:
+92ms	║║Calculating (string) A:scene^ D: + (string) Driveway >> (string) A:scene^ D:Driveway
+96ms	║║Calculating (string) A:scene^ D:Driveway + (string) ^ DI: >> (string) A:scene^ D:Driveway^ DI:
+100ms	║║Calculating (string) A:scene^ D:Driveway^ DI: + (string) 1 >> (string) A:scene^ D:Driveway^ DI:1
+103ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1 + (string) ^ DP: >> (string) A:scene^ D:Driveway^ DI:1^ DP:
+107ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP: + (string) false >> (string) A:scene^ D:Driveway^ DI:1^ DP:false
+110ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false + (string) ^ U: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:
+113ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U: + (string) >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:
+116ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U: + (string) ^ V: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:
+118ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V: + (string) 26 >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26
+120ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26 + (string) ^ S: >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26^ S:
+123ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26^ S: + (string) >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26^ S:
+125ms	║║Calculating (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26^ S: + (string) ^ >> (string) A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26^ S:^
+128ms	║║A:scene^ D:Driveway^ DI:1^ DP:false^ U:^ V:26^ S:^
+128ms	║║Executed virtual command log (1ms)
+130ms	║╚Execution stage complete. (73ms)
+131ms	╚Event processed successfully (131ms)

#9

@bangali, does that look correct to you?


#10

thats strange … says you posted those 2 days ago but i checked last night and didnt see any of the above comments.

checking … will respond.


#11
  1. set logging level for the piston to none

image

  1. clear the logs output if there is a clear button at the bottom of the logs

image

  1. then try the long break and short break with the beam

  2. copy all of the output from the log.info statement and paste it here


#12

Will do, ill do it again tonight


#13

The Code i put together looks like this, is that correct?


#14

yes looks right.

sorry for the delayed response … didnt get a notification. when replying to the poster so they get notified please use the first reply button. the second reply button located further down does not normally notify the poster.