LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeScripting

A forum for information about scripting with CastleOS. Get samples, suggestions, and other help here

Forcing current state value Messages in this topic - RSS

Scott Goffman
Scott Goffman
Posts: 111


8/22/2017
Scott Goffman
Scott Goffman
Posts: 111
Chris,

I have a relay device (Insteon-to-Somfy) that is fairly unreliable; the Insteon switch receives its commands 100% of the time, but the connection between it and the Somfy drapes is only about 75% (e.g. the drapes responds correctly about 3/4 of the time).

The "fix" I'm trying to set up is a simple script to repeat the "On" or "Off" command 3 times in a row, with a few seconds delay between each send.

CastleOS isn't allowing that, however; because the Insteon switch is telling it "I'm already on", CastleOS won't send a "turn on" command.

I've tried using device.currentState = "0", but that doesn't seem to override CastleOS's understanding of the on state (it still won't send "On" even if currentState is "0").

Is there any way to force CastleOS to send a state switch regardless of current perceived state?

Thanks,

-Scott
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


9/3/2017
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Hi Scott, just call the device.ToggleDevicePower(bool turnOn) method to force on/off. You can find that method on the device object itself. What method are you currently calling?

Thanks!
0 link
Scott Goffman
Scott Goffman
Posts: 111


9/3/2017
Scott Goffman
Scott Goffman
Posts: 111
That's what I'm using. Specifically:


int tries = 3;
int delayTime = 10;

//set current state to Off;
device.currentState = "0";
for (int tryIdx = 1; tryIdx <= tries; tryIdx++)
{
device.ToggleDevicePower(true);
System.Threading.Thread.Sleep(delayTime * 1000);
}
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


9/3/2017
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
hmm, what makes you think it's not sending the on command? AFAIK that should be working..
0 link
Scott Goffman
Scott Goffman
Posts: 111


9/3/2017
Scott Goffman
Scott Goffman
Posts: 111
Hmm, you're right. I thought the Insteon events weren't showing up in the log, but I just checked and the events are there. I guess the problem is on the Somfy transmitter end, which must be deciding that the shades are already in the desired state so it isn't transmitting the command.
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


9/3/2017
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Unfortunately that I can't help with, I'm not sure how that works. I know Somfy makes a Z-Wave adapter we support as well. That is just setting the percent as a dimmer.
0 link