bessarabov / mac2mqtt

View and control some aspects of macOS computer via MQTT
MIT License
68 stars 23 forks source link

Program terminating itself after a while, trying to access Dropbox directory #16

Open fmnamado opened 1 year ago

fmnamado commented 1 year ago

Hello,

I am interested in this software just to shutdown remotely via Home Assistant, but I am running into several problems.

Let's start in the first one.

I edited the files in order to reflect my username, but when mac2mqtt is running, it terminates itself after a while using "bessarabov" absolute username. I thinks this is in the program itself and not in my YAML files. What is it trying to do accessing a Dropbox directory? Have I forget to change somewhere?

Can you please help me?

-user->@<-computer- mac2mqtt % ./mac2mqtt 2022/11/22 09:45:51 Started 2022/11/22 09:45:51 Connected to MQTT 2022/11/22 09:45:51 Sending 'true' to topic: mac2mqtt/<-computer->/status/alive panic: runtime error: index out of range [1] with length 0

goroutine 45 [running]: main.getBatteryChargePercent(0xc00004fef0, 0x1319948) /Users/bessarabov/Dropbox/git/mac2mqtt/mac2mqtt.go:284 +0x115 main.updateBattery(0x137cc20, 0xc000120000) /Users/bessarabov/Dropbox/git/mac2mqtt/mac2mqtt.go:290 +0x85 main.main.func1(0xc0001a6000, 0x137cc20, 0xc000120000, 0xc0001a6050) /Users/bessarabov/Dropbox/git/mac2mqtt/mac2mqtt.go:318 +0xe5 created by main.main /Users/bessarabov/Dropbox/git/mac2mqtt/mac2mqtt.go:310 +0x1d0 -user->@<-computer- mac2mqtt %

callumgare commented 1 year ago

Looks like you're running into this issue https://github.com/bessarabov/mac2mqtt/issues/8. Until https://github.com/bessarabov/mac2mqtt/pull/17 is merged you'll need to build the binary yourself from source with the changes included in theat PR in order to get this to run I'm afraid. If you're game you can follow the process found in https://github.com/bessarabov/mac2mqtt/pull/9.