Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Control from iOS shortcut application #16

Open
mcnahum opened this issue May 13, 2020 · 3 comments
Open

Control from iOS shortcut application #16

mcnahum opened this issue May 13, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@mcnahum
Copy link

mcnahum commented May 13, 2020

Hi,
I'm trying to control blynclight from my iphone with iOS Shortcut Application.

if I run from my Pi on SSH: "/home/pi/.local/bin/blync -r 255 -n -D 3600 &" it's working perfectly
if I run the same command from the "Run script over SSH" from the iOS shortcut application, it's working and the light turn red but ... the action does not terminate and stay running...
if I manually stop it ... all it's ok ... but I should not have to do it... any idea?

@JnyJny
Copy link
Owner

JnyJny commented May 13, 2020

I haven't used iOS shortcuts, so my guess is the following:

  • the command ends in an amperand & which directs the shell to run a process in the background
  • the iOS "Run script over SSH" probably strips the ampersand from the command (I would)
  • The command will run for 3600 seconds and then return, at which point the iOS action will terminate as you might expect.

When the blynclight package finishes a "session" using the light, by default it turns the light off and zeros all the various color values and feature switches. This is to avoid weird behavior when the light is activated again (flashing, bleeps and bloops that the user didn't initiate).

One way to fix the iOS problem is to allow blync to return and leave the light in it's currently configured state (on, shining red). This will lose the ability to run for an interval and then turn off. I guess you could have another action that turns the light off explicitly? Not sure.

Another way to get the desired behavior (iOS action terminates normally, light stays lit red for 1 hour and then turns off) would be to add a 'daemon' switch that would run the command in the background (without requiring the ampersand). The command would run in the background and turn off after an hour while allow the iOS action complete as expected.

@mcnahum
Copy link
Author

mcnahum commented May 13, 2020

I tired a lot of options, including a simple "/home/pi/.local/bin/blync -r 255" or even "/home/pi/.local/bin/rainbow" and it's the same... really strange ... I also tried to embed the command in a shell script but it's the same...

"/home/pi/.local/bin/blync -a" is working correctly and give the proper output

So yes a daemon could be a solution, it start and run for 1 hour ( or the parameter I could pass) ... I will have to look this week-end how I can do

@JnyJny JnyJny added the enhancement New feature or request label May 14, 2020
@JnyJny JnyJny self-assigned this May 14, 2020
@JnyJny
Copy link
Owner

JnyJny commented Jun 20, 2020

The latest version (0.7.1) has an updated driver script that may do some of what you are looking for; now when the blync tool exits, it DOES NOT clear the state of the light (turning it off and zeroing all the commands issued while the script was running). So maybe now you can get some of the features to work via the iOS Shortcut application:

$ ssh <yourhost> blync  # will turn the light on with a green color and the light stays on.
$ ssh <yourhost> blync --off. # turns the light off

Effects that constantly update the state of the light will continue to disappoint I think; e.g. fli, throbber and rainbow.

Having those sorts of effects persist after a script runs will probably need a client/server architecture that sounds like fun to write, but I don't have plans to do it soon. I hope some of this helps.

Edit:

Created an iOS ssh shortcut that worked. After installing blynclight, had to use the full path to blync in order for it to work: /usr/local/bin/blync in my case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants