X10 Community Forum

📱🖥️PiX10Hub ( Always Evolving Open Source) => 💬General Discussion => 📝User created HG Scripts (programs) => Topic started by: alzy on December 29, 2018, 01:51:32 PM

Title: Fun with Flags
Post by: alzy on December 29, 2018, 01:51:32 PM
Is there a way to set a "flag" like in AHP and have the flag state be a condition  for a macro execution? B:(
Title: Re: Fun with Flags
Post by: petera on December 29, 2018, 07:11:24 PM
Is there a way to set a "flag" like in AHP and have the flag state be a condition  for a macro execution? B:(

Not being an AHP user are you trying to achieve an "If this then that" scenario. Maybe you could outline exactly what you are trying to do so you could be pointed in the right direction.. Virtual Devices and Events play a large part in the operation of logic in HG.
Title: Re: Fun with Flags
Post by: alzy on December 29, 2018, 07:33:43 PM
In AHP you can make a flag being set a condition for a macro to run. For instance AI being triggered may activate a device and also set a flag, say flag 1. Then there could be a macro which say is triggered by D1  but executes only if flag one has been set. A flag can be set by one x10 command and reset by another x10 command of a different address.
Title: Re: Fun with Flags
Post by: petera on December 29, 2018, 08:12:31 PM
In AHP you can make a flag being set a condition for a macro to run. For instance AI being triggered may activate a device and also set a flag, say flag 1. Then there could be a macro which say is triggered by D1  but executes only if flag one has been set. A flag can be set by one x10 command and reset by another x10 command of a different address.

Yes that's all achieved with scripts. They are very powerful but very simple to construct. Just open one of the programs, say the Advanced Smart Lights and have a look at the how it is laid out. Most of the logic you will require is already there.
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 09:19:51 AM
Looked at that and its all gobbledygook to me. Can u direct me to some detailed help page somewhere? Its so much easier in AHP!

Thanks.
Title: Re: Fun with Flags
Post by: petera on December 30, 2018, 12:18:57 PM
Looked at that and its all gobbledygook to me. Can u direct me to some detailed help page somewhere? Its so much easier in AHP!

Thanks.

If that looked like gobbledygook maybe just stick to the macros and wizard scripts. I've posted a few videos earlier but the macro recorder is quite versatile https://m.youtube.com/watch?v=zwqJ3YeqOTc
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 12:29:27 PM
Can't need flags. B:(
Title: Re: Fun with Flags
Post by: Tuicemen on December 30, 2018, 01:07:27 PM
Can't need flags. B:(
Actually you only think you need flags. AHP was limited to the number of conditions in a smart macro, flags were created to workaround that limitation. I'm not sure if HG has a limit of conditions for a macro as I've yet to hit that wall.
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 01:10:52 PM
Well i don't know how to code a flag in HG.  And documentation seems sparse on the topic.B:(
Title: Re: Fun with Flags
Post by: Tuicemen on December 30, 2018, 01:20:50 PM
You don't need to code a flag.
you simply add the condition that set the flag in AHP so if  you had A3 On set a flag and A3 Off cleared it then in the condition of the macro you add device A3 = on
If you had the condition B3 had to be on and B4 had to be off add them both
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 01:25:00 PM
But that's not the same thing. A flag stays set until reset. A3 can be reset by an off command. So if it is turned off before the macro runs that requires to know it was triggered on at some point it no workie. B:(
Title: Re: Fun with Flags
Post by: Tuicemen on December 30, 2018, 01:53:32 PM
Ok try this.
Think of flags as a house code that your not using In AHP when you set a flag turn on that module, when you clear a flag turn off that module. Then in a macro that would normally watch a flag you watch that module since these modules are not realy used you put them in a separate group (called Flags) so if you manually wish to clear them you can. This was how flags originally came about.
there may be other ways to do this In HG as I'm just new to it.
However it may also make for a good option so I'll move this thread to the wish list.
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 01:57:57 PM
Yes, I could reserve house code F for Flags! LOL. That sounds like it would work and a lot better than writing a script. :)% and yes put it on the wish list.
Title: Re: Fun with Flags
Post by: racerfern on December 30, 2018, 04:20:13 PM
I installed HG on my main PC to fool around and get a feel for what to expect. I see where there are virtual devices that can easily be set as on/off to be used as "flags".

However, when I switched the virtual device from off to on or vice versa, HG does not immediately display the change. Instead I get a spinning arrow. I have to click Home > Dashboard and wait an inordinate amount of time. This can't be normal. Comments or thoughts appreciated.
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 04:45:39 PM
I see there is a program for virtual modules but i have no idea how to run it and create a module!
Title: Re: Fun with Flags
Post by: racerfern on December 30, 2018, 05:02:11 PM
@alzy - Can you post a screenshot of your main screen please?
Here's mine without any real things, just the way it was created when I installed it. Difference being that I renamed and reconfigured the second switch from the left to be an on/off virtual module. Click the "settings" icon in the upper right corner if you have a similar screen, but either way, upload your screenshot.
Screenshot reduced to 50%
Title: Re: Fun with Flags
Post by: Tuicemen on December 30, 2018, 05:27:59 PM
Alzy take some time and view the videos petera posted in the HG help section. The one on macro creation shows how to utilize virtual modules.
Title: Re: Fun with Flags
Post by: alzy on December 30, 2018, 05:49:47 PM
Tuicemen,

Thanks for the help! I tried that days ago but the link doesn't work.So useless. I can change an already created virtual module to some other function but how do I create a new one? I find this HG to not be at all intuitive and sparsely documented. I appreciate all the developers have done to create this great piece of software but I personally find it very hard to learn. B:(

Racerfern, my home screen is the same as yours except for a few x10 modules I have created. I appreciate the help. But a truly useful users manual would really help someone who has never used HG before ( like me) Sorry but I am extremely frustrated with Hg right now. i am not unappreciative just extremely frustrated!
Title: Re: Fun with Flags
Post by: Tuicemen on December 30, 2018, 06:07:30 PM
There is all kinds of documentation for HG and lots of helpful you tube videos. The video posted here for me so you may wish to use a different browser..
Title: Re: Fun with Flags
Post by: bkenobi on January 02, 2019, 12:10:56 PM
I installed HG on my main PC to fool around and get a feel for what to expect. I see where there are virtual devices that can easily be set as on/off to be used as "flags".

However, when I switched the virtual device from off to on or vice versa, HG does not immediately display the change. Instead I get a spinning arrow. I have to click Home > Dashboard and wait an inordinate amount of time. This can't be normal. Comments or thoughts appreciated.

The interface is just a display for what HG is doing behind the scenes but is not necessarily "real time".  IOW, HG is doing what it's supposed to do VERY quickly but the display updates very slowly relative to the processing.  As a result, you will likely see a delay between you clicking "turn on a light" and the display showing an illuminated light bulb icon.  If the light is sitting right next to you and you click "ON", the light will turn on in less than a second (the same time as it would take with AHP or a remote based on the speed of the X10 standard).

The one thing I did notice with HG compared to AHP is that if you turn on a series of modules, AHP can turn them on quicker.  AHP seems to be able to send the sequence:

A1
A2
A3
A ON

Whereas HG will send

A1
A ON
A2
A ON
A3
A ON

Each command takes around 0.4 seconds so the first one will result in all lights being turned on within 1.6 seconds (4 x 0.4) versus the last light turning on with HG in 2.4 seconds (6 x 0.4).  Either way, the web interface will probably not have updated until after the light is on.
Title: Re: Fun with Flags
Post by: bkenobi on January 02, 2019, 12:20:03 PM
Oh, and as for flags...they are really a dumb concept  :'

Flags were a way to make AHP do things that the programmers didn't allow because they "forgot" to include a mechanism to actually perform logic correctly.  I ditched AHP a LONG time ago because it was terrible for performing logic.  I initially used AHP API and an AutoIt script to implement my Advanced Smart Lights script (called something different at the time).  It was really easy to do in the script but impossible to do in AHP directly.

If you stop looking at the lack of flags as a drawback and consider what you want to do overall, you will realize that you don't need them.  That said, you can do something similar by creating a parameter that can be accessed by everything.  I don't recommend that unless you know you need it as it might clutter things up.
Title: Re: Fun with Flags
Post by: alzy on January 02, 2019, 04:19:13 PM
I have found flags very useful in my AHP setup!
Title: Re: Fun with Flags
Post by: alzy on January 02, 2019, 04:25:59 PM
And having an equivalent here makes it simpler for me to port my 52 macros to HG.
Title: Re: Fun with Flags
Post by: bkenobi on January 03, 2019, 09:01:31 AM
You only have 52 macros because AHP is terrible for logical programming.
Title: Re: Fun with Flags
Post by: alzy on January 03, 2019, 09:49:48 AM
I understand but that's not the point. I knowwwww u are an "expert" but i just need a simple way to port data so get off ur high horse!
Title: Re: Fun with Flags
Post by: alzy on January 03, 2019, 09:53:08 AM
Please...
Title: Re: Fun with Flags
Post by: petera on January 03, 2019, 10:32:16 AM
I understand but that's not the point. I knowwwww u are an "expert" but i just need a simple way to port data so get off ur high horse!

Bkenobi never purported to being an expert in HG. What he has done though is spent the time and effort learning about the strength of HG and is indicating that it's structure negates the need for your old school macros and timers with one well written and logically structured script/program.

Unless you have alternative avenues for seeking knowledge about HG I really advise against alienating any other experienced HG users. Just a little politeness goes a long way.
Title: Re: Fun with Flags
Post by: bkenobi on January 03, 2019, 11:08:56 AM
I understand the frustration of learning some new system that is different than what you are familiar with.  In fact, when I selected HG, I was picking it because it was the best option of what was available that fit all of my needs.  It is not the best programming environment IMO, but at the time it was far superior to everything else that was available that met my needs.  I am certainly not an expert, but based on those in this forum I suppose I'm probably close to that (though Gene is here, so I think I dropped quite a bit recently  :').

