Git Product home page Git Product logo

Comments (9)

paul-1 avatar paul-1 commented on August 17, 2024

What is in your script. It does not appear to handle the initialization command properly.

from squeezelite.

adamcstephens avatar adamcstephens commented on August 17, 2024
#!/nix/store/4vzal97iq3dmrgycj8r0gflrh51p8w1s-bash-5.2p26/bin/bash

case $1 in
  0)
    power=down
    ;;
  1)
    power=up
    ;;
  2)
    # silently drop
    exit 0
    ;;
  *)
    echo "Unsupported arg: $@"
    exit 1
    ;;
esac

/nix/store/zfrpn9bq8z3xaxwqrz0vcb91mfbdhkss-minidsp-0.1.10-pre/bin/minidsp --daemon-url http://127.0.0.1:5380 status
case $? in
  0)
    minidsp=up
    ;;
  1)
    minidsp=down
    ;;
esac

echo "minidsp=$minidsp,squeezelite=$power"
if [ $minidsp != $power ]; then
  out=`/nix/store/dzs2chgxcwzpwplcw6wvv8nzkn01yr7y-curl-8.6.0-bin/bin/curl -X POST localhost:3000/api/v1/miniDSP/KEY_SLEEP -d power`
  echo "toggled minidsp power: $out"
else
  echo "minidsp already in desired state"
fi

from squeezelite.

adamcstephens avatar adamcstephens commented on August 17, 2024

is the initialization command 2 ? because that's seemingly sent before either on or off.

from squeezelite.

paul-1 avatar paul-1 commented on August 17, 2024

from squeezelite.

adamcstephens avatar adamcstephens commented on August 17, 2024

It actually does now (2 handled with exit 0). The log above did not handle that cleanly, but it makes no difference. squeezelite still sends 0/1/0 which leaves the system powered on (as it can't respond that quickly).

from squeezelite.

paul-1 avatar paul-1 commented on August 17, 2024

unfortunately, squeezelite has to initialize, then it has to get a status from LMS, which is why it toggles.

While it happens fast, squeezelite waits for the script to exit before doing anything. You can add a very small amount of delay to your script, but that can create other squeezelite problems. Why can the daemon not respond to a command sequence?

from squeezelite.

adamcstephens avatar adamcstephens commented on August 17, 2024

Why can the daemon not respond to a command sequence?

I'm actually triggering state changes through lirc to send a remote command. It then takes the device a couple seconds to transition itself.

from squeezelite.

adamcstephens avatar adamcstephens commented on August 17, 2024

Would it make sense for squeezelite to wait until after it has communicated with LMS before running the script (or triggering the GPIO assuming it's the same case)?

from squeezelite.

986ster avatar 986ster commented on August 17, 2024

That would be a good solution. Also, there's an issue where if you use the -C option then it's power-cycling based on the device open status rather than the state of the LMS player power button (issue #205), and it would be great to be able to deal with that ar the same time.

from squeezelite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.