EverythingSmartHome / everything-presence-one

Official Repo for the Everything Presence One sensor!
400 stars 71 forks source link

No connection after upgrade to 1.2.5 stable #207

Closed atle-dahlman closed 2 weeks ago

atle-dahlman commented 1 month ago

Just upgraded Everything Presence One to 1.2.5 stable. Now it won't connect to Home Assistant.

Log shows:

INFO Reading configuration /config/esphome/everything-presence-one-xxxxxx.yaml... INFO Starting log output from 192.168.1.48 using esphome API INFO Successfully connected to everything-presence-one-xxxxxx @ 192.168.1.48 in 0.107s WARNING everything-presence-one-xxxxxx @ 192.168.1.48: Connection error occurred: everything-presence-one-xxxxxx @ 192.168.1.48: The connection dropped immediately after encrypted hello; Try enabling encryption on the device or turning off encryption on the client (ESPHome Logs 2024.7.1).

dannytsang commented 1 month ago

I'm also noticing the same but unable to get any logs.

EverythingSmartHome commented 1 month ago

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense.

You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

BenHolmes commented 1 month ago

Same here!

I removed my ota encryption line then installed yaml w/o that line. Once that was installed I added back the encryption line into my yaml config and installed.

This reverted the version and got all my sensors back to how they were in home assistant before attempting the update.

BenHolmes commented 1 month ago

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense.

You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

Is there no way to update without re-flashing and losing the existing device/ device data in home assistant?

EverythingSmartHome commented 1 month ago

If you update via your own ESPHome add-on, you won't lose any device entities or history?

BenHolmes commented 1 month ago

The ESPHome add-on does not have any updates available at this time. ESPHome add-on dash image vs Home assistant update prompt image image

EverythingSmartHome commented 1 month ago

Yes but if your config is standard, installing it like this will pull down the latest info from the GitHub anyways and compile it on your local system - the end result is the same, it just takes longer to do

atle-dahlman commented 1 month ago

Tried to reflash without the encryption key. Still no go: Here is my YAML code.

`substitutions: name: everything-presence-one-xxxxxx friendly_name: EPO-gangen packages: Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name}

api:

wifi: ssid: !secret wifi_ssid password: !secret wifi_password `

EverythingSmartHome commented 1 month ago

Can you provide logs of the attempt?

BenHolmes commented 1 month ago

Sorry! I might be mis-understanding but the issue seems to be happening by installing via the ESPHome add-on as well as via Home assistant update entity.

Grabbing logs.

BenHolmes commented 1 month ago

Tried to reflash without the encryption key. Still no go: Here is my YAML code.

`substitutions: name: everything-presence-one-xxxxxx friendly_name: EPO-gangen packages: Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name}

api:

wifi: ssid: !secret wifi_ssid password: !secret wifi_password `

I removed API completely in order to get it back online before installing the current version again.

atle-dahlman commented 1 month ago

Tried again. Here are the log:

`INFO ESPHome 2024.7.1 INFO Reading configuration /config/esphome/everything-presence-one-xxxxxx.yaml... INFO Generating C++ source... INFO Compiling app... Processing everything-presence-one-xxxxxx (board: esp32dev; framework: espidf; platform: platformio/espressif32@5.4.0)

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

INFO Upload took 3.60 seconds, waiting for result... INFO OTA successful INFO Successfully uploaded program. INFO Starting log output from 192.168.1.48 using esphome API INFO Successfully connected to everything-presence-one-xxxxxx @ 192.168.1.48 in 5.163s INFO Successful handshake with everything-presence-one-xxxxxx @ 192.168.1.48 in 0.886s`

BenHolmes commented 1 month ago

Logs on a compilation that doesn't push update but doesn't cause the encryption issue. logs_everything-presence-beta-708010_run.txt logs_everything-presence-one-6e94fc_run.txt Just on a few devices, can grab all if necessary.

EverythingSmartHome commented 1 month ago

@atle-dahlman everything looks great there?

atle-dahlman commented 1 month ago

Tried to reflash without the encryption key. Still no go: Here is my YAML code. substitutions: name: everything-presence-one-xxxxxx friendly_name: EPO-gangen packages: Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name} api: wifi: ssid: !secret wifi_ssid password: !secret wifi_password

I removed API completely in order to get it back online before installing the current version again.

Tried that too. Still no go.

