Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


All-in-One Scene 9.6

   (2 reviews)

11 Screenshots

About This File

This script is designated to control and monitor your home system. Script automatically identifies the type of elements in the system. (Z-wave device, virtual device, scene, automatic scene (Block, Magic or Lua). Any valid Z-wave device property and his value could be monitored, controlled and execute commands accordingly.

If you don’t want or need to use this script, but have issues with your system (like delays, z-wave devices don’t respond always, scene receives no triggers), it helpful to run this scene as is (without any changes) just to monitor and to identify z-wave “dead” and/or NACK occurrences in your system. You’ll receive on-line notifications about it.

 

The first time you use All-in-One Scene, you will need to define jM {} hash table. Each line in table has two mandatory and two optional fields.

jM={ {      15,         "137|630",{timeSlot={“12:00~18:00”},state="value=true",     trueAct={“|230|”, “turnOn”,””}}}   }

             time span      IDs list                                         Criteria & Rules                            Action tables

a)      time span   a period of time (in minutes) within which some activity must be performed by device or scene. Additional two option could be defined:

I.        time span = 0   defines the line as activity only.

II.      time span = ‘negative number’   line is suspended (remarked)

b)      IDs list   given list of devices/scenes/VD/global/keywords. Use under score for scene IDs. (“_45”).

a)      global variable – add an ampersand sign & to global variable name: &varName

b)      keyword – add a dollar sign $ to keyword variable: $name

Note: To use & and $ characters for other purpose , add % after the character.

c)      Criteria & Rules     (optional) property, state, time slot, vacation mode…

d)      Action tables      (optional) tables of commands to be executed.

By defining String-to-number table which converts device name to ID            jS2n= {boiler=137, dryer=630}

 jM{} above table will look like, device name must be included within back apostrophe sign.

jM={ { 15,  "`boiler`|`dryer`",{timeSlot={“12:00~18:00”},state="value=true",     trueAct={“|230|”, “turnOn”,””}}}   }

 

1. Monitor option

There are so many times that scenes or Virtual devices are stuck w/o any understandable reason. Some devices suddenly stop to send reports or don’t change state. In most of the cases we don’t aware about the problem till something goes very wrong.  The monitor option will send an alert in case of defined states are timed out.

Note:  In order to monitor virtual devices, fibaro:log() command must be included in main loop or in button’s code.  For example, just add fibaro:log(“done”) at end of your main loop and VD could be monitored.

Example to set watchdog timer for devices, scenes, virtual devices, global variables and keywords

jM={      {8, "_17|_545",{timeSlot=”10:00~22:00”}},  -- within every 8 min.  between 10am to 10pm, scenes 17, 545 must be active. If not alert sent.

{3,"134|618|_556|_588"},  -- within  every 3 min. devices 134,618 and scenes 556,588 must be active. If not auto-alert sent.

{10,”132|145”,{property=”power”}}, -- within every 10 min. devices in list must report new power value. If not auto-alert sent.

{5,”112”,{state=”value=true”}}, -- if device’s value is true over 5 minutes, auto-alert sent. (e.g. device stuck in breached state)

{30,”470”,{state=”power>10”}}, -- if device’s power greater than 10 over 30 minutes, auto-alert sent.

{20,”&HomeStatus|$iDoor”}} -- if global variable HomeStatus or keyword iDoor didn’t change within 20 min., auto-alert sent.

 

2. Control option

This part of the script enables execution of actions based on device state or value changes. Script supports many options, calculations, time modifications, if statement and other features to do almost everything that you need to control your home just with one scene (which even doesn’t trigger by the system). 

Six action tables could be defined: (See AOS Advanced User’s Guide for more information.)

trueAct{} - executed when state status is true. Please do not confused between state and value. If state defined as “value=false”, state status is true when value of device is false.

falseAct{} - executed when state status is false. Please do not confused between state and value. If state defined as “value=false”, state status is false when value of device is true.

trigAct{} - executed on every value change at any mode, true or false

timeoutAct{} - Disables auto-alert notification and executed when elapsed time exceeds time span. Time span counting restarted after state status back to true.

timeLoopAct{} - Disables auto-alert notification and executed when elapsed time exceeds time span. Time counting restarted immediately even if status remains true (no back to true change required).

InitAct{} - Set of specific actions to be executed on startup only.

Here is an example  of most common wanted scenario, to turn on light when motion sensor breached and turn off light when sensor back to safe after few minutes (3 min. in this example)

jM={0,”`mSensor`”,{state=”value=true”,trueAct={“`lightSw`”,”turnOn”,””},falseAct={“`lightSw`”,”turnOff”,”180”}}}

Since no need to turn on light during the day, timeslot could be defined

jM={0,”`mSensor`”,{state=”value=true”,timeslot=”18:00~07:00”,trueAct={“`lightSw`”,”turnOn”,””},falseAct={“`lightSw`”,”turnOff”,”180”}}}

But now could be an issue to turn off the light, if sensor breached few seconds before end of timeslot and back to safe out of time slot, falseAct{} table won’t be executed. In this case, turning light off should be part of trueAct{} table

