Closed dkozinn closed 2 years ago
Looking into this now. Thank you for the detailed issue report.
Are you trying to trigger a pattern already stored in Blink1Control2 (like say policecar
) or specifying a new pattern (like bob
in patterns.md)?
If the pattern already exists, then your URL should return pattern:policecar
(or {"pattern":"policecar"}
if in parse JSON mode)
I failed to mention that the initial trigger to turn on that pattern works, it's only the "turn off" that doesn't work.
I've set up (on another system) two files that demonstrate what I'm trying to do:
Start blinking: https://kozinn.com/blink-reboot - This works as expected Stop blinking: https://kozinn.com/blink-off - This doesn't work
Pattern reboot exists:
On the actual system where I'm using this, I write to the same file (just one trigger) which is what I presented in my initial post.
I hope that makes it a little more clear.
Hi David,
I see the error now and it is definitely a bug that ~pattern-stop
triggers. I have a fix I'm testing that will address this.
Until a new release is out (in a few days), two possible workarounds for you, depending on which approach you prefer:
~off
instead to turn off all patterns and make the blink(1) go dark. id
property in your blink1control2-config.json
file to match its name. That is, in your config file, you should see something that looks like:
"patterns": [
{
"name": "reboot",
"id": "pattern3",
"pattern": "0,#55ff00,0.2,0,#000000,0.2,0"
},
Change the id
so it matches name
, in this example:
"patterns": [
{
"name": "reboot",
"id": "reboot",
"pattern": "0,#55ff00,0.2,0,#000000,0.2,0"
},
btw, if you want a faster way to test this, you can also use the built-in HTTP REST API server in Blink1Control2. The equivalent commands using that would look like:
curl 'http://localhost:8934/blink1/pattern/play?name=~pattern-play:reboot'
curl 'http://localhost:8934/blink1/pattern/play?name=~pattern-stop:reboot'
curl 'http://localhost:8934/blink1/pattern/play?name=~off'
I changed the pattern in the config file so that it now looks like this:
{
"name": "reboot",
"id": "reboot",
"pattern": "0,#ffff00,0.5,0,#000000,0.5,0",
"locked": false
}
It seems to be working both via curl and URL fetch, although I had to change the pattern I was using in the URL fetch to pattern:~pattern-stop:reboot
rather than ~pattern-stop:reboot
which I had been using. The documentation was a little unclear about this, sorry if I misinterpreted.
The only other thing would be that I guess it's hit or miss as to when the stop
gets processed as to whether the LED remains lit or not, I guess that makes sense.
The problem with setting the URL to ~off
is that I have a number of different things monitored, and by having the URL always return ~off
except when a reboot is needed it would just turn off anything else set.
At this point I've got your workaround in place so thanks for the help.
I have a configuration in Blink1Control2 that monitors a test file on a server using a URL. The system will set that file to a specific pattern if a reboot is required (pattern: reboot). As per patterns.md, I'm trying to turn that pattern off at all other times. (It's set to repeat forever, so I need to explicitly turn it off). I've tried ~pattern-stop:reboot and even ~off but Blink1Control2 reports "no pattern" for these. Am I doing something wrong or is this a bug?
Here's the section of the configuration for that: