more G-Labs products

Author Topic: Simple X10 Automation  (Read 1813 times)

January 22, 2017, 10:17:56 PM
Read 1813 times

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
With great help from this board I have Raspian and HomeGenie working on my RPi.
All of my X10 switches are setup in widgets and all can be controlled manually.
I am now trying setup simple on/off automation for my X10 switches.
I want to use a combination of fixed time or sunset/sunrise with offsets as triggers.
I have tried both macros and line by line instructions, neither works.
Once again it is my lack of programming experience (or old age and senility) which is causing the mental block to understanding the User Guides.
Can someone offer some guidance.
Thanks
Norm

January 22, 2017, 11:14:44 PM
Reply #1

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi,
Did you try already existing code "advanced smart light" ? (bkenobi code).
https://github.com/bkenobi/HomeGenie_Apps/blob/master/Advanced_Smart_Lights.hgx

I think his code use sunset and sunrise, but I don't think a time schedule too...
++

January 23, 2017, 04:21:27 PM
Reply #2

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
WOW, good thing this is a learning experience.
I will spend some time with this code as well as the user guide in order to understand what is being done, I expect it will keep me busy for a bit.
Where does one find these existing APPs?
Cheers
Norm

January 23, 2017, 05:13:15 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I use sunrise/sunset based on the jkUtils code in Advanced Smart Lights (ASL).  I think the new interface for scheduling allows for offsets so it might be best to look at that directly.

I also have lights that I control on/off at a combination of times and sunrise/sunset conditions.  In my case, I have lighting that I turn on in the morning 5:30am if it's dark and turn off at sunrise AND also turn on at sunset and then off at 10:30pm.  This can be done directly with the Scheduled ON/OFF script and requires no coding knowledge.  The new scheduler also allows offsets, so if sunrise/sunset are not exactly what you want, you can do something ±10 minutes pretty easily.  Since that wasn't available a couple years ago, I used different types of sunrise/sunset to get the offset I wanted in ASL.

January 24, 2017, 01:51:45 AM
Reply #4

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
If you are on 525 or newer... I DEFINITELY recommend using the scheduler.  It takes some getting use to but it works pretty well and I found the learning curve a tiny bit less than figuring out how to get sunrise and sunset to work right in 525+  C# code.

YMMV...

I had to laugh when you posted  "Simple X10 Automation" ...   :)  No such thing!!!   :)

January 28, 2017, 09:47:32 PM
Reply #5

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
 :o

Being new and knowing very little about this whole RPi, Raspbian, HomeGenie environment using the word 'Simple' was just showing my lack of understanding.  I remember struggling to get the X10 Windows software up and running and figured how hard could this be, all that being said I am slowly realizing what I have bitten off.

I have spent a few hours trying to get Schedule to work (I figured the program lines were going to be beyond me at this point) but so far have not achieved any success.  All of my Widgets work manually just fine so I am confident the software and hardware are operating OK.

I open the Schedule menu, name and identify the module (e.g. Lamp, C2) and save it.

Now I am in never never land, nothing I try seems to work no matter how simple I make the commands.  I am trying to follow the user guide but somehow I am missing something probably vary small.  As an example once I get the name and identity in there is a "setup" box visible but greyed out and not usable.

The section menus only address radio, security etc. I would say none of those apply to X10.

Can someone supply some simple instructions to get past this setup wall I seem to be against?

By the way I am on revision 525.

January 29, 2017, 10:20:01 AM
Reply #6

Jens

  • *****
  • Information
  • Global Moderator
  • Posts: 211
Got to
>Configure>Scheduler
Select
>Add Event (right lower corner)
Window pops up
- give it a name (Event Name)
- Click in the middle on the time being displayed
- select the time you want the event to happen
Select
>Add+
Go to Modules left lower corner
>Modules
- select your group like switch and than the modules like A1
Go to Script left lower corner
></>Script
Click on Add code Snippet
Select e.g. Turn On

Click on Save (right lower corner)

Your done

January 31, 2017, 04:07:26 PM
Reply #7

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
 :) Jens, yours is the magic touch, I have everything working.
Perhaps this simple description should be included in the Schedule part of the User Guide!

This board is very helpful, and patient with us unwashed.