jM={0,"`mSensor`”,{state=”value=true”,timeslot=”18:00~07:00”,trueAct={{“`lightSw`”,”turnOn”,””},{“`lightSw`”,”turnOff”,”180”}}}

Same Z-wave device, global variable and keyword could be defined at several lines (no limit). Scene and Virtual devices could be defined one time only.

Please download

1.      AOS Advanced User’s Guide - complete instructions and information

2.      AOS Quick Guide syntax format reference and examples

3.      AOS HC-WebEye Viewer Guide   - AOS browser viewer guide

4.      timeDrift – If you considering to use time drift correction, please download this scene and follow instructions at header.

 Script Advantages:

  1. No Lua or any software knowledge required.
  2. Supports time drift correction. (download timeDrift scene)
  3. Supports vacation and power outage modes.
  4. Provides excellent view of all devices, global and keyword variables at a glance, including: status, current value, up to 20 last values & executed commands. (Defined by dataRecord variable)
  5. Each command to be executed with current variable values is shown
  6. All items displayed by their names, including VD buttons in human readable format (not just IDs)
  7. At the bottom of the table up to 50 last commands in execution order are displayed (defined by cnnLine variable)
  8. Commands executed much faster than using system’s standard triggering mechanism (Lua, Block or Magic)
  9. No limits of scene’s “Max. running instances”
  10. Complex operation could be executed by newbie users (like experts).
  11. Anti-ripple delay could be applied. (change status after specific delay according to latest value)
  12. Actions could be executed by/from Scenes and VDs.
  13. Add/Change/Suspend any action in few seconds of work.
  14. Z-Wave traffic always monitored and summary of the traffic displayed.
  15.  Dead and NACK occurrences of entire system immediately reported, recorded and notification sent to user.
  16. Repeated commands and device’s reports (RPT) of entire system are recorded and displayed.
  17. Global variables names, elapsed time from last change and their current values are shown. (Variables used in table)
  18. Details of all actions and commands are displayed in popup menus.
  19. Keeps Z-wave traffic low as possible by verifying device state before sending command.
  20. If device ID changed (excluded/included), user needs to update device ID in one place only! No extra jSON tables.
  21. Keeps your RAM load low

All data displayed  as a table where all configured devices and their related data displayed in human readable format. Extra button 'Refresh' will appear and covers 'Clear' button. Press ‘Refresh’ or ‘Start’ buttons to refresh table data.

Spoiler

Capture.PNG.2cf602b1b5b77aff03082f0f6d4d8291.PNG

 

Table's header includes:

Spoiler

Capture.PNG.7ceb7222a5e7ff0c8f7de4a5666599e6.PNG

startup time stamp, script current version, scene Name, LED as displayed at HC2 front panel, sunrise/set hours.

System name – by hovering mouse over, system inventory shown

Spoiler

Capture1.PNG.2cb031d0f47760f67d8371f251fe06df.PNG

Current home mode (@home or @vacation)

system status - by hovering mouse over,  last system's activities is shown

Spoiler

Capture.thumb.PNG.ab48fc18a9c0ea9985d105a8f0fa5432.PNG

Elapsed time

Total Z-wave events - by hovering mouse over summary of all activities shown

Spoiler

Capture.PNG.e6b3e1057c04b2c8cbf3912b98bbc666.PNG

Min, average and max Z-traffic, by hovering mouse over CPU elapsed time shown

Spoiler

Capture1.PNG.d6a6deea3600eb72df7308dd6f22778a.PNG

By hovering mouse over column headers, quick guide is shown. Quick guide displayed during 5 minutes from startup. On every manual refresh, the guide displayed for next 5 minutes.

Spoiler

Capture.thumb.PNG.28f6d92e7a35b84a97e495527952ea7b.PNG

 

Table columns are:

Type – device type (Z.Device, G. Variable, V.Device, luaScene, blockScene, magicScene, Auto-luaScene, Auto-blockScene, Auto-magicScene). By hovering mouse over Z.dev type column, top active devices are shown. User configurable by setting topActive global variable. (0-30) default 15

Spoiler

Capture.PNG.8a834b9007c1b3cd7157616c12c27981.PNG

ID: Description – room name: device ID: device name. Z-wave devices sorted by rooms, then by device ID.

Battery capable device have green background according to current battery level. If device armed, alarm icon appears.By hovering mouse over, inventory of devices in jM{} table are shown.

Spoiler

Capture.PNG.6d2dbe3063ddebc10840137515f6b06f.PNG

Value – items current value. By hovering mouse over, latest values, trigger value and command executed are shown.

Spoiler

Capture.PNG.89db08ad331c4e1a063ee9cf4ac21f81.PNG

Criteria – state of evaluation to determine true or false status. If formula included, the state displayed in Italic fonts and by hovering mouse over, popup menu shows the formula and calculations

Spoiler

Capture3.PNG.554650ab6784a96d3619acee45635c3b.PNG

Last seen – elapsed time since last status change.

Alert – by default this column isn’t shown. If any devices have been alerted the column will be shown. Please notice that in some cases the device could be alerted, but after while it could back to normal activity. For example, if motion sensor is breached over specified time-span, alert notification will be sent. But after a while the sensor back to safe and alert is canceled, “back to normal” notification will be sent.  At header of alert column shown current number of alerts

Spoiler

Capture1.PNG.12bb6d493ffe8e04f50ceb5400860956.PNG

 

Time Span – time span to monitor state of items. By hovering mouse over, maximum reached span time shown.

If time span set to 0, then this line acts as activity, no timeout alerts reported.

If time span set to negative number, this line is suspended and no actions executed.

Spoiler

Capture.PNG.185dbb6b67cdb2fcfead716c2203e27f.PNG

Time Slot – Active time slot range to execute related actions. Timestamp to execute specific action at specific time.

trueAct – list of actions to execute when state is true.

falseAct – list of actions to execute when state is true.

trigAct – list of actions when value changes

timeoutAct – list of actions to execute when time-span reached.  Timer will be restarted when device state changed again to true.

timeLoopAct – list of actions to execute when time-span reached.  Timer restarted if state still true (no state changes required)

initAct – list of actions to execute when scene started. 

Spoiler

Capture.PNG.c14e85b116f4f1161d34b1b524131c33.PNG

    By hovering mouse on actions cells, action’s details are shown

Spoiler

Capture1.PNG.54b50c4590e39e7fb50a74768b7782bc.PNG

In shown example for trueAct{} actions:

a) time span of irrigation system calculated on line according to ambient temperature. min(max(floor(@47>value)-25,0)+10,18)

