Page 1 of 1

How to change default ON level

PostPosted: Sun Feb 27, 2011 5:40 pm
by gboudreau
Is there any way I can change the default ON level of dimmers using AppleScript ?
There doesn't seem to be such a command in the dictionary, but I saw a Send Raw Command, which I guess could be used to do this.
Is there any way I can have Indigo show me the raw commands it sends, so that I can see what is sent to set the default ON level, and re-use that in the raw command of AppleScript ?

Thanks.

Re: How to change default ON level

PostPosted: Mon Feb 28, 2011 10:55 am
by jay (support)
First, set the brightness of the light to the desired default, then send 0x25 and 0x01 (decimal 37 and 1):

Code: Select all
send insteon raw cmd1 37 cmd2 1 to address "ADDRESS"

Re: How to change default ON level

PostPosted: Mon Feb 28, 2011 11:04 am
by gboudreau
Is there a way to do it without actually opening the lights ?
I'd like transition from 'normal' to 'much lower default ON level during the night' without having all my lights flash...

i.e. during the day, I'd like the default ON level to be 70 or 100.
But during the night, 15-30% is enough, since anything above that would just blind me!
So using my attachment script, I'd like to change the default ON levels of all my lights at a predefined time.
Doing what you suggest would force me to send a "set brightness to 30%" command to all lights, followed by the raw command, then turning OFF all the lights that were OFF when I started...
Me, I wouldn't mind, but I think doing such a thing would have a -50 Wife-Acceptance-Factor in here! :)

Re: How to change default ON level

PostPosted: Mon Feb 28, 2011 11:07 am
by jay (support)
Unfortunately, there's no consistent way to do that (via AppleScript).

Re: How to change default ON level

PostPosted: Mon Feb 28, 2011 11:12 am
by gboudreau
That would be appreciated in v5.
Since it's available in the interface, I guess it wouldn't be too difficult to make it available to AppleScript.

Thanks for your time.

Re: How to change default ON level

PostPosted: Mon Feb 28, 2011 11:26 am
by jay (support)
I shouldn't have added the (via Applescript) part - it's just not possible on some devices (to set the default brightness without setting the actual brightness first) - when we set the default brightness on those we do actually turn it on to the right brightness, send the command, then turn it back off.

Having said that, however, since we remembered that we added a remote poke AppleScript command, this may work for some types of devices:

Code: Select all
send insteon remote poke to address "01.02.03" at memory location 50 byte (255 * BRIGHTNESS / 100)


where BRIGHTNESS = the desired default brightness value. No promises that it will work on any of your modules though and it could theoretically hose a module up so that you have to factory reset it... ;)

Re: How to change default ON level

PostPosted: Tue Mar 01, 2011 6:45 am
by gboudreau
Tried the remote poke command. While it was successfully sent (says Indigo), it did nothing (not even break the dimmer!)

Here's what I did: I peeked at the whole 0-255 address space using this:
Code: Select all
tell application "IndigoServer"
   repeat with i from 0 to 255
      send insteon raw cmd1 43 cmd2 i to address "17.E1.12"
   end repeat
end tell

I then changed the default ON level from 70% to 30%, and repeated.
I finally compared the result of both runs, to find the address used for the default ON level.
It was indeed 50 (0x32). So I experimented with the default ON value in Indigo, and each time, peeked at memory address 50:
Sent INSTEON "Dimmer - Escalier RDC-SS" set local default on level (via set tap) to 1
Sent INSTEON "Dimmer - Escalier RDC-SS" raw insteon command (2B 32; ack: 03)
Sent INSTEON "Dimmer - Escalier RDC-SS" set local default on level (via set tap) to 99
Sent INSTEON "Dimmer - Escalier RDC-SS" raw insteon command (2B 32; ack: FC)
Sent INSTEON "Dimmer - Escalier RDC-SS" set local default on level (via set tap) to 50
Sent INSTEON "Dimmer - Escalier RDC-SS" raw insteon command (2B 32; ack: 80)

Well, what do you know... It is as you said... 0-255 values, in memory space 50, defines the default ON level.

Next, I tried the remote poke command, each time followed by a peek.
That worked fine. The peeks confirmed the poke worked fine.

I also tried the "Re-Sync Links..." button, after I used a remote poke to change the default ON level to 255. Indigo now saw the new value as 100%.
But still, tapping the dimmer once didn't set the brightness to 100%.