`INFO ESPHome 2024.7.1 INFO Reading configuration /config/esphome/everything-presence-one-xxxxxx.yaml... INFO Generating C++ source... INFO Compiling app... Processing everything-presence-one-62a3c4 (board: esp32dev; framework: espidf; platform: platformio/espressif32@5.4.0)

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

INFO Upload took 3.54 seconds, waiting for result... INFO OTA successful INFO Successfully uploaded program. INFO Starting log output from 192.168.1.48 using esphome API INFO Successfully connected to everything-presence-one-xxxxxx @ 192.168.1.48 in 5.215s INFO Successful handshake with everything-presence-one-xxxxxx @ 192.168.1.48 in 0.666s`

EverythingSmartHome commented 1 month ago

@BenHolmes also looks good

EverythingSmartHome commented 1 month ago

@atle-dahlman sorry I'm not sure what your issue is, as your logs show it uploading and completing 100% successfully

atle-dahlman commented 1 month ago

Looks like everything is fine according the logs, but all sensors are offline:

INFO ESPHome 2024.7.1 INFO Reading configuration /config/esphome/everything-presence-one-xxxxxx.yaml... INFO Starting log output from 192.168.1.48 using esphome API INFO Successfully connected to everything-presence-one-xxxxxx @ 192.168.1.48 in 0.049s INFO Successful handshake with everything-presence-one-xxxxxx @ 192.168.1.48 in 0.013s

EverythingSmartHome commented 1 month ago

That's because you remove the API key BEFORE flashing. If you remove the API key and flash, that means the EP1 is now flashed with no encryption key, while home assistant is still trying to contact it using the encryption key.

The only option now would be to either add the key back if you happened to take a note of it and flash again, or delete and re-add to home assistant without the key

BenHolmes commented 1 month ago

@BenHolmes also looks good

Yeah device is fine now that I corrected the encryption. However the update is not applying when compiling from GitHub but perhaps I mis-understood and this is not currently on the standard config?

BenHolmes commented 1 month ago

Ran install via ESPHome add-on and updates are still available.

image

atle-dahlman commented 1 month ago

Ok. Deleted the device and re-added. Working now.

dannytsang commented 1 month ago

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense.

You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

This fixed it for me. Remove the encryption key and install via USB.

BenHolmes commented 1 month ago

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense. You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

This fixed it for me. Remove the encryption key and install via USB.

When you installed via USB did you get the latest 1.2.5? trying to avoid taking them down from the wall

atle-dahlman commented 1 month ago

I flashed the device completely without the api section. Deleted the device and re-added. The device came back with same name on device and all sensors, AND it says it's running on 1.2.5. I'm happy now.

BenHolmes commented 1 month ago

I flashed the device completely without the api section. Deleted the device and re-added. The device came back with same name on device and all sensors, AND it says it's running on 1.2.5. I'm happy now.

When you re-added do you have the api section with encryption? and did you re-add via home assistant auto discovery?

EverythingSmartHome commented 1 month ago

It's likely your ESPHome is caching, you can try and temporarily switch to another release by changing this line (for example, I'm not sure which version you are on):

  EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-one/everything-presence-one-ble.yaml@main

To

  EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-one/everything-presence-one.yaml@main