b) TTS message announced (Garden Dripper has started)

c) Irrigation is turned ON.

The entire execution process is shown including all calculations, so user could see what exactly will happened.

VacMode – vacation mode.  In vacation mode by default timeSpan ignored and all Z-wave devices are converted to Activities, Scenes and VDs are not monitored.  Non default vacation state could be defined in each line (vacation=”normal” or “stop”).

 

Device index in jM{} hash table  – shows device location in jM{} hash table. By hovering mouse over cells, device description, manufacturer, zwave version and JM{} line shown.

Spoiler

Capture2.PNG.d43dab95a22904a763e8c46ca6e9012e.PNG

At the bottom of the table list of up to 60 last executed actions (in order of execution) is displayed. (like CNN news line). If the device has same state as required by command, command isn’t executed and colored pink.

Spoiler

Capture.thumb.PNG.8038b15e1d5eeec9ecd3ee5619177e70.PNG

 

Table color code:

1. Value, Criteria and Last seen columns

 green – state is true

 pink – state is false

 yellow – out of defined time slot, no actions or monitoring done.

  gray – line suspended. To suspend the line, set time-span to negative value.

 red -  in alert-state, means this line exceeds time-span and auto-alert sent.

 

2. Time Slot

black background and Suspended/Disabled label in gray means this line is inactive.

Gray background and Activity label in green means the device assigned to control only. (Time span  is zero).

   green background and red progress bar, device is monitored. On timeout auto-alert sent.

blue background and purple progress bar, device is monitored and on timeout actions executed. (No alerts)

Spoiler

Capture.PNG.76724ac546bab46c47977ec11ca96926.PNG

If global variable in use, following table will be displayed

Spoiler

Capture.PNG.ffdba5d5e7768646bfc03f5ff15c8aef.PNG

Type – two types are available, Local and Global variable. Local means ‘global’ variable in use within the script (if global4local defined, those values are saved). Global is actual global variable of the system.

Name – variable name

Value – current variable value

Modified – elapsed time since last change

In case dead or nAck communication occurred following table will be displayed

Spoiler

Capture.PNG.5d7264b3465dfadb84ff1f83454c99a5.PNG

    ID - device ID and his description is shown.

nAck – number of “transfer failed” events occurred.

Dead – number of “dead” reports received

Is dead – current device dead status (true or false)

Events history – last nACk and/or Dead events received and time-stamp of each event.

 

Table of top active devices in your system is shown and could be used to analyze and reduce your Z-traffic. Up to 30 devices could be displayed by  user configurable variable topZwave . Default is 15

Spoiler

Capture.PNG.e4b5077dadf6460838876992be57a660.PNG

ID - Since most of the devices has number of slaves, master device ID and his description is shown. By hovering on the line,  slave devices and his number of events will be displayed.

# – number of events occurred.

% – Percentage of total events.

 

In case reminders are active following table displayed:

Spoiler

Capture1.PNG.4ba9019e040d774d8c687a5422c7b5dd.PNG

Rate – time interval to execute reminder

RunTerms – triggers list to active reminder

Note – send message as notification

Reminder – reminder message

By hovering mouse over “Run Terms” header, condition details displayed.

Spoiler

Capture2.PNG.078371da7096156c4beb7c9d0bad80e3.PNG

Following actions are built-in :

addRmd, logRmd, setRmd, delRmd, delAllRmd  - reminders control  

disableScene, enableScene, startScene, killScene – scene control

forceArm, setArmed – alarm control

pressButton , setSlider, setProperty– virtual device control

reboot, shutdown – system actions

sendEmail, sendPush, sendiPush, sendPopup, sendNote, sendSms*, tts* – notification control

setColor, setValue, turnOn, turnOff – Z-wave devices control

setTimeSpan, setTimeSlot, setTimeDrift, timeSpanOn - time control

setState, setStateValue, setStateDelay, setStateFormula  -- parameters control

vacOn, vacOff, powerOutage–  special modes

*not supported by the script. User defined functions.

All valid actions or properties of any Zwave, Plugin or VD devices are fully supported also. 

By insert a new action in the tables, the action will be verified by the code and if it's valid will be in use.

 

Special features

If an error occurs during run time, it will be displayed on fixed type men. Scene will continue to run. By manual refreshing the table three times error is no longer displayed.

Spoiler

RunErr.PNG.56fad7c180ab15b9db01d70fd9601222.PNG

When power outage mode activated, fixed menu displayed

Spoiler

pwrOut.PNG.b697502f56840d02eddd09968c7cc832.PNG

When vacation mode activated, fixed menu displayed

Spoiler

vacOn.PNG.55a6c05528069c8cea471ffc1ee1bf27.PNG

As mentioned at the beginning, scene stuck without any reason and it’s true for this scene as well.

To make sure that user will be notify if the scene is failed, weather triggers at the header of the script have been defined (these triggers exists by default at all systems and always work). When trigger received and the scene is failed, notification including last debug/error message sent to user. If autoRestart set to true, scene restarted automatically. Usually it takes awhile to receive weather trigger, so to speed up failure detection, recommended to add additional trigger (like motion sensor or any other device which is active often at your home)

