Author Topic: How can I detect fast ON OFF  (Read 363 times)

Offline col8eral

  • Sr. Member
  • ****
  • Posts: 345
  • Karma: +3/-2
How can I detect fast ON OFF
« on: January 21, 2018, 02:19:01 pm »
Can someone help me with PLEG to detect a fast ON/OFF of a switch to then toggle another device switch state.

Many thanks

Offline col8eral

  • Sr. Member
  • ****
  • Posts: 345
  • Karma: +3/-2
Re: How can I detect fast ON OFF
« Reply #1 on: January 22, 2018, 07:30:18 pm »
Problem Solved so I thought i'd share it.

My problem is that I have two lamps that are only switchable via the Micasa app for a remote.  I wanted to make one of the light switches also double as a way to switch on the two lamps as well as the current function of switching on ceiling and accent lighting.  They have a fibaro relay.

Here's what I did:

Device Trigger

LoftLightOn          When ever the ceiling lights are switched on

Condition


LampTrigger         LoftLightOn; !LoftLightOn<1


Action


LampTrigger         LampOne  Toggle State
                           LampTwo  ToggleState

The result of the PLEG code is that when the ceiling light switch LoftLightOn is switched on and then off in less than 1 second the lamps power state is toggled between on and off.  Its working perfectly for me.



Offline col8eral

  • Sr. Member
  • ****
  • Posts: 345
  • Karma: +3/-2
Re: How can I detect fast ON OFF
« Reply #2 on: January 23, 2018, 09:02:43 am »
When I toggle the state the lamps are either 100% or 0%

How can I toggle the state between 0% and 40%

Many thanks

Offline cc4005

  • Full Member
  • ***
  • Posts: 101
  • Karma: +6/-0
Re: How can I detect fast ON OFF
« Reply #3 on: January 23, 2018, 05:06:31 pm »
Don't know how much it would slow response but you could probably have 2 conditions/actions, where each looks at the lamp on/off status as well as the lamp trigger and have the actions as SetLoadLevelTarget = 40 and 0.

Offline col8eral

  • Sr. Member
  • ****
  • Posts: 345
  • Karma: +3/-2
Re: How can I detect fast ON OFF
« Reply #4 on: January 27, 2018, 12:37:03 pm »
Thanks.

I tried adding a Property

GetStatus LampOne

Then I thought based on this being a 1 or 0 or would know if the toggle is turn the Lamps on or off

I changed the condiiton logic from this

LampTrigger         LoftLightOn; !LoftLightOn<1

to this

LampTrigger        GetStatus==1 and (LoftLightOn; !LoftLightOn<1)

This worked in that if LampOne was already on then the toggle action would switch it on.

However, when I switched LampOne off using the app with a single press, the amp went off then two seconds later came on again.  Im not sure what that happens

Any help?

Offline col8eral

  • Sr. Member
  • ****
  • Posts: 345
  • Karma: +3/-2
Re: How can I detect fast ON OFF
« Reply #5 on: January 30, 2018, 09:22:49 am »
Has anyone any ideas what Im doing wrong?

Many thanks in advance.

Offline cc4005

  • Full Member
  • ***
  • Posts: 101
  • Karma: +6/-0
Re: How can I detect fast ON OFF
« Reply #6 on: January 30, 2018, 10:47:36 am »
A status report might help us understand the problem.

Offline col8eral

  • Sr. Member
  • ****
  • Posts: 345
  • Karma: +3/-2
Re: How can I detect fast ON OFF
« Reply #7 on: January 30, 2018, 12:21:24 pm »
How do I generate a status report?

Offline cc4005

  • Full Member
  • ***
  • Posts: 101
  • Karma: +6/-0
Re: How can I detect fast ON OFF
« Reply #8 on: January 30, 2018, 01:23:24 pm »
In the PLEG edit screen...Editor Option > Status Report.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +33/-32
Re: How can I detect fast ON OFF
« Reply #9 on: January 30, 2018, 07:30:09 pm »
When the window pops up, try to save it as a PDF. Easier to read.  Attached is an example.
Vera 3, 1.7.1030, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb