Please login or register.

Login with username, password and session length
Pages: 1 2 3 [4]

Author Topic: Fun with Flags  (Read 18106 times)

brobin

  • Hero Member
  • *****
  • Helpful Post Rating: 160
  • Posts: 1458
Re: Fun with Flags
« Reply #45 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.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Fun with Flags
« Reply #46 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.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

alzy

  • Hero Member
  • *****
  • Helpful Post Rating: 5
  • Posts: 358
Re: Fun with Flags
« Reply #47 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.
« Last Edit: February 07, 2019, 10:59:50 AM by alzy »
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Fun with Flags
« Reply #48 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. ;)
 >!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Fun with Flags
« Reply #49 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.

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Fun with Flags
« Reply #50 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.  #:)
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Dave Mc

  • Jr. Member
  • **
  • Helpful Post Rating: 1
  • Posts: 24
Re: Fun with Flags
« Reply #51 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.
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Fun with Flags
« Reply #52 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.

Dave Mc

  • Jr. Member
  • **
  • Helpful Post Rating: 1
  • Posts: 24
Re: Fun with Flags
« Reply #53 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.
« Last Edit: February 11, 2019, 03:10:21 AM by Dave Mc »
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Fun with Flags
« Reply #54 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.

alzy

  • Hero Member
  • *****
  • Helpful Post Rating: 5
  • Posts: 358
Re: Fun with Flags
« Reply #55 on: February 11, 2019, 10:11:20 AM »

So HG doesn't support conditions without special code?
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Fun with Flags
« Reply #56 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).

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Fun with Flags
« Reply #57 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.
 >!

Logged
Please Read Topic:
General Forum Etiquette
Before you post!
Pages: 1 2 3 [4]
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.