Please do not remove weather triggers… during normal operation all triggers are ignored.

--[[

%% autostart

%% properties

%% weather

Temperature

Humidity

Wind

WeatherCondition

--]]

Using this script, I’m able to control over 95% percent of my needs, including irrigation system, heating system, bathrooms fans, all motion and door sensors, air conditioners and more.  In my system then number of scenes reduced from 48 to 4 and virtual devices from 11 to 2. In addition my RAM consumption reduced from ~80% to 30%.

The script has many options and features, so any action could be executed in several ways therefore please feel free to ask about implementation.

The code is over 1,000 lines, but only ~15% of the code is actually running. Rest of the code is to display, initialize and to validate hash table data on startup. Code covers ~80 hash table syntax errors. Please read carefully displayed errors and follow instructions.

 

 


What's New in Version 9.6   See changelog

Released

New features requested by users.

  1. Added new operators for statement and conditions:

~=                  not equal to (converted and shown as <>)

>=                  greater than or equal to (= >  is acceptable also, converted and shown as >=)

<=                  less than or equal to (=<  is acceptable also, converted and shown as <=)

 

 

New features

  1. Major "face lifting" on console view
  2.  On startup, wake up only dead devices that included in jM lines. Please refer to Dead Devices section in Advanced User's Guide.

 

 

Bugs Fix

  1. time range in timeSlot (i.g. "d=1~5;")

 

 

Update procedure

 

Please create a copy of your current scene before an update.

 

1) New Users

please download All-in-One Scene v9.6.lua.txt file and copy to a scene.

 

2) Exist users

In order to keep your configuration, copy/paste new release into your scene from the line

 

--=============== Copy/Paste form here to the end for a new release ===================

 

to the end of the code

 

or copy and save your configuration before an update and paste back after.

  • Like 1


User Feedback

Recommended Comments



Hey,

 

First of all, thanks for this piece of art :) I just have to know how to work with the beast :D

I tried to managed myself a simple action and it didn't work as I thought it would be... 

 

So, the purpose is open and close a blind at 9h and 21h, with the check that it is not already open/closed, to descrease the z-wave traffic. I tried to do it this way:

