Jump to content

All-in-One Scene: How to do it Better


Recommended Posts

Many users have downloaded All-in-One Scene and I believe there are some questions about usage.

The purpose of this topic is to help to get most of  All-in-One Scene , to share best ideas/actions and solutions.

Please feel free to ask any scene's related question and I'll share my best solution with you.

 

 

 

 

Edited by cag014
  • Like 2
Link to post
Share on other sites
  • Replies 2k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

The idea, is that AOQ will support HC2 devices remotely... something like remote slave. I mean you'll be able to control devices in HC2 in HC3. (using API commands). I t will be something li

Many users have downloaded All-in-One Scene and I believe there are some questions about usage. The purpose of this topic is to help to get most of  All-in-One Scene , to share best ideas/actions

Me too.  

Posted Images

Here a question I have been asked:

@AR27690

I have 5 external doors at my home and I want to turn ON Red light (in my living room) if one of the doors is open.

Could you suggest the best option to do it?

@cag014

There are a few options to do it and I'm not sure if my suggestion is the best. It depends on personal logic.

Here is my suggestion (including TTS "Door closed" please remove it if you don't have TTS or no need)

define at jS2n table your doors device IDs

jS2n={door1=100, door2=200,door3=300,door4=400,door5=500, redLight=600}

jM={0, "`doo1r`|`door2`|`door3`|`door4`|`door5`",{state="value=true",trueAct={"`redLight`","turnOn",""},

falseAct={{"|`redLight`|","turnOff","","{`door1`:value=false|`door2`:value=false|`door3`:value=false|`door4`:value=false|`door5`:value=false}"},

{"","tts","Doors closed","{`door1`:value=false|`door2`:value=false|`door3`:value=false|`door4`:value=false|`door5`:value=false}"}}}}

In general when any door opens, red light turns ON, if door closed and all other door are closed, red light turns OFF and TTS announce "Door closed"

Of course it could be done by using variable or using trigAct{} table and etc.

 

@AR27690

Thanks, works fine.

Could you post solution using variable also? For Education purpose

@cag014

Here is it:

1. define variable iDoor and set gVarName as system predefind global variable (in this example global variable name is "aosGlobal". iDoor init value is alway =0.(On scene startup)

global4local= {true,gVarName="aosGlobal",varArray={iDoor="init:0"}}

2. Copy following action lines:

jM={

{0,"&iDoor",{state="value>0",
      trueAct={"|`redLight `|","turnOn",""},
      falseAct={{"|`redLight `|","turnOff",""},{"","tts","Doors closed"}} }},

{0,"`door1`|`door2`|`door3`|`door4`|`door5`",{state="value=true",

initAct={"iDoor","setGlobal","&iDoor+1","{|$id:value=true|}"},

trueAct={"iDoor","setGlobal","&iDoor+1"},

falseAct={"iDoor","setGlobal","&iDoor-1"}}},

}

In general:

On startup initAct{} will set iDoor value accrding to doors state.

When door opened global variable iDoor=iDoor+1, when closed iDoor=iDoor-1.

If iDoor >0 then turn ON red light, if iDoor=0 then turn OFF red light.

Link to post
Share on other sites

How to turn garden lights ON at sunset + 1 hour and OFF at sunrise+ 1hour

Here few options to perform it:

Solution 1

jS2n={GardenLights=780}
jM={
{0,"$24clock",{state="value=$sunsetHour",trigAct={{"`GardenLights`","turnOn","", "{$24clock:value>?$sunsetHour+3600?|`GardenLights`:value=false}{$24clock:value<?$sunriseHour+3600?|`GardenLights`:value=0}"},
 {"`GardenLights`","turnOff","", "{$24clock:value>?$sunriseHour+3600?|$24clock:value<?$sunsetHour+3600?|`GardenLights`:value=true}"}} }},     
}

trigAct executed on every change of $24clock (every minute) and according to conditions will execute ON or OFF . The state value doesn't mean anything.

On scene startup, garden lights will be set to correct value  within a minute.

After manual interaction (On or Off), scene will return garden lights back to correct state within a minute.

Solution 2

jS2n={GardenLights=780}
jM={
{10,"`GardenLights`",{state="value=false", timeSlot="?$sunsetHour+3600?~", timeSpanOn=true,
trueAct={"`GardenLights`","turnOn","","{$24clock:value>?$sunsetHour+3540?}{$24clock:value<?$sunriseHour+3600?}"},
timeLoopAct={"`GardenLights`","turnOff","","{$24clock:value>?$sunriseHour+3600?|$24clock:value<$sunsetHour}"}}},
  }

According to timeSlot, at sunset + 3600, trueAct  executed and turns lighs ON.

timeSpanOn=true, keeps the line in loop every 10 minutes either if state status is true or false. Normally timeSpan loop works only if state status is true. Now every 10 minutes timeLoopAct executed, but the conditions are, if current time ($24clock) is greater than sunrise+1 hour and less than sunset, turnOff the lights. So the lights will be turned OFF ± 10 minutes after sunrise +1 hour.

When ever you will start the scene, during initializing if lights OFF trueAct will be executed. if lights ON and time over sunrise + 3600, within 10 minutes, lights will be turned OFF

If someone manually turns lights OFF during (sunset +3600 ~ sunrise + 3600), it will be turned ON immediately.

If someone manually turns lights ON during (sunrise +3600 ~ sunset), it will be turned OFF within 10 minutes.

 

Solution 3

jS2n={GardenLights=780}
jM={
{0,"$24clock",{state="value=0",timeSlot="?$sunsetHour+3600?~,~?$sunriseHour+3600?",
trueAct={"`GardenLights`","turnOn","",false}, falseAct={"`GardenLights`","turnOff","",false}}},
}

Simply turn On light at sunset+3600 and turn OFF at sunrise+3600. Manual interaction won't be overridden by scene, means

if someone turns light Off it will stay Off till following sunset+3600. if someone turns light On it will stay On till following sunrise+3600.

 

At sunset+3600 execute trueAct - turnOn, at sunrise+3600 execute falseAct - turnOff

trueAct and falseAct will not be executed during initialization and on startup the lights will stay at same condition, no change by the scene.

Edited by cag014
Link to post
Share on other sites

Hello cag014,

 

first thank you for this  scene.👍 Also your output in the debug window are very helpful to analyse my mistakes. The greatest challenge for me is to put the right amount of " ` $ _ [... on the right place 😅

 

Actual I fight with the Notification Control ( pushnote) Here I don't find the right code.

 

Example:

{0, "730",{state="value=true",trueAct={"Test","sendPush[,574]","Light XY On"}}},

730 = Walli Dimmer

574 = Phone ID of my Android mobile

I tried:

sendPush,574; sendPush,[574] everything leads to a different error. Sometimes you covered it:

Spoiler

image.png.6c1f24373b5a55a26501cf73f3077137.png

 

 Perhaps my fail is a little tiny letter on an other place. Maybe someone else can help.

 

Thank you for the code you share with the community 😊

 

Link to post
Share on other sites

it should be

{0, "730",{state="value=true",trueAct={"Test","sendPush,574","Light XY On"}}},

 

  • Thanks 1
Link to post
Share on other sites

Hello,

 

thank you for the reply. I have change the code and the scene starts without a error. But after that I change the ID to another ID and now I get always this error:

 

Spoiler

image.png.7452bb41372ff2effd329d89168295c8.png

 

But it can be I have changed some other code. I will delete some of the added code.

Link to post
Share on other sites

Interesting...  device with no name? Are you sure about device ID? looks like it's not exist in the system

could you please post device data?

execute in browser http://hc2/api/devices/devID

 

Edited by cag014
  • Thanks 1
Link to post
Share on other sites

OK The error comes not from the code for the push.

First part of browser execute:
{"id":479,"name":"VSL Sidekick v1.0b6","roomID":

This causes the error:

{0, "`WPFernseherWZ`",{state="power>10",trueAct={"`VDVSLSidekick`","pressButton,14",""}}},

 

Device is a WP for TV when switched on (>10W) the State for the light should change to TV light scene.

trueAct is a VD to switch Sankotronics VSL VD to TV State perhaps it's the name "VSL Sidekick v1.0b6" that is responsible for the error (letter ".")

 

I rename it and test again. Thanks for the hint.

Link to post
Share on other sites
  • 2 weeks later...

Hello. My AOS scene does not start automatically with the HC2 booting after a power outage.

I have not changed anything below "do not change" and it is set to "Run scene: automatic"

Link to post
Share on other sites
4 hours ago, storskogen said:

Hello. My AOS scene does not start automatically with the HC2 booting after a power outage.

I have not changed anything below "do not change" and it is set to "Run scene: automatic"

By default the scene won't run automatically. It's user depended configuration.

Please add autostart definition at scene's header, see below.
--[[

%% autostart
%% properties
%% weather
Temperature
Humidity
Wind
WeatherCondition
--]]

 

 

Link to post
Share on other sites
  • 5 weeks later...

Hello,

 

can someone help me with this functions:

 

If the garagedoor longer open as 10 mins send a push to phone XYZ. In all my versions the push will be send direct after the door opens.

 

{10, "`GarageDoor`",{state="value=true",trueAct={"Achtung!","sendPush,542","Garagentor noch offen!"}}},

 

A second function is:

 

If a window or door longer open than a half hour and if the temperature outside < 15° it sends also a push.

Or as a second warning to switch a hue light(VD is implemented) to a color.

 

 I tried a lot of different codes but nothing works as expected. 

 

Thank you Manuel

 

 

 

 

Link to post
Share on other sites
1 hour ago, FunkFib said:

If the garagedoor longer open as 10 mins send a push to phone XYZ. In all my versions the push will be send direct after the door opens.

{10, "`GarageDoor`",{state="value=true",trueAct={"Achtung!","sendPush,542","Garagentor noch offen!"}}},

This one is easy to solve...

  1. Replace trueAct by timeLoopAct and  you'll receive notification every 10 minutes (if garage door continues to be open).
  2. Replace trueAct by timeoutAct and you'll receive one notification after 10 minutes. (if garage door continues to be open, no notification sent

In both case when garage door closed the state resets and will start over when garage opened again.

1 hour ago, FunkFib said:

A second function is:

If a window or door longer open than a half hour and if the temperature outside < 15° it sends also a push.

Or as a second warning to switch a hue light(VD is implemented) to a color.

Assuming your device IDs are:

VD 600 button 1

window sensor is 700

door sensor is 800

Temperature sensor is 900

then:

{30,"700|800",{state="value=true",timeLoopAct={{"Warning!","sendPush,542","$name in $room is open over $timeSpan minutes","{900:value<15|$id:lastBreached<2400}"},{"600","pressButton,1","", "{900:value<15|$id:lastBreached>2400}"}}}},

please change IDs according to your system.

Edited by cag014
  • Thanks 1
Link to post
Share on other sites

👍

 

First tipp I think I got it.

 

trueAct = allways if it goes to true

timeLoopAct = every time loop as defined  in first field

timeoutAct = once after defined  in first field

 

The second one... I'm a learner. I have to read you manual once(countless 😅) more.

 

Thank you for your help. I'm looking forward to your new version.

 

Merry Christmas 🌲

 

Link to post
Share on other sites

It's OK... new version will include built-in user guide for every field and action.

 

By the way right now the second solution has constant number in conditions. If in the future you'll change timeSpan you need to update conditions. May I suggest to use follow line, which calculates correct lastBreached values based on timeSpan, so if you change timeSpan, conditions will be auto-synchronized accordingly.

{30,"700|800",{state="value=true",timeLoopAct={{"Warning!","sendPush,542","$name in $room is open over $timeSpan minutes","{900:value<15|$id:lastBreached<?$timeSpan*60+($timeSpan/10*60)?}"},{"600","pressButton,1","", "{900:value<15|$id:lastBreached>?$timeSpan*60+($timeSpan/10*60)?}"}}}},

 

Edited by cag014
Link to post
Share on other sites

Hello,

 

thank you again for the help. I have replaced the code for auto synchronization. 

 

The code leads to following error:

 

Spoiler

651221530_2019-12-2522_17_28-HomeCenter2.png.dd4ab0fd683a3552a854666772f6efd6.png

 

$name in $room is open over $timeSpan minutes

 

$name = Toilettenfenster

$room = Flur-EG  <-- I assume this is the problem "-" letter minus. Could this be so?

 

I will test it with another room.

 

letter "ü" is also a problem? Test room Büro...

 

Manuel

 

 

Edited by FunkFib
Link to post
Share on other sites

Yes the minus is a problem... I suggest instead of using $room, just write the room name and % after - ( Flur-%EG) it should work.

Thanks for finding a bug, will be fixed in next release

 

Edited by cag014
Link to post
Share on other sites

Hello,

 

I have  moved some more magic scenes to All-in-One scene. I have problems with the send push function. The Push messages will only send to the iPad. Every other mobile phone won't receive the push messages (iPhone or Android). With my other alarm scripts I receive the push massages with every device. Could this possible? Is there a difference between the iPhone or iPad push message?

 

The code above leads to an error:

{30,"700|800",{state="value=true",timeLoopAct={{"Warning!","sendPush,542","$name in $room is open over $timeSpan minutes","{900:value<15|$id:lastBreached<?$timeSpan*60+($timeSpan/10*60)?}"},{"600","pressButton,1","", "{900:value<15|$id:lastBreached>?$timeSpan*60+($timeSpan/10*60)?}"}}}},

BUG] 17:29:26: 2019-12-27 17:29:26.349761 [ fatal] Unknown exception: /opt/fibaro/scenes/185.lua:298: attempt to index field '?' (a nil value)

 

Is this part right? I have searched for a mistake but I couldn't find the reason for the error.

 

?$timeSpan*60+($timeSpan/10*60)?

 

exg. 2 Minutes

 

2*60 = 120

+

2/10*60 = 12

=

132 sec.

 

 

Manuel

Link to post
Share on other sites

Do you use this line as is? You should change device IDs according to your system. The device numbers are an example only.

Link to post
Share on other sites

Hello,

 

no sorry.

 

this is my code

 

{30,"245",{state="value=true",timeLoopAct={{"Warnung!","sendPush,542","$name in der Toilette ist über $timeSpan Minuten offen","{79:value<15|$id:lastBreached<?$timeSpan*60+($timeSpan/10*60)?}"},{"518","pressButton,1","", "{79:value<15|$id:lastBreached>?$timeSpan*60+($timeSpan/10*60)?}"}}}},

 

but I also copy and past this part (?$timeSpan*60+($timeSpan/10*60)?) to this code (exchanged  3600):

 

{20,"571",{state="value=true",timeLoopAct={{"Warnung!","sendPush,`iPadUG`,`PhoneDL`,`iPadOG`,`PhoneML`","$name in der Toilette ist über $timeSpan Minuten offen. Bitte schliessen!","{79:value<15|$id:lastBreached<3600}"}}}},

 

At the moment I add jS2n table variables ;-) 

Edited by FunkFib
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...