Any idea why is that ? i.e. why, when address 50 contains the correct value, the dimmer still doesn't use that as the default ON level ?
Maybe there's another command I need to use to tell the dimmer to re-read that value from the memory ?

Re: How to change default ON level

PostPosted: Tue Mar 01, 2011 8:54 am
by matt (support)
After you poke the byte, try sending this command:

Code: Select all
send insteon raw cmd1 36 cmd2 0 to address "17.E1.12"

Re: How to change default ON level

PostPosted: Tue Mar 01, 2011 6:06 pm
by gboudreau
Tried that without success...
From the INSTEON command list I found, this seems to apply only to KeypadLinc.
I also tried cmd1 79 cmd2 11, and cmd1 79 cmd2 01, but I think that works only with EZIO.

Could it be that my device (ICON dimmer) doesn't support remote pokes?
That would be my conclusion, since I can't seem to poke something and have it take effect.
I'll continue this thread in SmartHome's forums, or with SmartHome's support, to see if this is possible.
I'll post back if I get a definitive answer.

Thanks for your time.

Re: How to change default ON level

PostPosted: Tue Mar 01, 2011 7:30 pm
by matt (support)
Yeah, unfortunately it probably doesn't work with SwitchLincs.

I know that: some older modules cannot have their default level changed at all, KeypadLincs work with poking, and newer SwitchLincs (and ICON Dimmers) work via the "set tap" method (which requires the module to go to the brightness level first). I was thinking that maybe the newer SwitchLincs supported the poking method as well, but they apparently don't.

Re: How to change default ON level

PostPosted: Fri Feb 08, 2013 3:30 pm
by sgtwicki
Okay, I can't seem to get it to work at all via AppleScript with my KeyPadLinc. I've got a Schedule that performs the following:

send insteon remote poke to address "07.DD.47" at memory location 50 byte (255 * 20 / 100)
send insteon raw cmd1 36 cmd2 0 to address "07.DD.47"


and here is what is output to the Event Log:

33
PowerLinc Remote memory written to address 0032
Sent INSTEON "Hall light" raw insteon command (24 00; ack: 00)


but nothing appears to change with the KeyPadLinc. I'm not sure what that "33" is in the Event Log (on a line by itself.)
If I edit the device, I can successfully change the default brightness. This is what shows up in the Event Log:

Sent INSTEON "Hall light" set local default on level (via poking) to 20
Sent INSTEON "Hall light" set local ramp rate duration (via poking) to 0.1 seconds

Re: How to change default ON level

PostPosted: Fri Feb 08, 2013 5:44 pm
by matt (support)
Hmmm... I'm not sure. I have an older KeypadLinc I just tried it with. Originally the default brightness was 100%, then I copy/pasted your exact 2 script lines (just replaced the INSTEON address), and it did update the default brightness used.

Did you try it multiple times? To test the default brightness are you turning it OFF then ON at the switch itself?

Re: How to change default ON level

PostPosted: Sat Feb 09, 2013 2:59 pm
by sgtwicki
You are absolutely correct. I was using the "Turn On" button in the GUI instead of the A button on the switch itself. :oops:
I was under the mistaken impression that the "Turn On" button in the Devices main GUI performed the same function as the "Turn On" action when I create a Trigger.
Unfortunately this doesn't help me with my quest to change the default brightness, later to be activated by an X10 motion detector. When my Trigger turns on the KeyPadLinc, it doesn't use the default brightness set by Indigo. If I manually set the brightness using a single-tap of the set button on they KeyPadLinc, it does turn on to that level.
Is there any way to simulate setting the default brightness via the set button?

Re: How to change default ON level

PostPosted: Mon Feb 11, 2013 9:58 am
by matt (support)
If you have the brightness value in an Indigo variable you want to use, then you can use an action to execute a simple embedded python script like this:

Code: Select all
var = indigo.variables[1054386252]     # Indigo variable "defaultBrightness"
dev = indigo.devices[588351727]        # Indigo device "office lamp"
indigo.dimmer.setBrightness(dev, int(var.value))

To get the variable and device IDs, right-click (or CONTROL + click) on the object in the Indigo UI and select Copy ID.

Re: How to change default ON level

PostPosted: Wed Jul 18, 2018 2:06 pm
by dprlemon
Thanks for this! I was trying to use another script that was posted that had code for exceptions to log and couldn't get it to work. This works perfectly.