Digital Output Persistence

Comments & issues
gjacquemin
Fresh meat
Posts: 1
Joined: Tue Jul 21, 2020 2:29 am
Contact:

Digital Output Persistence

Postby gjacquemin » Tue Jul 21, 2020 2:37 am

Hello,

I'm controlling among others a
16x Isolated Solid State Relay Phidget
with the

Code: Select all

phidget22.DigitalOutput
JavaScript API. Everything's works fine, BUT each time I refresh my webpage, the relays goes off. As I read on the documentation, I understand that this is persistence feature that was available in phidget21 but not in phidget22.

I do understand why you make this choice (predictable state with channel is attached), but that's very annoying in webpages where the user can open/close/reload easily the program.

My question: is it possible to enable the persistance or disable the reset state when channel is detached?

Thanks!

User avatar
Patrick
Lead Developer
Posts: 3197
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Digital Output Persistence

Postby Patrick » Tue Jul 21, 2020 10:12 am

Hi,

It's not possible to have the Phidget retain it's state while closed. This may be something we look into supporting in the future, as it does make sense in certain scenarios.

For your case, I'd recommend writing a small server-side application which you keep running all the time alongside the Phidget network server, which manages the state of your devices. This could be as simple as just opening them, so that the network server always has an active client and doesn't close them when the web clients reload.

One step further would be something like a Node.JS application which manages the Phidgets server-side and serves it's own web view for clients. Really depends on the situation.

-Patrick

philx1
Fresh meat
Posts: 2
Joined: Wed Jul 29, 2020 7:16 am
Contact:

Re: Digital Output Persistence

Postby philx1 » Wed Jul 29, 2020 7:20 am

Just to add, I think it's a good idea to add the option as some kind of configurable (maybe flash, or not - R/W cycle lifetime?) setting on a phidget/controller?

i.e. default 0 / default 1 / persist

Writing another application to run on some persistent server (using a HUB5000) just to keep the device states seems a bit wasteful.


EDIT: specifically when the HUB5000 controller is attached to a network remotely... it would be nice to know multiple clients can cycle in and out of having access without worrying there may not be "one left" to hold the current states... each client/user can connect in a do a "read, modify, write" instead of assuming there's some initial state or assuming there is no one else connected.

User avatar
Patrick
Lead Developer
Posts: 3197
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Digital Output Persistence

Postby Patrick » Wed Jul 29, 2020 12:57 pm

It's true that writing a dedicated app just to keep state shouldn't be necessary. When the library was designed, we just decided to enforce that users need to keep a channel open if they want it to be controlled - this does fall apart a bit in the case of in-browser JavaScript, and in fact JavaScript support was added after the library was designed.

-Patrick

philx1
Fresh meat
Posts: 2
Joined: Wed Jul 29, 2020 7:16 am
Contact:

Re: Digital Output Persistence

Postby philx1 » Fri Jul 31, 2020 3:13 pm

I am new to the phidgets ecosystem - creating a python CLI for developers to interact with hardware remotely and just figured remote network interfaces tend to not be as reliable... having some persistence would help keep the hardware "in tact" if the network drops for some reason. Have not done any remote testing yet to see how reliable it is.

gregbalco
Phidgetsian
Posts: 9
Joined: Fri Sep 25, 2020 12:01 pm
Contact:

Re: Digital Output Persistence

Postby gregbalco » Sat Oct 17, 2020 12:28 am

I was just reading this thread and want to add a comment that it would be useful if devices could have persistent state. I have been working on a SBC + analog voltage output Phidgets setup to control a set of high voltage sources. The Phidgets supply a control voltage. If the control voltage goes down, so does the HV, which has numerous bad effects. I have it basically working with a program on the SBC that starts on boot and stays running, but every now and then the analog outputs detach, which is bad. It would be a lot better if the analog outputs could be set and detached and would maintain their setting.


Return to “General”

Who is online

Users browsing this forum: No registered users and 4 guests