Save, install and just do manual download (to force a recompile but without actually installing it to the device. Then change it back and repeat but install over wireless

atle-dahlman commented 1 month ago

I flashed the device completely without the api section. Deleted the device and re-added. The device came back with same name on device and all sensors, AND it says it's running on 1.2.5. I'm happy now.

When you re-added do you have the api section with encryption?

Nope. The entire api section is gone.

This is my config now:

`substitutions: name: everything-presence-one-xxxxxx friendly_name: EPO-gangen packages: Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name}

wifi: ssid: !secret wifi_ssid password: !secret wifi_password`

BenHolmes commented 1 month ago

I flashed the device completely without the api section. Deleted the device and re-added. The device came back with same name on device and all sensors, AND it says it's running on 1.2.5. I'm happy now.

When you re-added do you have the api section with encryption?

Nope. The entire api section is gone.

So does that mean your device is now un-encrypted?

dannytsang commented 1 month ago

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense. You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

This fixed it for me. Remove the encryption key and install via USB.

When you installed via USB did you get the latest 1.2.5? trying to avoid taking them down from the wall

Yes with 1.2.5. I got the update notice and cleaned the build file to make sure it pulled down the latest version.

EverythingSmartHome commented 1 month ago

Yes hitting the clean build files button first is another way to clear cache as opposed to switching releases

atle-dahlman commented 1 month ago

I flashed the device completely without the api section. Deleted the device and re-added. The device came back with same name on device and all sensors, AND it says it's running on 1.2.5. I'm happy now.

When you re-added do you have the api section with encryption?

Nope. The entire api section is gone.

So does that mean your device is now un-encrypted?

Most likely. Don't know how to find the encryption key. Maybe by taking it down from the wall and connecting to a computer via USB?

BenHolmes commented 1 month ago
substitutions:
  name: everything-presence-one-6db96c
  friendly_name: Everything Presence One 6db96c
packages:
  Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

api:
  encryption:
    key: 

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

Attempting to resolve caching and did a clean build and still didn't get 1.2.5 perhaps I am not pulling the proper version.

BenHolmes commented 1 month ago

I flashed the device completely without the api section. Deleted the device and re-added. The device came back with same name on device and all sensors, AND it says it's running on 1.2.5. I'm happy now.

When you re-added do you have the api section with encryption?

Nope. The entire api section is gone.

So does that mean your device is now un-encrypted?

Most likely. Don't know how to find the encryption key. Maybe by taking it down from the wall and connecting to a computer via USB?

Yeah trying to avoid that, maybe I'll just run un-encrypted :/

EverythingSmartHome commented 1 month ago

You have a double "@main" at the end of the package line. Not sure if that is causing issues

BenHolmes commented 1 month ago

You have a double "@main" at the end of the package line. Not sure if that is causing issues

Not a problem, just added because I saw that in your example.

It's likely your ESPHome is caching, you can try and temporarily switch to another release by changing this line (for example, I'm not sure which version you are on):

  EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-one/everything-presence-one-ble.yaml@main

To

  EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-one/everything-presence-one.yaml@main@main

