HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: NAP1947 on January 22, 2017, 10:17:56 PM

Title: Simple X10 Automation
Post by: NAP1947 on January 22, 2017, 10:17:56 PM
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
Title: Re: Simple X10 Automation
Post by: nolio on January 22, 2017, 11:14:44 PM
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...
++
Title: Re: Simple X10 Automation
Post by: NAP1947 on January 23, 2017, 04:21:27 PM
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
Title: Re: Simple X10 Automation
Post by: bkenobi on January 23, 2017, 05:13:15 PM
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.
Title: Re: Simple X10 Automation
Post by: kevinvinv on January 24, 2017, 01:51:45 AM
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!!!   :)
Title: Re: Simple X10 Automation
Post by: NAP1947 on January 28, 2017, 09:47:32 PM
 :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.
Title: Re: Simple X10 Automation
Post by: Jens on January 29, 2017, 10:20:01 AM
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
Title: Re: Simple X10 Automation
Post by: NAP1947 on January 31, 2017, 04:07:26 PM
 :) 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
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 01, 2017, 05:04:30 AM
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 * * * *)
Title: Re: Simple X10 Automation
Post by: NAP1947 on February 03, 2017, 01:49:14 PM
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
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 03, 2017, 03:22:57 PM
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 (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.


Title: Re: Simple X10 Automation
Post by: NAP1947 on February 03, 2017, 04:30:52 PM
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
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 03, 2017, 06:06:36 PM
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!

Title: Re: Simple X10 Automation
Post by: NAP1947 on February 03, 2017, 07:36:57 PM
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?
Title: Re: Simple X10 Automation
Post by: bkenobi on February 03, 2017, 08:18:11 PM
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.
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 03, 2017, 09:19:48 PM
Hi Norm,

The HG for dummies document is a bit old and needs to be updated for the new scheduler stuff...   sorry I wasnt clear about that.

I want to update it as soon as possible... 
Title: Re: Simple X10 Automation
Post by: NAP1947 on February 05, 2017, 04:41:31 PM
I did not realize what I was getting into when I started down this path, I have a significant X10 investment which I did not want to scrap, the way I read about HomeGenie it would allow me to run my X10 and over time, change to a newer technology and still operate with HG.

I will continue to plug away at the Sunrise/Sunset portion, although HG is currently doing everything my AHP did, more reliably, the option of Sunrise/Sunset instead of having to manually adjust times makes great sense and hopefully I will figure it all out.

Cheers, and thanks to everyone who contributed so far.

Norm
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 05, 2017, 11:01:29 PM

Have you tried enabling both Weather Underground and JK Utils yet?   Just curious if that helped get the sunrise / sunset stuff working any better
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 06, 2017, 03:40:05 AM
Hi Norm,  I updated the Homegenie for Dumies document to cover the new scheduler.  I havent done the best job on this document but maybe it will help.  I hope others can take time to update it where it needs to be updated or clarified.

One thing I thought of in your case...do you think you have the proper Lat/Long set up for your location?  This of course is necessary for Sunrise/Sunset.

You can get the latest document here:   http://www.homegenie.it/forum/index.php?topic=1420.15 (http://www.homegenie.it/forum/index.php?topic=1420.15)

I hope it can help some.
Title: Re: Simple X10 Automation
Post by: Jens on February 06, 2017, 07:38:38 PM
Hi

I think you do not need to set LON/LAT if you use wheatherunderground.
Going to program params you'll find e.g.

Astronomy.Sunrise = "08:00"
Astronomy.Sunset = "17:29"

which are mapped to the location which is shown in wheatherunderground and can be used by the scheduler.

Bests
Jens

Title: Re: Simple X10 Automation
Post by: kevinvinv on February 06, 2017, 09:11:16 PM
HI Jens,

Great.  So do you access Astronomy.Sunrise from within the scheduler (the new scheduler) somehow?
Title: Re: Simple X10 Automation
Post by: NAP1947 on February 07, 2017, 12:39:58 AM
First I neglected to answer a previous question about HG on my system, I have weatherunderground initialized and all my X10 modules installed in widgets all of which work.
I have all the X10 modules working from the Scheduler with fixed on or off times.
I have not been able to figure out if I have the jkutils app nor obviously have I got it initialized.
I have tried the (@SolarTimes.sunset) ; (* * * * *) crone command without success.  My objective is to have certain modules come on at sunset and go off at preset times everyday and others that come on at preset times and go off at sunrise.
I have not approached thermostat or garage door opener functions yet.
So my next need is to address the jkutils issue, I am currently researching that.
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 07, 2017, 03:11:08 AM
Hi Norm,

Thanks for that info.  And is that the cron string you are using?   I could be wrong but I dont think that will work...

Here is what I use for Sunset to 9:30
 (@SolarTimes.Sunset)  > (30 21 * * * )

Have you tried something like that?

Also- did you notice that I updated the HomeGenie for Dummies document?  It maybe will help a tiny bit... not sure though.
Title: Re: Simple X10 Automation
Post by: bkenobi on February 07, 2017, 05:04:20 PM
Here is what I use for Sunset to 9:30
 (@SolarTimes.Sunset)  > (30 21 * * * )

What happens if sunset happens after 9:30PM?  I have my lights turn off at 10:30 because in the summer it's light much later.  This is a catch in case I forget to turn them off as well, so it's not mandatory.  If your approach turns the lights on after sunset ONLY if it's also before 9:30, that would be great, though.
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 08, 2017, 12:24:25 AM
Not sure what happens in that case actually... I havent ever noticed that happen around here  :)
Title: Re: Simple X10 Automation
Post by: NAP1947 on February 08, 2017, 04:40:10 PM
I have set up one of our lights as (@SolarTimes.Sunset) > (* 23 * * *)
Hopefully that will turn on at sunset and off at 11PM.
Anther lamp I have set as (@SolarTimes.Sunsrise) > (* * * * *)
Hopefully that will turn off at sunrise, off I have a separate schedule, I will see tomorrow.

I did see and read the updates guide and it with your specific directions are most helpful, I hope to see tomorrow.  I will post with results.

I am still trying to figure out the jkutils thing but have not really had a lot of time to play with it.  As most of us retired types there does not seem to be enough hours for everything, I do not remember how I did when I worked.

Norm
Title: Re: Simple X10 Automation
Post by: bkenobi on February 08, 2017, 05:25:05 PM
jkUtils is really easy to use.  Basically you just enable it in the programs, specify your location, and put the widget into some location of your dashboard (if you want).  It works offline, so no matter how good/bad your internet is, it will always work.  The only thing it relies on is that your system clock work correctly (obviously).
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 11, 2017, 07:01:27 AM
Hey Norm,  so did the sunrise work?  :)
Title: Re: Simple X10 Automation
Post by: NAP1947 on February 15, 2017, 09:54:15 PM
Success, took me a while but I finally got it running.
For example to turn a light on at 5AM and off at sunrise I did as follows.
I setup a schedule to turns the X10 switch on at 5 AM using exact time.
I setup a second schedule using the same X10 switch but a crone expression "@Solartimes.Sunrise".  Everything works just as I want it to for all the modules I setup.
Thanks to everyone for your help and patience.
Norm
Title: Re: Simple X10 Automation
Post by: bkenobi on February 15, 2017, 11:03:09 PM
I'm just now working on the new scheduler as well.  The documentation and most of the advice suggests that in order to turn a light on at one time and off at another requires 2 schedules.  And, that may be a better way to do it, but it's not the only way.  If you look at the code snippets section there is one that turns on the module in the 1st minute of the current scheduling event and off in the last.  I haven't tried this yet, but it appears that it might do what I want (turn the light on once at a given time and then off at the end time.  That might be what you are looking for but if you already have it up and running, you probably don't need to do anything different.
Title: Re: Simple X10 Automation
Post by: bkenobi on February 17, 2017, 05:38:01 PM
One thing to note that someone may find useful.  It wasn't obvious to me initially, but it is acceptable to install the Scheduled On/Off script with the new schduler.  In doing so,  you can use either one or a combination of both.  I'm not suggesting that is a good approach as it will make things more complicated in the long run.  However, there may be a situation where one is the ideal solution over the other.

In my case, I'm currently using the old approach for most of my modules and the new approach for a test module until I understand things.  That way I can get started with the new scheduler without having to stay on such an old version of HG.
Title: Re: Simple X10 Automation
Post by: kevinvinv on February 18, 2017, 12:57:15 AM
that is good to know!