I have a minor in computer science, but only program periodically as a "hobby".  It's really just to get things working that I find no other solution for.  The code I posted at GitHub is not all mine but I made sufficient modifications to it to make it worth archiving for others.  In fact, my "Advanced Smart Lights" code is based on Gene's "Smart Lights" which he then updated to what is currently available (possibly spurred by my code, who knows).

The point is, I couldn't find something I wanted and so I learned just enough to get it working the way I wanted.  All I was suggesting is that AHP is really a terrible language that takes tons of macros interwoven together to make even simple things work.  If pseudo-code can be written to do a task then it can be implemented in other languages.  You will have a very difficult time converting AHP macros to any other HA system because of how convoluted it is IMO.  You could certainly prove me wrong and I'm fine with that, but I personally would recommend considering what you actually want to do rather than directly porting it to HG or any other system.   >!
Title: Re: Fun with Flags
Post by: alzy on January 03, 2019, 11:22:29 AM
bkenobi, Thanks for your insights. I  am just trying to reduce the pain of changing HA programs. I appreciate your advice and will consider same. Thanks! :)%
Title: Re: Fun with Flags
Post by: Tuicemen on February 04, 2019, 10:03:43 AM
Just for fun I decided to play with creating a Fun with Flags program. For those that just must have something like this, it is possible to create this with out using an X10 address or any other protocols address HG may be configured with.
Also unlike AHP this isn't limited to 16 flags, you can have as many on/off flags as you wish Unless HG has a limit on devices.
I'm still playing with the code but I do have something working. ;)
Title: Re: Fun with Flags
Post by: alzy on February 04, 2019, 10:08:25 AM
Glad to see someone else having Fun with Flags! Keep us posted! Thanks! >!
Title: Re: Fun with Flags
Post by: Tuicemen on February 04, 2019, 10:13:10 AM
 rofl
