Creating a write-only relay device

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Tue Aug 07, 2012 10:23 pm
Perry The Cynic offline
Posts: 838
Joined: Apr 07, 2008

Creating a write-only relay device

I need to create a standard "relay" device, but one that doesn't generally know what its current state is. I know how to make any "toggle" actions fail. But is there any way I can reject attempts to read such a relay device? I'd hate for users to read the onOffState and then realize that it bears only a sometimes resemblance to the real state...

Failing an ability to block reading of the onOffState, is there any way I can make it tri-state (on, off, unknown)? Yes, I sometimes know what the state is, but not at other times. Weird, huh?

Or am I over-stretching the intended meaning of a "standard" relay device, and I should really use a custom device instead?

Cheers
-- perry

P.S.: If you're dying from curiosity, that's the "trigger" relay outputs at the back of a Denon receiver. They track internal activity of the receiver without telling you what they're doing, until you send them a command, at which point they latch to the set value ignoring the internal state... until the receiver powers down. Then the cycle repeats. Weird.

Posted on
Tue Aug 07, 2012 10:56 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Creating a write-only relay device

Hmmm... perhaps not quite what you are looking for but you can:

Code: Select all
dev.setErrorStateOnServer(u"unknown")

And you can clear the error state later by setting it to None when the state has a known value. That won't prevent someone from trying to read/use the state currently. If I recall correctly the previous state value is still there, but in the UI the error state (if present) overrides it.

I hope to flush out error states more fully in a future version for sure. The current (above) error mechanism was just a first pass to try to show that a device is in a bad state. Note it will show in red in the main window UI, which is probably why it is not a great fit for what you want.

Image

Posted on
Tue Aug 07, 2012 11:23 pm
Perry The Cynic offline
Posts: 838
Joined: Apr 07, 2008

Re: Creating a write-only relay device

Yeah, not really. There's no error; just an inability of the device to report a meaningful state at times (but you can still change it!) What I'm reaching for is some way of saying "the onOffState of this device is not meaningful right now; don't use it." There's no way to interpose into the reading of my devices' state from outside the plugin, is there?

As a future suggestion of the comparatively simple kind, how about simply providing for a write-only relay device? Just give relays a configuration option for "can't read the onOffState", and it's done. I should hope it's rather rare to have a device like this that sometimes knows what its state is...

Cheers
-- perry

Posted on
Wed Aug 08, 2012 8:22 am
jay (support) offline
Site Admin
User avatar
Posts: 18260
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Creating a write-only relay device

I think this particular scenario is a bit outside the definition of a relay device - I'd suggest a custom device. No, you don't get the built-in actions/ui of a relay device, but it really doesn't fit in our definition of a relay device.

If all you really care about is sending the action then maybe you don't need any device at all - just two custom actions (on/off) that work against the receiver device.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest