hifiberry / hifiberry-os

Linux distribution optimized for audio playback
MIT License
1.01k stars 128 forks source link

API/Interact - "Power" action is mising #265

Closed kongsted closed 2 years ago

kongsted commented 3 years ago

Describe the bug The option to add the action for controling the power (shutdown / restart) is missing in the latest stable release.

HiFiBerryOS version 20210408 - is missing the option 20210203 - are having the option

HiFiBerry sound card The system-info says "DAC+/Amp2", but I don't have amplifier on my hifiberry. :/ It is "only" a "DAC+ Standard".

To Reproduce Steps to reproduce the behavior:

  1. Open the webinterface
  2. Click "Interact"
  3. Click "New Interaction"
  4. Click "Add Action"
  5. Power is available in the old version - in the latest version "Power" isn't available

Expected behavior Expected to have the option available :) If calling the API/URL on the latest version it still answer "200 OK" even though it isn't going well. (The version 20210203 is also answering "200 OK" even though it's an invalid API there's called)

Screenshots From the latest version: image

From version 20210203 image

Additional context Using Firefox normally - have also tested in Edge Chromium

hifiberry commented 3 years ago

Strange. I don't see this here with the latest version, but nothing has been changed with this. Try the latest experimental release

/opt/hifiberry/bin/update --experimental

kongsted commented 3 years ago

It was there after I updated it some weeks ago with the example above (to version 20210520). Now on version 20210531 it's gone again.... :/

reisschuessel commented 3 years ago

I would also appreciate it very much if the "power" action would come back. I am also using 20210531.

hifiberry commented 3 years ago

It will ;-) This was a bug while refactoring some stuff in the UI. You can either wait for the next release or try the new experimental release: /opt/hifiberry/bin/upgrade --experimental

hifiberry commented 3 years ago

Did you test the experimental release?

reisschuessel commented 3 years ago

Did you test the experimental release?

Sorry, no i did not. I will wait untill the next regular release with this option.

reisschuessel commented 3 years ago

I updated to the latest official release and the "Power" option is available (sort of). But when selected i can not save the interaction. Either Web Request or Serial Message have this issue.

HiFiBerryOS version 20210804 I tested on two different HiFiBerry Systems with this release.

To Reproduce Steps to reproduce the behavior:

Open the webinterface
Click "Interact"
Click "New Interaction"
Click "Add Action"
Click "Power"
Click "Shut Down Raspberry Pi'"
Click "Save Action"

Expected behavior Expected to have the action to show up under "DO" and have the button "Save Interaction" available. As it is now the action is not shown. Using e.g. one of the "Set Volume" actions it works as intended.

reisschuessel commented 2 years ago

Still not available/working in latest 20211105 release.

StephenBeirlaen commented 2 years ago

Also having this problem on 20211105. I've already tried setting another trigger action, and then fiddling with /etc/beocreate/interact.json but couldn't find the right values unfortunately.

StephenBeirlaen commented 2 years ago

Never mind, I found the expected values by looking at the serverside. You can bypass the bug by editing /etc/beocreate/interact.json:

{"name":"Turn off HTTP","triggerData":{"addressEnd":"turn-off"},"actions":[{"extension":"general-settings","type":"power","data":{"option":"shutdown"}}],"triggerExtension":"interact","triggerType":"httpAPI"}

astremtan commented 2 years ago

I know this is old but I still have this issue with my hifiberry on 20211105. In case anyone is looking, the expected value for restarting is {"option":"restart"}. After editing the interact.json file, a manual restart is required for changes to take effect.

hifiberry commented 2 years ago

This has been fixed in 20220726