geerlingguy / airgradient-prometheus

AirGradient Prometheus exporter.
MIT License
176 stars 59 forks source link

ESPHome configurations should use api.encryption.key instead of api.password #38

Closed geerlingguy closed 1 year ago

geerlingguy commented 1 year ago

Currently the ESPHome configurations use:

api:
  password: !secret api_password

But according to the API Component parameter documentation, that value is deprecated in favor of api.encryption.key.

So it should be updated to something like:

api:
  encryption:
    key: !secret api_encryption_key

And then in the secrets.yaml file example in the README:

# Encryption key for HA API access.
# Generate a random 32-bit key with `openssl rand -base64 32`
api_encryption_key: BASE64_KEY_HERE

# Set password for OTA updates.
ota_password: otapassword
geerlingguy commented 1 year ago

I had a little trouble testing my early DIY Pro kit, I had to unseat the D1 Mini from the board to flash it. But now that I did, I'm getting an invalid reading from the SenseAir sensor:

[W][senseair:030]: Invalid preamble from SenseAir! ffffff79 ebef79a5 ad2b5555 91
...
[E][uart:015]: Reading from UART timed out at byte 0!
[W][senseair:024]: Reading data from SenseAir failed!

All the other sensors are working great, and on my unit at least, I didn't need the rotation: 180 for the display...

geerlingguy commented 1 year ago

I've been reading through Invalid preamble from SenseAir and found a few people mentioning the power supply could be the issue.

I'm plugged into a USB extension cable from a USB-A port on a USB hub (powered) from my Mac, using the long cable the DIY Pro kit came with... so maybe there's enough voltage drop the SenseAir sensor just can't initialize properly. Going to try direct into my USB wall adapter now.

Edit: Still seeing:

W][senseair:030]: Invalid preamble from SenseAir! dba52949 89899181 91919191 81
geerlingguy commented 1 year ago

Touching the SenseAir S8, it seems very hot.

Also, when I first plug in the whole kit, I see a bright flash of the orange LED inside the S8, it blinks once brightly then again very dim (within a few dozen ms), then doesn't light up at all again. (It does the flash immediately on receiving power).

So I'm wondering if I accidentally cooked the thing!

JaiGupta13 commented 5 months ago

@geerlingguy Did you find a solution for the Invalid preamble issue?