{0, "`blackout_escada`", {state="value<>0", timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0"}}},
{0, "`blackout_escada`", {state="value<>99", timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100"}}},

 

However, it didn't work... for example, the blind opened at 9:00 but I was not able to close it manually... everytime i tried to closed it a little bit, the blind opens again to 100...

 

What am I doing wrong? Sorry if the answer is to basic. I just started to read the manual so if anybody can help me understanding what is wrong and what is actually these lines doing I'd apreciate it  :) 

 

Thanks in advance,

TMF

 

 

Link to comment
Share on other sites

11 hours ago, TMF said:

Hey,

 

First of all, thanks for this piece of art :) I just have to know how to work with the beast :D

I tried to managed myself a simple action and it didn't work as I thought it would be... 

 

So, the purpose is open and close a blind at 9h and 21h, with the check that it is not already open/closed, to descrease the z-wave traffic. I tried to do it this way:

{0, "`blackout_escada`", {state="value<>0", timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0"}}},
{0, "`blackout_escada`", {state="value<>99", timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100"}}},

 

However, it didn't work... for example, the blind opened at 9:00 but I was not able to close it manually... everytime i tried to closed it a little bit, the blind opens again to 100...

 

What am I doing wrong? Sorry if the answer is to basic. I just started to read the manual so if anybody can help me understanding what is wrong and what is actually these lines doing I'd apreciate it  :) 

 

Thanks in advance,

TMF

 

 

You almost did it well. The problem that you have defined confusing states? Means if state <> 99 and state<>0. I believe you see endless commands sent to device, because at any state the trueAct executed.

When value becomes <>0 setValue,0 executed, but the zero value becomes true for the second line (value<>99) and setValue,100 executed. Now again the first line is true (value<>0) and again setValue,0 executed. 

More confusing that the the second line is always becomes true because you set value of 100 and the the state<>99 is true??

Endless loop.... and that's the reason the you cannot set manually the blind to any position. 

 

As I understand you want to open/close the blind at specific time, if so please set as below (w/o states):

{0, "`blackout_escada`", {timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0"}}},
{0, "`blackout_escada`", {timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100"}}},

 

If you don't want to send value if the blind is already in this position add value as a condition:

{0, "`blackout_escada`", {timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0", "{`blackout_escada`:value>0}" }}},
{0, "`blackout_escada`", {timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100","{`blackout_escada`:value<99}" }}},

 

By the way you can use sunrise and sunset hours for that and to add extra time in seconds (in this example adding 3 hours =10800 seconds) in the timeSlot:

{0, "`blackout_escada`", {timeSlot="?$sunsetHour+10800?~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0"}}},
{0, "`blackout_escada`", {timeSlot="?$sunriseHour+10800?~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100"}}},

 

You can see sunset/rise hours at your location in the first line at right in the debug window of the scene

 

Let me know if it works...

Edited by cag014
Link to comment
Share on other sites

8 hours ago, cag014 said:

You almost did it well. The problem that you have defined confusing states? Means if state <> 99 and state<>0. I believe you see endless commands sent to device, because at any state the trueAct executed.

When value becomes <>0 setValue,0 executed, but the zero value becomes true for the second line (value<>99) and setValue,100 executed. Now again the first line is true (value<>0) and again setValue,0 executed. 

More confusing that the the second line is always becomes true because you set value of 100 and the the state<>99 is true??

Endless loop.... and that's the reason the you cannot set manually the blind to any position. 

 

As I understand you want to open/close the blind at specific time, if so please set as below (w/o states):

{0, "`blackout_escada`", {timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0"}}},
{0, "`blackout_escada`", {timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100"}}},

 

If you don't want to send value if the blind is already in this position add value as a condition:

{0, "`blackout_escada`", {timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0", "{`blackout_escada`:value>0}" }}},
{0, "`blackout_escada`", {timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100","{`blackout_escada`:value<99}" }}},

 

By the way you can use sunrise and sunset hours for that and to add extra time in seconds (in this example adding 3 hours =10800 seconds) in the timeSlot:

{0, "`blackout_escada`", {timeSlot="?$sunsetHour+10800?~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0"}}},
{0, "`blackout_escada`", {timeSlot="?$sunriseHour+10800?~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100"}}},

 

You can see sunset/rise hours at your location in the first line at right in the debug window of the scene

 

Let me know if it works...

Hey 

 

Thanks for the answer :)

 

For your explanation, I think I got the idea. The states are a kind of triggers, right? I thought that part of the command was a condition to run, not a trigger... If so, I think I got the idea...

 

Can you please try to explain me the first part? The time span? If you have some examples for me to try to understand...

 

Once again, thank you :)

Link to comment
Share on other sites

10 minutes ago, TMF said:

And something seems to be not aligned in this monitor table...

image.png.946e3bd7d48f189402cfe6affe653a19.png

 

Is it normal?

 

The item description is, in fact, the actual value... something seems wrong :/ 

image.png.687a23ac28d094ad3121fdef2e0a1d8b.png

Link to comment
Share on other sites

17 minutes ago, cag014 said:

Could you please post your  jM lines

jM={
{0, "$RAM",{state="value>85",trueAct={{"RAM>85%","sendNote","Warning. \nSystem memory is $RAM% ",true},{"|$lineId|","setStateValue","80"}},falseAct={{"|$lineId|","setStateValue","85"},{"RAM<80%","sendNote","System memory is $RAM%"}}}},
{0, "$HC2onLine",{state="value=true",trueAct={"","tts","$dayTime, Home center is on line"},falseAct={"","tts","$dayTime, Home center is off line"}}}, 
{0, "$internet",{state="value=online",trigAct={"","tts","$dayTime, Internet is $internet"}}}, 

    -- Abertura Blackout Escadas
{0, "`blackout_escada`", {timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0", "{`blackout_escada`:value>0}" }}},
{0, "`blackout_escada`", {timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100","{`blackout_escada`:value<99}" }}},


}  

Link to comment
Share on other sites

Oops.. have tested that with the new version.

On current version when using same device as a main device and as a device in conditions  causes an error in data display.

New version will be released soon....

Please use as follow

 

{0, "$blank", {timeSlot="21:00~",initOnStartup=false, trueAct={"`blackout_escada`", "setValue,0", "{`blackout_escada`:value>0}" }}},
{0, "$blank", {timeSlot="9:00~" ,initOnStartup=false, trueAct={"`blackout_escada`", "setValue,100","{`blackout_escada`:value<99}" }}},

 

The $blank keyword is dummy keyword

Edited by cag014
Link to comment
Share on other sites

Now regarding timeSpan 

This is an option to check time period when the state is true and to receive auto notification (by default) or to define actions.

for example, if the main door is open over 5 minutes the AOS will send auto notification as define in user parameters (email, push, popup...)

{5,"`mainDoor`",{state="true"}},

Now we have two options to define an action for example to activate siren for 15 seconds. 

1

timeoutAct{}:  On time action - means the siren will activated one time.  timeSpan not restarted till the door back to false (closed).

{5,"`mainDoor`",{state="true", timeoutAct={{"`siren`","turnOn"},{"`siren`","trunOff","15"}}}},

2

timeLoopAct{}:  while the main door remains true, these actions will be executed every 5 minutes in loop, till main door will be closed. Actually the timeSpan counting restarts after action execution.

{5,"`mainDoor`",{state="true", timeLoopAct={{"`siren`","turnOn"},{"`siren`","trunOff","15"}}}},

 

Here is actual use (in my case). I have wall switches connected to Dryer and washing machines which I monitoring based on their power consumption. Sometimes the switches are turned OFF ( never have found why?). So to insure that the switches are constantly ON  I use timeSpan of 5 minutes in loop.

{5,"`dryer`",{state="false",timeLoopAct={"`dryer`","turnOn"}}},

In line above the state becomes true when the wall switches is false. and if it's false over 5 minutes, it turns ON again.

Very useful feature to avoid your wife's curses about the smart home. ?

Edited by cag014
  • Like 1
Link to comment
Share on other sites

Hey @cag014

 

Started to develop some light management but I have some doubts... :)

 

The idea is very simple to understand. I've a room with a motion sensor and I want that both light circuits turn off after 1 minute without motion. I came to this configuration that seems to work:

{1, "`motion_wc_0`",{ state="true", falseAct={{"`luz_wc_0`","turnOff","{`luz_wc_0`:value>0}"},{"`espelho_wc_0`","turnOff","{`espelho_wc_0`:value>0}"}}}}

 

So, now I need to understand to things:

1 - the configuration is correct for what I need?

2 - Besides motion, I want to guarantee that if someone turns lights on, even if not entering the room itself, the light turns off after 1minute...

 

My configuration only works if the state of motion sensor becomes true... if I don't enter the room, the lights will be on forever... can you please help me someway?

 

Thanks in advance,

TMF

Link to comment
Share on other sites

First of all,  if you receive notification, it means the motion sensor is in true state over a minute. To avoid time out notification you should use timeLoopAct{} or timeoutAct().

Again, you almost did it, but as you said one minute if no motion, so the correct line as you defined should be

{1, "`motion_wc_0`",{ state="false", timeoutAct={{"`luz_wc_0`","turnOff","{`luz_wc_0`:value>0}"},{"`espelho_wc_0`","turnOff","{`espelho_wc_0`:value>0}"}}}}

 

I don't know how and when you turn on the light, but here another way to turn ON/OFF the lights in one line:

The idea is to use command delay to turn off the lights when motion sensor back to false ( I believe while sensor is true you need the lights ON, even if it is over 1 minute)

{0, "`motion_wc_0`",{ state="true", trueAct={"`luz_wc_0`|`espelho_wc_0`","turnOn"}, falseAct={"`luz_wc_0`|`espelho_wc_0`","turnOff","60"}}},

 

now regarding lights turned on manually, I think it should be as below:

{0,"`luz_wc_0`|`espelho_wc_0`",{ state="value>0",trueAct={"$Id","turnOff","60","{`motion_wc_0`:value=false}"}}},

It means when one of the lights turned ON after a minute turnOff the light if motion is false .  (If motion is true the previous line will turn the lights off)

 

Note: since I have used both lights in the same line and it breakdowns into two action lines, the $Id keyword will insert the correct device id in each line.

It is actually the same as to write two jM lines:

{0,"`luz_wc_0`",{state="value>0",trueAct={"`luz_wc_0`","turnOff","60","{`motion_wc_0`:value=false}"}}},

{0,"`espelho_wc_0`",{state="value>0",trueAct={"`espelho_wc_0`","turnOff","60","{`motion_wc_0`:value=false}"}}},

 

Either way it is OK, I prefer to have less lines in jM to maintain.

 

Let me know if it works...

Edited by cag014
  • Like 1
Link to comment
Share on other sites

13 hours ago, cag014 said:

First of all,  if you receive notification, it means the motion sensor is in true state over a minute. To avoid time out notification you should use timeLoopAct{} or timeoutAct().

Again, you almost did it, but as you said one minute if no motion, so the correct line as you defined should be

{1, "`motion_wc_0`",{ state="false", timeoutAct={{"`luz_wc_0`","turnOff","{`luz_wc_0`:value>0}"},{"`espelho_wc_0`","turnOff","{`espelho_wc_0`:value>0}"}}}}

 

I don't know how and when you turn on the light, but here another way to turn ON/OFF the lights in one line:

The idea is to use command delay to turn off the lights when motion sensor back to false ( I believe while sensor is true you need the lights ON, even if it is over 1 minute)

{0, "`motion_wc_0`",{ state="true", trueAct={"`luz_wc_0`|`espelho_wc_0`","turnOn"}, falseAct={"`luz_wc_0`|`espelho_wc_0`","turnOff","60"}}},

 

now regarding lights turned on manually, I think it should be as below:

{0,"`luz_wc_0`|`espelho_wc_0`",{ state="value>0",trueAct={"$Id","turnOff","60","{`motion_wc_0`:value=false}"}}},

It means when one of the lights turned ON after a minute turnOff the light if motion is false .  (If motion is true the previous line will turn the lights off)

 

Note: since I have used both lights in the same line and it breakdowns into two action lines, the $Id keyword will insert the correct device id in each line.

It is actually the same as to write two jM lines:

{0,"`luz_wc_0`",{state="value>0",trueAct={"`luz_wc_0`","turnOff","60","{`motion_wc_0`:value=false}"}}},

{0,"`espelho_wc_0`",{state="value>0",trueAct={"`espelho_wc_0`","turnOff","60","{`motion_wc_0`:value=false}"}}},

 

Either way it is OK, I prefer to have less lines in jM to maintain.

 

Let me know if it works...

Hey

 

Thanks for the help.

 

Actually, your insight makes me understand the behavior of the config. However, I need something hybrid. So, the idea isn't turning on the lights with the motion. Just manage the forgotten "offs". So I used your suggestion with some changes:

 

Here I turned off the lights if someone goes way w/o switched off the lights in 5 minutos.

{5,"`motion_wc_0`",{ state="false", timeoutAct={{"`luz_wc_0`","turnOff","{`luz_wc_0`:value>0}"},{"`espelho_wc_0`","turnOff","{`espelho_wc_0`:value>0}"}}}}, 

 

Here I picked your suggestion but increased the time to 10m. The idea is guarantee that the lights only go off if someone turned on the lights without entering the room.

{0,"`luz_wc_0`|`espelho_wc_0`",{ state="value>0",trueAct={"$id","turnOff","600","{`motion_wc_0`:value=false}"}}},

 

Please give a check to see if my config is ok :)

 

However, now I've two problems:

 

1 - create and use a group of devices. The idea is group all the lights in one "word" to turn off when one motion is true and another is false. Something like:

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"groupLights","turnOff","{`groupLights`:value>0}"}}}, -> this row is pseudocode :D

 

2 - Real case: I've an external door in my kitchen with a door sensor. I want kitchen's light turn on when I open the door (and the lux inside is above 50lux) but only if I'm entering... that is, when I go away from the kitchen i don't want that kitchen's light turns on. My idea is something like having a global that becomes true for 1/2 minutes when I breach kitchen_motion. After that, when I open the door, it will check if that variable is false, since if it's true it means that someone was inside and that someone is going away, so doesn't need to turn on the lights... Can you please give your advice on this case? If so, can you give some code advice?

 

Many thanks for the help :)

 

TMF

Link to comment
Share on other sites

1 - create and use a group of devices.

Yes, you can do it in jS2n table, but you'll need two definitions, one for commands and one for conditions.

 

for commands like - turnOn/Off

cmdLights="`luz_wc_0`|`espelho_wc_0`|..."}

for conditions

ifLights="`luz_wc_0`,`espelho_wc_0`,..."}

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"`cmdLights`","turnOff","{`ifLights`:value>0}"}}}, -> this row is pseudocode :D

 

Note: please add groups at the end of the jS2n table after devices have been defined.

 

2- You can use lastBreached property instead of global value. I don't sure about your statement of above 50lux, are you sure not below?

Another question, how you turn ON/Off the light in kitchen? I believe by motion sensor, so the scenario probably should be like that:

While entering the kitchen and motion sensor is false turn On the lights...?

In any case here an example using last breached.

{0,"`doorSensor`",{state="true",trueAct={"`kitchenLight`","turnOn","{`luxDevice`:value<50 and `kitchenSensor`:lastbreached>30}"}}},

here an example when the kitchen sensor is false

{0,"`doorSensor`",{state="true",trueAct={"`kitchenLight`","turnOn","{`luxDevice`:value<50 and `kitchenSensor`:value>false}"}}},

and yes, you can do it by using global variable also...

Edited by cag014
Link to comment
Share on other sites

27 minutes ago, cag014 said:

1 - create and use a group of devices.

Yes, you can do it in jS2n table, but you'll need two definitions, one for commands and one for conditions.

 

for commands like - turnOn/Off

cmdLights="`luz_wc_0`|`espelho_wc_0`|..."}

for conditions

ifLights="`luz_wc_0`,`espelho_wc_0`,..."}

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"`cmdLights`","turnOff","{`ifLights`:value>0}"}}}, -> this row is pseudocode :D

 

Note: please add groups at the end of the jS2n table after devices have been defined.

2- You can use lastBreached property instead of global value. I don't sure about your statement of above 50lux, are you sure not below?

In any case here an example.

{0,"`doorSensor`",{state="true",trueAct={"`kitchenLight`","turnOn","{`luxDevice`:value<50 and `kitchenSensor`:lastbreached>30}"}}},

Hope you understand the idea of lastBreached concept....

 

Just tested the 1. and it doesn't work...

iluminacao_alarme_stay="`luz_cozinha`|`luz_moveis_cozinha`|`luz_lavandaria`|`luz_wc_0`|`espelho_wc_0`|`luz_acesso_cozinha`|`luz_bar_sala`|`luz_tv_sala`|`luz_janelas_sala`|`luz_sanca_sala`|`luz_hall`|`luz_pedra_hall`|`luz_vao_escada`|`luz_escritorio`|`luz_sanca_escritorio`|`luz_wc_escritorio`|`espelho_wc_escritorio`|`luz_varanda_suite`|`luz_varanda_quartos`|`luz_varanda_hall`|`luz_varanda_sala`|`luz_varanda_cozinha`|`luz_muro_jardim`|`luz_muro_entrada`|`luz_muro_sul`|`luz_alpendre`",
iluminacao_alarme_stay_check="`luz_cozinha`,`luz_moveis_cozinha`,`luz_lavandaria`,`luz_wc_0`,`espelho_wc_0`,`luz_acesso_cozinha`,`luz_bar_sala`,`luz_tv_sala`,`luz_janelas_sala`,`luz_sanca_sala`,`luz_hall`,`luz_pedra_hall`,`luz_vao_escada`,`luz_escritorio`,`luz_sanca_escritorio`,`luz_wc_escritorio`,`espelho_wc_escritorio`,`luz_varanda_suite`,`luz_varanda_quartos`,`luz_varanda_hall`,`luz_varanda_sala`,`luz_varanda_cozinha`,`luz_muro_jardim`,`luz_muro_entrada`,`luz_muro_sul`,`luz_alpendre`"

 

{0,"`sensor_alarme_stay`",{ state="true",trueAct={"`iluminacao_alarme_stay`","turnOff","{`iluminacao_alarme_stay_check`:value>0}"}}},

 

When I put the sensor_alarme_stay with true state none of the lights go off... I don't know if you got the idea but, I've several lighs that could be on. The idea is check if the lights are on one by one, to guarantee that I don't send commands without need it...

 

That is, the check (iluminacao_alarme_stay_check) needs to be an OR and not an AND... Light_1>0 OR light_2 > 0 ... 

Edited by TMF
Link to comment
Share on other sites

OK, but in this case you need to check light by light and not to use groups of lights, I mean what you did, is if one of the lights is ON (using OR statement) turn off command will be send to every light.

THe solution is to have one line per light- (same as if you will do it in Lua scene)

{0,"`motion_1= true`|`motion_2=false`",{trueAct={

{"`luz_moveis_cozinha`","turnOff","{`luz_moveis_cozinha`:value>0}"},

{"`luz_lavandaria`","turnOff","{`luz_lavandaria`:value>0}"},

{"`luz_bar_sala`","turnOff","{`luz_bar_sala`:value>0}"},

.....

....

}}}}, -> this row is pseudocode :D

 

By the way if you don't switch ON/OFF all lights often I suggest to send to all of them turnOn/Off command instead of wasting the time to check every light, like that:

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"`cmdLights`","turnOff"}}},

 

Another suggestion is to choose the "main" light from this list and set associations to all others. Means when you turn ON/OFF the "main" light all others will follow...

now you can set

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"`mainLight`","turnOff","{`mainLight`:value>0}"}}},

  • Like 1