I personally do see a need for these with (yet) HG, but who knows at some point maybe. ::) :'
Besides the flags being numbered you can also name them so guessing what they are for shouldn't be a problem.
 >!
Title: Re: Fun with Flags
Post by: Tuicemen on February 04, 2019, 11:50:37 AM
After some thought on this I decided to add a poll for this, mostly out of curiosity.
Flags were added to AHP due to the number of conditions limit it had for macros which users were getting around by using x10 modules that they weren't using. However users soon found other uses for flags and as their setups grew they required the X10 addresses they set aside for flag use.

So then I though about it again and I can see a use for these. It can be used purely as a ease of multi macro setups. If I want several macros to have say a time of day trigger plus may be something else I can have those conditions trigger a flag then any thing else I wished to have watching those conditions I only need add the flag as the condition. This is a time saver when writing macros if nothing else.

I remember users requesting flags for PCC even though it also didn't have a macro condition limit. I don't remember the reason for the request or even if a reason was given but I did add the option.
Given that AHP users feel the need for flags I'll share my creation. Just rename the attached txt file to 1007-Fun_with_Flags.hgx removing the extension ".txt" ;)
I have this in my "Device and Things" program group
I would like to read what users do, or wish to do with these. ::) :'
It may give others ideas for their setups. ;)
Currently the number of flags available is set to 16 but you can increase or decrease that number as you see fit.

 >!