Now I am reading about how to use Sunrise/Sunset as qualifiers, lots of reading and learning, compiling and all sorts of stuff I need to know, but for now I am operating as the old PC based system did.

Thank you all
Norm

February 01, 2017, 05:04:30 AM
Reply #8

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
Hi Norm,

I pulled my hair out on the sunrise sunset thing. 

I wanted an off command every 20 minutes from dawn to dusk so I used this in the scheduler custom cron command... seems to work....finally

 ( (@SolarTimes.Sunrise)  > (@SolarTimes.Sunset ) ) ; (2/20 * * * *)

February 03, 2017, 01:49:14 PM
Reply #9

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
I regret using the word "simple" more and more.
Tried reading stuff about sunrise sunset and got nowhere, then Kevinvinv posted his method.
So I figured that looks pretty "simple", made a new schedule using the crone expression "@Solartimes.Sunset" does not work.
Read some more and perhaps the problem is that I am using weather underground for my sunset time point, is Solartimes different than weather underground and if yes how to I either convert to Solartimes or use weather underground as the time point?
Thanks again.
Norm

February 03, 2017, 03:22:57 PM
Reply #10

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
I understand fully.  I cannot recommend continuing with HG actually.  I am only continuing myself b/c I am a stubborn sucker.

A couple things

Are you using version 525 or what version?

I understood that SolarTimes was built in now... you shouldn't need weather underground.

Having said that... I AM using Weather Underground myself (just for a quick weather view) so maybe you ought to configure it.  The "for dummies" document in this link should help you get that thing running.  I hope to update this document sometime for the 525 changes too.

http://www.homegenie.it/forum/index.php?topic=1420.msg9039#msg9039


In addition, I am running the JKUtils app as well in HG.  This thing I think also had some sunrise support in the past...   

Maybe you should enable both of these and see if it helps... at least you would be closer to the config I have. 

Finally,  does the scheduler work for you in general with fixed times (for example)?

Once you get the sunrise stuff going-  you should be able to graphically see it in the scheduler bar graph display... this will give you some confidence (ha!). 

So check out the above and let me know.   I'll do my best to help you get this going and if we do,  I'll update my doc with what it took so others can survive.



February 03, 2017, 04:30:52 PM
Reply #11

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
I am using 525 and have setup Weather Underground and subscribed.
Your comment about HG intrigues me as I started this on a RPi to replace my very old windows based X10 utility.  The RPi intreged me as my son-in-law has one and I thought it would be an interesting mental exercise, is there another simpler alternative to HG?
I will go through the "for dummies"document and also figure out the JKUTILS thing.
I will let you know how I make out, I am not ready to quit yet.
Norm

February 03, 2017, 06:06:36 PM
Reply #12

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
I probably shouldnt have spoken so strongly with the HG comment.

It is a VERY time consuming project but the price is right and the capabilities are there...  its just that you have to start out understanding that it is going to be a "Lifestyle" which I did not expect.

If I were starting over... I'd probably ditch X-10, pony up and go z-wave, and use one of the many many hubs available everywhere now.

But that would cost me... and alas... I am also very tight!


February 03, 2017, 07:36:57 PM
Reply #13

NAP1947

  • *
  • Information
  • Newbie
  • Posts: 16
I am following HG for Dummies and am OK up to the page 5 of 10.
In the first screen shot under Features/Options I do not have an option "Enable scheduled on/off, I only have "Security Alarm System" and "Zone Sensors".
I must have something not right in HG setup but cannot find it.
Suggestions?

February 03, 2017, 08:18:11 PM
Reply #14

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
HG can be used for simple things quickly but if you want something more complex, it will take more effort.  From my experience, this is true for ALL HA software.  I have not seen one that will do all tasks out of the box perfectly without any time invested.  That said, HG was the only one that was available a few years back that could run on an embedded style system (RPi in this case), supported X10 and the CM15A in particular, and had a real programming capability.  There may be others, but at the time, the price was a big factor (HomeSeer was WAY too expensive to consider).

I don't use the current scheduler but what you are trying to do should be relatively easy (definitely possible).  However, if it's not currently available and requires programming, it's only going to get implemented if someone (read you) code it.  I had a need for a specialized setup and had to code it myself.  I converted a mostly working setup run through AHP on Windows to HG and it works better/more reliably.  That said, it took me many times longer to get it running and debugged as I'm no C# programmer.