Link to comment
Share on other sites

14 hours ago, cag014 said:

OK, but in this case you need to check light by light and not to use groups of lights, I mean what you did, is if one of the lights is ON (using OR statement) turn off command will be send to every light.

THe solution is to have one line per light- (same as if you will do it in Lua scene)

{0,"`motion_1= true`|`motion_2=false`",{trueAct={

{"`luz_moveis_cozinha`","turnOff","{`luz_moveis_cozinha`:value>0}"},

{"`luz_lavandaria`","turnOff","{`luz_lavandaria`:value>0}"},

{"`luz_bar_sala`","turnOff","{`luz_bar_sala`:value>0}"},

.....

....

}}}}, -> this row is pseudocode :D

 

By the way if you don't switch ON/OFF all lights often I suggest to send to all of them turnOn/Off command instead of wasting the time to check every light, like that:

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"`cmdLights`","turnOff"}}},

 

Another suggestion is to choose the "main" light from this list and set associations to all others. Means when you turn ON/OFF the "main" light all others will follow...

now you can set

{0,"`motion_1= true`|`motion_2=false`",{trueAct={"`mainLight`","turnOff","{`mainLight`:value>0}"}}},

Hey

 

Thanks for the reply.

 

I got the idea! However, if I have many lights to turn off it's better or worse to have the check?

 