Title: Re: Fun with Flags
Post by: alzy on February 04, 2019, 04:42:24 PM
Do I import this as a widget? :-\
Title: Re: Fun with Flags
Post by: Tuicemen on February 04, 2019, 05:22:58 PM
It is a program import it to Device and Things
Title: Re: Fun with Flags
Post by: bkenobi on February 04, 2019, 06:34:34 PM
I just don't understand the point of this.  Why not just use a parameter value?  The only reason I can see for using virtual modules is that it will automatically fire an event that can be used directly.  But, there are other ways that aren't hacks.  Meh, whatever.   >*<
Title: Re: Fun with Flags
Post by: Tuicemen on February 04, 2019, 06:54:46 PM
I just don't understand the point of this.  Why not just use a parameter value?  The only reason I can see for using virtual modules is that it will automatically fire an event that can be used directly.  But, there are other ways that aren't hacks.  Meh, whatever.   >*<
Sometimes you have use what users are familiar with to get them motivated! ::) :'
I suspect some will graduate past this but others won't.
If nothing else it will show users a bit more of how it is possible to customize HG .
Title: Re: Fun with Flags
Post by: Dave Mc on February 06, 2019, 05:29:07 AM
This is how I used a flag in AHP:  My porch light was set to turn on at dusk and then off at 10:00 pm.  Between 10:00 pm and dawn a MS14A motion sensor would trigger a macro.  The conditions were if it is night and flag 1 is set then turn on the porch light for 10 minutes then turn it off.  The MS14A was above the garage door facing the driveway so it was set to always send RF to the CM15a so headlights would not make the MS14A think it was day time when it was night.

I am sure HG can handle this without flags I just haven't taken the time to figure it out yet.
Title: Re: Fun with Flags
Post by: bkenobi on February 06, 2019, 12:30:10 PM
Look at Advanced Smart Lights.  It does all of that and more.  It uses variables as needed rather than cluttering things up with virtual modules.
Title: Re: Fun with Flags
Post by: Tuicemen on February 06, 2019, 12:35:47 PM
Look at Advanced Smart Lights.  It does all of that and more.  It uses variables as needed rather than cluttering things up with virtual modules.
Maybe you could point Dave Mc to some documentation on your Advanced Smart Lights or explain how to set it up for him.
Title: Re: Fun with Flags
Post by: bkenobi on February 06, 2019, 03:24:37 PM
https://github.com/bkenobi/HomeGenie_Apps

Install in HG
Under module you want to control, turn on ASL
Configure for appropriate modules as needed
Title: Re: Fun with Flags
Post by: Dave Mc on February 06, 2019, 04:46:12 PM
https://github.com/bkenobi/HomeGenie_Apps

Install in HG
Under module you want to control, turn on ASL
Configure for appropriate modules as needed

Thank you for the information.  Unfortunately I have never done coding and the 397 lines of code are way over my head.  I don't have time to look into this now, maybe sometime in the future.
Title: Re: Fun with Flags
Post by: Tuicemen on February 06, 2019, 06:30:12 PM
https://github.com/bkenobi/HomeGenie_Apps

Install in HG
Under module you want to control, turn on ASL
Configure for appropriate modules as needed
I thought this was already included in the HG distro but this looks like it is an updated version of Smart Lights meshing in a couple other repos. Nice work!

Title: Re: Fun with Flags
Post by: racerfern on February 06, 2019, 06:45:46 PM
Quote
Unfortunately I have never done coding and the 397 lines of code are way over my head.  I don't have time to look into this now, maybe sometime in the future.

This is a huge problem that some of the developers and code writers of HG/PiX10 need to deal with. You wouldn't say, "If you can't code you shouldn't use HG." It's a ridiculous statement that will turn future users off to the product. In fact, the average HA user can't bear the thought of stumbling through github.

Most of us are not coders, we don't want to be, we don't have the time, we are better racecar drivers than coders, any number of reasons. That's what macros, events, routines, etc are for. That's why there are automatic transmissions, because some people just can't deal with or don't want to deal with shifting gears, clutches, etc. Imagine how that would be with today's ten speed automatics. They don't make ten speed manuals that require another leg to operate. The technology for transmissions went where the users wanted it to go, not the manufacturers. The manufacturers simply developed what they sold more of and what their competitors sold more of.

The "users" of HA don't want to spend an inordinate amount of time just to get light A1 to come on 30 minutes before sunset, adjust automatically for DST, brighten when someone rings the doorbell, then return to where it was after a few minutes. Never mind not shutting off at dawn if it's totally overcast.

Tuicemen is right. Flags are coming to HG because the users want it. The same will go for many other things as long as ease of operation is kept front and center. Flags are really there already at least for me as virtual devices, which is what I'm used to. Call it what you want, it's another option and the end user will pick the method that's most convenient for them. It might be one obfuscated line, or a well designed method of getting to the desired operation of your particular device.

Title: Re: Fun with Flags
Post by: Tuicemen on February 06, 2019, 06:51:21 PM
There is no need to learn any coding for bkenobi's Advanced Smart lights you simply install it. then click on the x10 module and select Advanced Smart lights just like you do now for the smart lights addon only this gives you more options. bkenobie should have been a bit clearer on the install process for the newbies here.
this is what the Advanced Smart lights looks like.
Title: Re: Fun with Flags
Post by: Tuicemen on February 06, 2019, 06:59:03 PM
To make it easier for the newbies attached is the program just download it and rename the file  to Advanced_Smart_Lights.hgx
Then from HG configuration/programs/lights click on actions (bottom right) and then import program.
Although this may not do away with the need of flags for some it most definitely reduce the number you need.
Title: Re: Fun with Flags
Post by: Dave Mc on February 06, 2019, 07:51:41 PM
There is no need to learn any coding for bkenobi's Advanced Smart lights you simply install it. then click on the x10 module and select Advanced Smart lights just like you do now for the smart lights addon only this gives you more options. bkenobie should have been a bit clearer on the install process for the newbies here.
this is what the Advanced Smart lights looks like.

