seanrees / prometheus-dyson

Prometheus client for DysonLink fans (Pure Hot+Cool)
MIT License
13 stars 9 forks source link

--create_device_cache doesn't facilitate startup. #12

Closed burnsjake closed 3 years ago

burnsjake commented 3 years ago

I did both the basel build and the debian package build. The builds seemed to complete without error. I installed the debian package, I also installed python3-zeroconf, and installed prometheus_client and libdyson via pip. I cannot start the application no matter the contents of the /etc/prometheus-dyson/ directory. I have tried removing all files, I have also tried a minimal config.ini with just the IP and serial number. I've also tried with the config.ini in a different location and that has not helped. This is what I see whenever I try to start:

/opt/prometheus-dyson/bin/main --create_device_cache 2021/03/29 20:09:16 [140529554765632] INFO Starting up on port=8091 2021/03/29 20:09:16 [140529554765632] INFO Reading "config.ini" 2021/03/29 20:09:16 [140529554765632] CRITICAL No devices configured; please re-run this program with --create_device_cache.

seanrees commented 3 years ago

Hey there, thanks for the bug. This is fixed this in commit 037a9fb and I released v0.2.1 with the fix included. Can you let me know if it works for you?

The underlying cause was ordering; the startup code checked & errored on no-devices configured before it went to check if --create_device_cache was supplied. In effect, --create_device_cache would never have worked (oops!).

seanrees commented 3 years ago

Going to close this out as I think this is fixed, please feel free to reopen if you're still having trouble :)

burnsjake commented 3 years ago

That did fix it!

There is another minor issue. The serial number is missing from the output of running --create_device_cache. Pasting the output into the config.ini causes it to puke. I had to enter a serial line in the device section and it worked.

Thanks!

seanrees commented 3 years ago

Thanks for letting me know :) I'll take a look this weekend, that should be simple to fix.

Really though, the config gen process is pretty janky. If I'm feeling particularly motivated this weekend, I may replace it with a config generator. :)

seanrees commented 3 years ago

FYI, I released version 0.3.0 today that now features a config_builder (which is substantially less janky than the old way). Thanks for motivating me to get to it!