Hello again!
I was wondering about, whether it is possible to implement an interval to update the state of the switches? I also switch these devices by an backup-script and it would be nice, when pimatic would notice this.
Thanks in advance!
[Implemented] plugin sispmctl update interval
Hello again!
I was wondering about, whether it is possible to implement an interval to update the state of the switches? I also switch these devices by an backup-script and it would be nice, when pimatic would notice this.
Thanks in advance!
@techbarney According to the sispmctl documentation it is generally possible (the plugin uses sispmctl internally)
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig good to hear! The best part is that you can change the location of the sispmctl binary. At the moment my pimatic communicate over ssh with the sispmctl host.
Are there any easy ways to implement this feature? maybe that I can have a look at it? I don’t feel so comfortable with coffeescript, but maybe I can change my mind!
@techbarney See PR #1. It may take a few days before a new release will be published. Feel free to trial the code from my fork.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig great! thank you! I will try it, when I’m home again!
@techbarney You’re welcome! Please note the interval
is given is milliseconds.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig I’m sorry, but at the moment it doesn’t work.
I have setup the config with “interval”: 10000, but it doesn’t recognize the changed state
@techbarney said:
sorry, but at the moment it doesn’t work.
I have setup the config with “interval”: 10000, but it doesn’t recognize the changed stat
Note, the interval property must be provided as part of the device configuration!
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig my device configuration looks like:
{
"plugin": "sispmctl",
"binary": "ssh admin@192.168.10.11 /share/MD0_DATA/.qpkg/Qnapware/opt/bin/sispmctl",
"interval": 10000
},
Switching works perfect, but no change is noticed.
@techbarney said:
ssh admin@192.168.10.11 /share/MD0_DATA/.qpkg/Qnapware/opt/bin/sispmctl
Do you get some error message in the log like "SispmctlSwitch: unknown state= … "? As the plugin needs to read the output of the sispmctl command to get the state it may be that the ssh command creates some output causing an error.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig Switching is no problem and so i think that the binary should not be the problem, but I’m not sure… At the moment I get no error message.
When the NAS-Server was not reachable, I got a error message.
I was looking at the other plugins and was thinking about, what the @emit stands for?
@techbarney said:
Switching is no problem and so i think that the binary should not be the problem
Well, for switching, the plugin does not need to read the output of the command.
Please try to execute the following from the command line. The only thing you should get as output is 1 or 0.
ssh admin@192.168.10.11 /share/MD0_DATA/.qpkg/Qnapware/opt/bin/sispmctl -q -n -g 1 -d 0
EDIT:
I was looking at the other plugins and was thinking about, what the @emit stands for?
@emit is to trigger an event on the device instance. It is used to notify a state changes which will be processed by pimatic. The plugin uses the @_setState method implemented in the base class. This method will trigger the event also.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig so in the morning I take my old RasPi for testing this locally. So now I can use the default binary and everything works. After that I switch back to the QNAP-Server and everything works…
I think, I have to apologize. It was my bad in the config, interval in the wrong section… But thanks for all your help and coding! Sometimes it is better to sit down for a moment and think about the problem calmly
@techbarney No worries. It’s great to hear it is working fine for you
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law