Regarding the config I put here in pseudocode, there's a part that is very important and I cannot get it to work:

{0,"`alarm_armed= true`|`alarm_stay_armed=false`",{trueAct={"groupLights","turnOff","{`groupLights`:value>0}"}}},

 

I have the need to turn off the lights when one motion is true and another is false. Why? To know if my alarm is stay armed or all armed. I've two scenarios:

1-> Total alarm armed "`alarm_armed= true`|`alarm_stay_armed=false`"

2-> Stay alarm armed "`alarm_armed= true`|`alarm_stay_armed=true`" -> That scenario is already done since both status are true.

 

How can I deal with it in terms of state status?

 

Thanks again for your work. It's a piece of art :)

 

 

Edited by TMF
  • Thanks 1
Link to comment
Share on other sites

Hey again

 

I think I managed a way to get what I need.

 

I defined a variable:

global4local= {false,gVarName="",varArray={onState="init:off",alarmeStatus="false"}}   

 

and then I change its status to "true" when motion1=true and motion2=false:

{0,"`sensor_alarme`",{ state="true",trueAct={"&alarmeStatus","setGlobal","true","{`sensor_alarme_stay`:value=false}"},falseAct={"&alarmeStatus","setGlobal","false"}}},

 

After that, I used that variable to get what I need:
{0,"&alarmeStatus",{state="true",trueAct={"`luz_acesso_cozinha`","turnOff"}}}, (in this case I just turned off one light to test)

 

