bessarabov/mac2mqtt

Fix the situation when there is no volume info

bessarabov opened this issue · 2 comments

Another bump into this one.

I have a "logical" audio board, composed by the juntcion of several audios that it is in my interested to be chosen instead of the normal iMac audio output.

Running the command

/usr/bin/osascript -e 'get volume settings'

When the "normal" output is selected gives:

output volume:44, input volume:100, alert volume:100, output muted:false

When this other output is selected gives:

output volume:missing value, input volume:100, alert volume:100, output muted:missing value

So what happens when this locial output is chosen, it crashes the program:

<-user->@<-computer-> mac2mqtt % ./mac2mqtt
2022/11/22 10:23:05 Started
2022/11/22 10:23:05 Connected to MQTT
2022/11/22 10:23:05 Sending 'true' to topic: mac2mqtt/<-computer->/status/alive
2022/11/22 10:23:07 strconv.Atoi: parsing "missing value": invalid syntax

As there is no value, it cannot be converted.
It is the same problem as described.

What can it be done to avoid this?
I don't need the volume information or control, I just want to shutdown remotely the Mac.

Thank you for your help.

I also have the same error on my Mac mini M1, did you find a solution?