HomeGenie Forum

Development => Feature request => Topic started by: kevinvinv on June 06, 2016, 09:50:59 PM

Title: ALL ON / ALL OFF for X10
Post by: kevinvinv on June 06, 2016, 09:50:59 PM
Hello,

The current implementation of X10 All/On    All/Off  cycles through all the module codes in sequence like this:

A1 ON
A2 ON
A3 ON
etc


X10 however supports an ALL ON command that will turn all units on at the exact same time.

It would be GREAT if HG could implement this native X10   ALL ON  / ALL OFF command as it would drastically speed up turning on an entire house code for things like panic buttons or security systems.

Thanks for your consideration.
Title: Re: ALL ON / ALL OFF for X10
Post by: bkenobi on June 06, 2016, 10:29:28 PM
True!  If you had as an example an entire house code used for lights and wanted to turn all of them on at the same time, there are 3 approaches that yield wildly different implementation times.  This assumes a script taking no time, and perfect reception on your PLC without interference.

Manual:  (hail module, turn it on, move to next)
Code: [Select]
command cycles time cumulative time
E1 25 0.417 0.417
E1 ON 25 0.417 0.833
E2 25 0.417 1.250
E2 ON 25 0.417 1.667
E3 25 0.417 2.083
E3 ON 25 0.417 2.500
E4 25 0.417 2.917
E4 ON 25 0.417 3.333
E5 25 0.417 3.750
E5 ON 25 0.417 4.167
E6 25 0.417 4.583
E6 ON 25 0.417 5.000
E7 25 0.417 5.417
E7 ON 25 0.417 5.833
E8 25 0.417 6.250
E8 ON 25 0.417 6.667
E9 25 0.417 7.083
E9 ON 25 0.417 7.500
E10 25 0.417 7.917
E10 ON 25 0.417 8.333
E11 25 0.417 8.750
E11 ON 25 0.417 9.167
E12 25 0.417 9.583
E12 ON 25 0.417 10.000
E13 25 0.417 10.417
E13 ON 25 0.417 10.833
E14 25 0.417 11.250
E14 ON 25 0.417 11.667
E15 25 0.417 12.083
E15 ON 25 0.417 12.500
E16 25 0.417 12.917
E16 ON 25 0.417 13.333

collective: (hail all modules, turn all on with single ON command)
Code: [Select]
command cycles time cumulative time
E1 25 0.417 0.417
E2 25 0.417 0.833
E3 25 0.417 1.250
E4 25 0.417 1.667
E5 25 0.417 2.083
E6 25 0.417 2.500
E7 25 0.417 2.917
E8 25 0.417 3.333
E9 25 0.417 3.750
E10 25 0.417 4.167
E11 25 0.417 4.583
E12 25 0.417 5.000
E13 25 0.417 5.417
E14 25 0.417 5.833
E15 25 0.417 6.250
E16 25 0.417 6.667
E ON 25 0.417 7.083

native: (utilizing the all on command)
Code: [Select]
command cycles time cumulative time
E All ON 25 0.417 0.417

So, with the worst case implementation it could take over 13 seconds to turn all lights on.  HG uses the second approach and it could take 7 seconds.  If the native X10 command were implemented, it would take ~0.4 seconds to turn on the lights for a house code.

EDIT:  I asked a similar question at the X10 forums 2 years ago and was given a very detailed response.
http://forums.x10.com/index.php?topic=28743.msg160924#msg160924 (http://forums.x10.com/index.php?topic=28743.msg160924#msg160924)
Title: Re: ALL ON / ALL OFF for X10
Post by: kevinvinv on June 07, 2016, 03:39:36 AM
Thanks sir,

I have been wondering off and on if I could do a system call to mochad from HG to get the ALL ON/ALL OFF functionality I desire but that just seems too kludgy...  so I'll see if Gene might be interested in implementing.
Title: Re: ALL ON / ALL OFF for X10
Post by: bkenobi on June 07, 2016, 04:32:35 PM
It's not ideal, but I think it would work out ok.  Mochad is a service that sits in the background and waits for a command.  If you use HG to send that command with a wget, you probably could do this with a very simple wizard or c# script.  It would be nicer to not need this extra step, but I think it would make your system work a little smoother.
Title: Re: ALL ON / ALL OFF for X10
Post by: Gene on June 07, 2016, 11:46:00 PM
HG already supports this through API calls:

/api/HomeAutomation.X10/A/Control.AllLightsOn

/api/HomeAutomation.X10/A/Control.AllLightsOff

where 'A' is the house code.

Title: Re: ALL ON / ALL OFF for X10
Post by: bkenobi on June 07, 2016, 11:53:50 PM
kevinvinv is suggesting that when the API call is made, it sends a command to each light in the 'A' HC and then the ON command.  There is a native command that X10 supports to send a A ALL ON or ALL OFF command.  Doing so eliminates the need to send the addresses to each UC.  I have not tested this recently but as I recall, sending the API command results in a string of PLC commands that address the lights and then one to command them ON or OFF.  Perhaps it has changed recently though.
Title: Re: ALL ON / ALL OFF for X10
Post by: Gene on June 07, 2016, 11:57:57 PM
it is the native one.
Title: Re: ALL ON / ALL OFF for X10
Post by: Gene on June 08, 2016, 12:04:28 AM
kevinvinv is probably referring to the "group lights on/off"  from the ui?
Title: Re: ALL ON / ALL OFF for X10
Post by: kevinvinv on June 08, 2016, 12:14:04 AM
Hmm,   I am confused (not unusual).

When I run the API commands:

/api/HomeAutomation.X10/A/Control.AllLightsOn
/api/HomeAutomation.X10/A/Control.AllLightsOff

I see the lights in house code A turning on one after the other...  as if controlled by a loop.

I looked through the code and dont see anywhere where there is an actual X10  ALL ON command issued but I EASILY could have missed that.  I recall seeing a loop that sends ON to each of the unit numbers consecutively.

I guess I dont know what the group all on commands are but I'd LOVE to find out how to turn on every single light in house code A at the SAME exact time like the X10 ALL ON command does.  I certainly am not seeing that with the above referenced API calls.

Are we all talking the same language?

Thanks for your help everyone!!!  Would love to hear what you have to say about this.  Perhaps I am missing something important.
Title: Re: ALL ON / ALL OFF for X10
Post by: Gene on June 08, 2016, 12:18:16 AM
https://github.com/genielabs/x10-lib-dotnet/blob/master/XTenLib/XTenManager.cs#L454

this is the code. It sends only one X10 command.
Title: Re: ALL ON / ALL OFF for X10
Post by: kevinvinv on June 08, 2016, 12:26:12 AM
Will try again tonight.  I havent looked at it for a few versions.  Thanks!
Title: Re: ALL ON / ALL OFF for X10
Post by: Gene on June 08, 2016, 12:30:15 AM
you're welcome. This was already asked before, I hope it's cleared now.
Title: Re: ALL ON / ALL OFF for X10
Post by: kevinvinv on June 08, 2016, 02:37:49 AM

Well, sure enough-  it seems to work.

The last time I tried it was on R514 and the discussion you probably are referring to is here:
http://www.homegenie.it/forum/index.php?topic=1341.30 (http://www.homegenie.it/forum/index.php?topic=1341.30)

Thanks!!!
Title: Re: ALL ON / ALL OFF for X10
Post by: bkenobi on June 08, 2016, 04:54:47 PM
I should have verified myself but I remembered when this was asked a while back.  I assumed that since it came up again, it was still an issue.  The command is used where Gene linked and the hex code is defined here:

https://github.com/genielabs/x10-lib-dotnet/blob/7237ac14fb475cf19a9fceeff36e139b18772c1c/XTenLib/Enums.cs#L37
Title: Re: ALL ON / ALL OFF for X10
Post by: kevinvinv on June 08, 2016, 06:04:27 PM


Either it didnt work that way back in R514 when I last tried it OR (more likely) I got confused b/c I saw a sequential enabling in the log file.

It still does show this sequential enable/disable in the logfile but I think that is just updating the widget status- not actually enabling/disabling the modules sequentially.

The other problem back in R514 was that there was this "cant create new program" bug so I got probably a little disoriented with the details of what I was observing.

ANyway... I am REAL happy that it is working now!!!!