That being said, can you please take a look into this and give your insights? 

Regarding the use of global system's variables, how can I use it in this scene? can you give an example? I tried but with no success...

 

Edited by TMF
Link to comment
Share on other sites

Looks great..

Regrading system global variables, just use it same as local.

For example:

Define alarmeStatus  as system global and remove it from

global4local= {false,gVarName="",varArray={onState="init:off",alarmeStatus="false"}}   

No changes required in jM. AOS will find and determinate  the global type.

 

 

  • Like 1
Link to comment
Share on other sites

Hi @cag014

 

Hope find you well :)

 

I added a second HC2 as a slave to extend my network in a garage outside. However, I cannot find an easy way to check if that slave is actually online... The idea is to receive a push notification if the slave is offilne... Is there any way?

 

Apart from that, I've two smart modules to my sprinklers and I want to use the all-in-one scene instead of sprinklers panel... What I want is to "turn on" for 5 minutes at a specific time on Mondays and Thursdays. Can you help me with that definition please?

 

Thanks in advance,

TMF

Link to comment
Share on other sites

28 minutes ago, TMF said:

Hi @cag014

 

Hope find you well :)

 

I added a second HC2 as a slave to extend my network in a garage outside. However, I cannot find an easy way to check if that slave is actually online... The idea is to receive a push notification if the slave is offilne... Is there any way?

 

You can run AOS on the slave to check the status (same as on the master)

29 minutes ago, TMF said:

Apart from that, I've two smart modules to my sprinklers and I want to use the all-in-one scene instead of sprinklers panel... What I want is to "turn on" for 5 minutes at a specific time on Mondays and Thursdays. Can you help me with that definition please?

 

Here and example to start sprinkler every Monday and Thursday at 18:15 o'clock for 5 minutes. Please change the days and time as you need. 

{5, "`sprinkler`",{timeSlot="w=2;5;18:15~",trueAct={"`sprinkler`","turnOn"}, timeoutAct={"`sprinkler`","turnOff"} } }, 

 

  • Like 1
Link to comment
Share on other sites

On 11/8/2021 at 3:58 PM, cag014 said:

You can run AOS on the slave to check the status (same as on the master)

 

 

First of all, thanks a lot for your help.

 

The ideia of checking the status is if I got slave offline/down I got the notification by master itself. If I've the slave down, it cannot notify... 

Link to comment
Share on other sites

1 hour ago, TMF said:

First of all, thanks a lot for your help.

 

The ideia of checking the status is if I got slave offline/down I got the notification by master itself. If I've the slave down, it cannot notify... 

Just run another AOS on your slave... tested and it works

Link to comment
Share on other sites

Is the goal of this scene to replace manually crafted scenes using the Fibaro app while at the same time making the scene number limitation in the Lite Hub not an issue?

Link to comment
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
Add a comment...

×   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...