Thanks for the additional information I will give this a try.  And bkenobie thank you for the coding you did.  I suspect it was many hours of work to put that together.
Title: Re: Fun with Flags
Post by: alzy on February 07, 2019, 08:54:06 AM
I use several flags w/AHP. One is a Away/Home flag. When I leave the house I set it and that sets up
a lighting senario  that makes the house looked lived in and also sets the thermostat  back. When I come home I reset it and the lights are back to manual control and the heat comes back up.
Title: Re: Fun with Flags
Post by: brobin on February 07, 2019, 09:42:47 AM
I use several flags w/AHP. One is a Away/Home flag. When I leave the house I set it and that sets up
a lighting senario  that makes the house looked lived in and also sets the thermostat  back. When I come home I reset it and the lights are back to manual control and the heat comes back up.
I do the same thing with my Stargate. Arming the alarm sets a flag for 'Armed Away' or 'Armed Stay' and disarming clears them. The change of state or presence of the flags adjust lighting, HVAC and other conditions.  In the days of landlines, the 'armed away' flag would also set up call forwarding to my mobile phone.
Title: Re: Fun with Flags
Post by: Tuicemen on February 07, 2019, 09:57:20 AM
In HG you can watch the status of the security system away or home so that becomes the flag.  It even has the option to run a specific program when armed, when triggered, or when disarmed.
You can even arm/disarm this with a x10 security RF remote or timer if you wish.

Many if not all end users needs can be handled without the need for flags.
However some may need additional coding which is what makes Flags attractive to anyone not wishing to code.

Users, keep posting how you use flags or why you think you may need them! This will help everyone learn some of the hidden gems of HG if it already is capable of doing things you need.
Title: Re: Fun with Flags
Post by: alzy on February 07, 2019, 10:32:25 AM
Thanks for the incites into HG's capabilities! For me the concept of flags makes the transition to HG just easier.
Title: Re: Fun with Flags
Post by: Tuicemen on February 07, 2019, 11:44:07 AM
Thanks for the incites into HG's capabilities! For me the concept of flags makes the transition to HG just easier.
I believe there are uses for flags for newbies unfamiliar with HG. They do make for a fast conversion over from AHP.
However once you have every thing moved over one should try to eliminate using them as much as possible as you slowly learn HG. It will help remove the clutter as well as possible issues with Amazons Alexa (if you use it ) and the Echo Bridge as Flags are seen if named.
With users posting how they use flags now, HG solutions can be shown. As well it may give others ideas for their HA setups.
Sharing Ideas & Solutions is what makes this forum and every ones HA setups great. ;)
 >!
Title: Re: Fun with Flags
Post by: bkenobi on February 07, 2019, 12:01:47 PM
Like I've mentioned in the past, I write code for my needs.  I document it in the code which is how many people do things.  I am not releasing a product, I am simply making available something I wrote for myself in case the code helps others (either as is or as a base for another project).  If someone wants to improve upon it, that's great.  I based the code on Gene's original Smart Lights code.  After I released this update (ASL), he improved his code possibly based on/inspired by my update.

As for documenting any further, that's not going to happen.  I wrote this code several years ago and when complete, I installed it and set the coding aside.  It has plenty of documentation for my needs already.  A new user doesn't need to look at the code so it's not needed anyway.  And, once installed, the parameter fields all have sufficient comments to make it work without anything else.