Save, install and just do manual download (to force a recompile but without actually installing it to the device. Then change it back and repeat but install over wireless

EverythingSmartHome commented 1 month ago

My bad, edited it now

BenHolmes commented 1 month ago

My bad, edited it now

No worries! it's the same result either way for me. I'll try a couple more restarts and clean builds.

BenHolmes commented 1 month ago

My bad, edited it now

No worries! it's the same result either way for me. I'll try a couple more restarts and clean builds.

It doesn't look like a caching issue for me; I have cleared, clean build, restarted, and referenced different builds and still cannot get 1.2.5 without removing the api section. Is this by design and I simply missing the context?

EverythingSmartHome commented 1 month ago

Can you try and change the packages section to this:

packages:
  EverythingSmartTechnology.Everything_Presence_One:
    url: https://github.com/everythingsmarthome/everything-presence-one
    files: everything-presence-one-sen0609.yaml
    ref: main
    refresh: 0s
Ocramius commented 1 month ago

FWIW, reached similar unresponsive EP1 state today, but didn't notice it because I use it to control lights only once it's dark:

EP1 going dark

My ESPHome config, roughly:

substitutions:
  name: "dining-room-ep1"
packages:
  Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/presence-one/everything-presence-one.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
api:
  encryption:
    key: <SNIP>

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

logger:

Also used the HA upgrade UI under /config/updates.

I'll try re-flashing it with 1.2.5 and this config tomorrow: worked fine with 1.2.4 and previous upgrades done via ESPHome UI or HA /config/updates.

EverythingSmartHome commented 1 month ago

FWIW, reached similar unresponsive EP1 state today, but didn't notice it because I use it to control lights only once it's dark:

EP1 going dark

My ESPHome config, roughly:

substitutions:
  name: "dining-room-ep1"
packages:
  Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/presence-one/everything-presence-one.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
api:
  encryption:
    key: <SNIP>

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

logger:

Also used the HA upgrade UI under /config/updates.

I'll try re-flashing it with 1.2.5 and this config tomorrow: worked fine with 1.2.4 and previous upgrades done via ESPHome UI or HA /config/updates.

In this case, I would not advise you to use the new update firmware since you have a non standard config, which will overwrite your local changes. Stick to the ESPHome method of updating

Ocramius commented 1 month ago

since you have a non standard config

This is what was created by ESPHome on adoption ( a year ago): I added logger:, but that's it.

Should I roll that back? Or is this default generated config already out of the standard approach/setup? 🤔

BenHolmes commented 1 month ago

Can you try and change the packages section to this:

packages:
  EverythingSmartTechnology.Everything_Presence_One:
    url: https://github.com/everythingsmarthome/everything-presence-one
    files: everything-presence-one-sen0609.yaml
    ref: main
    refresh: 0s

Solved it! This is the best solution! Thank you so much for your help!! 😄

Carphone12 commented 1 month ago

I have always updated my EP1 when prompted by Home assistant - after today’s update it is flashing red. Reading the comments above seems removing and reflashing will resolve.

Question - why has this update knocked it out vs all previous updates been fine?

EverythingSmartHome commented 1 month ago

Can you try and change the packages section to this:

packages:
  EverythingSmartTechnology.Everything_Presence_One:
    url: https://github.com/everythingsmarthome/everything-presence-one
    files: everything-presence-one-sen0609.yaml
    ref: main
    refresh: 0s

Solved it! This is the best solution! Thank you so much for your help!! 😄

Make sure and revert that back to the way it was, as leaving it will cause a performance hit to your system - should be good to put back to standard now

BenHolmes commented 1 month ago

Can you try and change the packages section to this:

packages:
  EverythingSmartTechnology.Everything_Presence_One:
    url: https://github.com/everythingsmarthome/everything-presence-one
    files: everything-presence-one-sen0609.yaml
    ref: main
    refresh: 0s

Solved it! This is the best solution! Thank you so much for your help!! 😄

Make sure and revert that back to the way it was, as leaving it will cause a performance hit to your system - should be good to put back to standard now

Ah gotcha! Will do! 😄👍

EverythingSmartHome commented 1 month ago

I have always updated my EP1 when prompted by Home assistant - after today’s update it is flashing red. Reading the comments above seems removing and reflashing will resolve.

Question - why has this update knocked it out vs all previous updates been fine?

It's not the update per say. The update itself is perfectly fine.

I posted the reason above in one of the first messages here:

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense.

You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

The reason is essentially if you've added it to the ESPHome add-on and added an encryption key to your setup which isn't on by default.

BenHolmes commented 1 month ago

Can you try and change the packages section to this:

packages:
  EverythingSmartTechnology.Everything_Presence_One:
    url: https://github.com/everythingsmarthome/everything-presence-one
    files: everything-presence-one-sen0609.yaml
    ref: main
    refresh: 0s

Solved it! This is the best solution! Thank you so much for your help!! 😄

Make sure and revert that back to the way it was, as leaving it will cause a performance hit to your system - should be good to put back to standard now

So interesting... after getting updated to 1.2.5 switching the line from

packages:
  EverythingSmartTechnology.Everything_Presence_One:
    url: https://github.com/everythingsmarthome/everything-presence-one
    files: everything-presence-one-sen0609.yaml
    ref: main
    refresh: 0s

to

packages:
  Everything_Smart_Technology.Everything_Presence_One: github://everythingsmarthome/everything-presence-one/everything-presence-one-sen0609.yaml@main

reverts the version back from 1.2.5 to 1.2.4. Despite it supposedly being the same package.

Carphone12 commented 1 month ago

I have always updated my EP1 when prompted by Home assistant - after today’s update it is flashing red. Reading the comments above seems removing and reflashing will resolve. Question - why has this update knocked it out vs all previous updates been fine?

It's not the update per say. The update itself is perfectly fine.

I posted the reason above in one of the first messages here:

This isn't an issue with the update, I'm guessing you upgraded via the entity in Home Assistant? The reason this occurs is because you have an encryption key configured in the ESPHome add-on, which gets overwritten when you update directly from GitHub. Home Assistant is then trying to communicate with the device using the encryption key which it's no longer configured for. Hopefully that makes sense.

You can either flash using the ESPHome add-on again over wireless, or delete from HA and re-add it without the encryption key. Home Assistant may even prompt you to reconfigure without the key. If you do this then make sure to remove the key from your ESPHome addon

The reason is essentially if you've added it to the ESPHome add-on and added an encryption key to your setup which isn't on by default.

Thanks - all fixed now. I just removed from HA, restarted and added again when auto detected. I did not need to reflash or do anything with my encryption key.

Back in business - thanks very much