There are several other useful (to me) codes I put on my github repository too.  This was primarily for me to backup in case of system loss but also to share with others.  None of these will be updated to provide documentation either as, just like ASL, they have documentation within the code and are in no need of an update.
Title: Re: Fun with Flags
Post by: Tuicemen on February 07, 2019, 12:11:43 PM
As for documenting any further, that's not going to happen. 
I don't believe that is needed! ASL fields are labelled so there is little doubt what it does or what to type in, unlike Smart Lights.  #:)
Title: Re: Fun with Flags
Post by: Dave Mc on February 10, 2019, 08:22:51 PM
I have been looking at ASL but not finding conditions.  In the example I gave earlier I am looking for a way for a motion sensor to trigger a light to come on for 10 minutes then turn off.  The condition is that this should occur only between 10:00 pm and sunrise.  With my limited knowledge of HG it appears that I need to enter a custom cron expression in the Cron event Wizard.  Hopefully I will be able to copy and paste something or a couple of things from the HG Helper Class Reference to make this happen.

The conditions in AHP smart macros are easy to understand.  Maybe this exists in HG and I am just not finding it.
Title: Re: Fun with Flags
Post by: bkenobi on February 11, 2019, 01:08:57 AM
Unless you are willing to write some of your own code, it is unlikely that you will find something that matches 100% of your needs.  The solution I have suggested gets you 95% of your needs.

Use ASL for you motion sensing needs.  It is designed to turn the lights on if it's dark and motion is detected.  You will need to set up the solar altitude code or use one of the other sources of to get sunrise/sunset.  If you need a custom time rather than sunset/sunrise, you could easily change it to that time (hard coded).  Then, you can use a Scheduler event (crontab expression) to turn the light on at sunset and off at 10pm (or whatever you desire).

The framework is there, you just need to tweak it to get exactly what you want.  Of course, you could choose to go another route but you will be a lot farther away than 95% IMO.
Title: Re: Fun with Flags
Post by: Dave Mc on February 11, 2019, 02:57:17 AM
Unless you are willing to write some of your own code, it is unlikely that you will find something that matches 100% of your needs.

Thank you for the clarification.  In that case adding flags to HG isn't going to help.  I think what would be useful is a drop down selection for conditions.

Update:  I should have said adding flags without adding conditions isn't going to help.
Title: Re: Fun with Flags
Post by: bkenobi on February 11, 2019, 08:10:37 AM
FWIW, making my code do what you want should be easy since I had it set up that way at one point. It wasn't with HG, but the same functional code in the AHP SDK using an AutoIt script.

Like I said, the framework is there.
Title: Re: Fun with Flags
Post by: alzy on February 11, 2019, 10:11:20 AM
So HG doesn't support conditions without special code?
Title: Re: Fun with Flags
Post by: bkenobi on February 11, 2019, 10:53:45 AM
Wizard scripts should be able to accomplish most things.  If you want to do more complex logic, you need a framework that supports it.  Unless ITTT is supported, you will have to write code no matter what HA software you select.  Even then, ITTT is simply graphical representation of code and is actually harder to maintain IMO than just writing a few lines.

Visual programming is a very good introduction for young programmers so they can quickly get up to speed with the programming side and learn logic.  It's not a very good approach for real code for a few reasons that I don't want to get into.  Lego did it right in getting kids playing with actual robots.  Gates did it pretty successfully getting people useful OS and applications.  The ground inbetween is where HA falls IMO.  That requires some kind of scripting language that can be easily learned and used cross platform (Python is an excellent example).
Title: Re: Fun with Flags
Post by: Tuicemen on February 14, 2019, 10:40:56 AM
Prior to latest HG release (37) if HG service was restarted for what ever reason the  HG security system reverted to Disarmed however it now retains its condition prior to the system restarting.
I had a script watching a modules condition which was tied to arming the System (this could have just as well been a Flag as HG never reset modules to off) in my script if the module was On, my security system was sent the arm signal and I was notified that the system had been re-armed.
The script got run daily at my off grid place as I did a daily Pi reboot for a variety of reasons all of which I can no longer remember. B:(

I'm now looking to rebuild that script, possibly adding some extra tasks. Any suggestions?
I'll post a sample of this script with a flag condition of being ON (once I have it rebuilt), in the HG Scripts section.
 >!