core icon indicating copy to clipboard operation
core copied to clipboard

deCONZ integration demands recongifuration on each reboot

Open Tjomsen opened this issue 3 years ago • 41 comments

The problem

at some point this spring (february estimate). my deCONZ integration started failing on restart. By failing I mean, I would get a notification that an integration needs to be reconfigured.

I can currently solve the issue manually, but it needs to be done after each reboot:

  1. enter deconz -> phoscon and allow app authentification for 60 seconds or whatever timewindow it is
  2. go to configuration -> integrations and click "reconfigure"
  3. I now get a "integration is already configured" type message. At this point it is still NOT working.
  4. Now I press disable the integration.
  5. Then I re-enable the integration
  6. Then I click the configure button and ok in the pop up
  7. NOW it is working (reliably if steps above are followed).

(yes I came up with this in solution in last-resort-frustration mode. I have tried some variants of the above without success).

I have googled around and read some threads, not found anything directly comparable. If anyone knows how to solve, by all means enlighten me, it not it may well be some bug in the integration happening for some reason.

What version of Home Assistant Core has the issue?

core-2022.4.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

deCONZ

Link to integration documentation on our website

No response

Diagnostics information

config_entry-deconz-2d69584f745cc13c978ac5e26dad046d.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.deconz
Source: components/deconz/gateway.py:286
Integration: deCONZ (documentation, issues)
First occurred: 11:35:34 AM (1 occurrences)
Last logged: 11:35:34 AM

Error connecting to deCONZ gateway at core-decon

Additional information

No response

Tjomsen avatar Apr 27 '22 10:04 Tjomsen

deconz documentation deconz source (message by IssueLinks)

Hey there @kane610, mind taking a look at this issue as it has been labeled with an integration (deconz) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Can you enable debug logging per deconz integration documentation and share logs when you reproduce it all?

Kane610 avatar Apr 29 '22 17:04 Kane610

This appears to be fixed at Deconz 6.12.1 and Home Assistant OS 2022.4.7

craigcarps avatar Apr 30 '22 10:04 craigcarps

I still get this error when running Deconz on another system via DOCKER in Bridge mode. When I put it into host mode with the correct IP being published it works.

Is the HomeAssistant Integration using the phoscon.de/discover to find it?

HA: HAOS on core-2022.5.3

Using the official addon works though. But with the official addon I am unable to pair it to Harmony Hub

2022-05-10 10:31:25 ERROR (MainThread) [homeassistant.components.deconz] Error connecting to deCONZ gateway at core-deconz 2022-05-10 10:31:25 WARNING (MainThread) [homeassistant.config_entries] Config entry '00212E02A29E' for deconz integration not ready yet; Retrying in background 2022-05-10 10:31:25 ERROR (MainThread) [pydeconz.websocket] Websocket is not accessible (core-deconz) 2022-05-10 10:31:34 ERROR (MainThread) [homeassistant.components.deconz] Error connecting to deCONZ gateway at core-deconz

almostserious avatar May 10 '22 08:05 almostserious

The error lists address as core-deconz which is the addon adress. But you're saying that it works so I'm not sure what to make of it

Kane610 avatar May 10 '22 09:05 Kane610

So the error lists the core-deconz as the addon address.. which is the problem. I am running deconz on a different machine and just connected it. This works fine until restart when this issue pops up.

Upon further investigation I believe that is because of the Internal IP Address that Deconz reports to HomeAssistant. With a Docker Setup if the "HOST" mode is NOT specified in the docker container for deconz it reports the Bridge IP where the API will not be available. You can still manually configure it by entering the correct IP. But on restart of Homeassistant it breaks.

If I use the official addon from the HomeAssistant Addons this works just fine. No Issues. But here I cannot connect the Harmony Hub. I assume for similar issue, as the phoscon.de/discover reports only the internal Bridge IP.

almostserious avatar May 10 '22 09:05 almostserious

Sounds really weird. Can you enable debug logging for the integration and share the logs?

Kane610 avatar May 10 '22 15:05 Kane610

Sorry I missed the logging thing! Here is (as far as I can tell) a full restart including then the "reconnecting to deconz". I am now running on version core-2022.5.4, and it does not work with this version either, still seeing the same thing "needs to be reconfigured" on each restart. log deconz troubles restart and reconfiguration.txt

Attaching the log with the debug level logging from deConz turned on: @Kane610 can you make any sense of this?

Tjomsen avatar May 13 '22 09:05 Tjomsen

Sorry, its hard to follow your logs. A lot of errors from other integrations as well.

Can you add annotations to your log on what is happening when and when you're are doing manual things?

Kane610 avatar May 24 '22 19:05 Kane610

I see the same behavior. Installed as a Addon and almost with all restarts, I have to reconfigure the Device. Normally I delete the Integration, restart HomeAssistant add the Intregration again.

splattner avatar Jul 12 '22 09:07 splattner

I see the following error

2022-07-12 11:48:14 WARNING (MainThread) [homeassistant.components.deconz] Invalid key for deCONZ at core-deconz

so somehow, the key always becomes invalid

splattner avatar Jul 12 '22 09:07 splattner

Ok, can you share hass debug logs of it before you set it up and after you've set it up again?

Kane610 avatar Jul 14 '22 14:07 Kane610

I have exactly the same behavior, when i start/restart my host, If you tell me how can I get the proper logs, I could also spend them. (I am running HASSOS in a Virtual Box)

Shamane2000 avatar Aug 29 '22 11:08 Shamane2000

After I reset my gateway, it started doing this issue too. Here are my logs - https://pastebin.com/GkFKicJW

So every after a restart of HA, I always have to go through the following steps to restore connection:

  1. deCONZ > Phoscon > log in
  2. Gateway > Advanced > Authenticate app
  3. Settings > Devices & Services
  4. Reconfigure
  5. Reload deCONZ
  6. Refresh HA tab

deCONZ 6.15.0 Conbee II 2.17.01 / 7/1/2022, Firmware: 26720700 Home Assistant 2022.8.7 Supervisor 2022.08.3 Operating System 8.5 Frontend 20220802.0

VincePimentel avatar Aug 29 '22 14:08 VincePimentel

I have the same problem, and had it for a cuple of months. My ip net is: 192.168.123.x I use Home Assistant OS, with Decons on the same host. Latest version of everything. (and done a few updates since i got the problem)

The Error from the log is: "Error connecting to deCONZ gateway at 172.30.33.3" When i log in to Deconz/Phoscon it says: "LIN-PhosconGW172.30.33.2" in the upper right corner.

So my conclusion is that the IP of the Phoscon Gateway has changed, however.. I do not find any way of changing that. Does anyone know how to do that? That would be a much easyer sollution, and aswell configure some sort of static IP on the Phoscon GW..

taminooo avatar Sep 01 '22 10:09 taminooo

I have the same problem, and had it for a cuple of months. My ip net is: 192.168.123.x I use Home Assistant OS, with Decons on the same host. Latest version of everything. (and done a few updates since i got the problem)

The Error from the log is: "Error connecting to deCONZ gateway at 172.30.33.3" When i log in to Deconz/Phoscon it says: "LIN-PhosconGW172.30.33.2" in the upper right corner.

So my conclusion is that the IP of the Phoscon Gateway has changed, however.. I do not find any way of changing that. Does anyone know how to do that? That would be a much easyer sollution, and aswell configure some sort of static IP on the Phoscon GW..

Are you saying that the address reported from deconz is not the correct one?

Kane610 avatar Sep 01 '22 15:09 Kane610

I have the same problem, and had it for a cuple of months. My ip net is: 192.168.123.x I use Home Assistant OS, with Decons on the same host. Latest version of everything. (and done a few updates since i got the problem) The Error from the log is: "Error connecting to deCONZ gateway at 172.30.33.3" When i log in to Deconz/Phoscon it says: "LIN-PhosconGW172.30.33.2" in the upper right corner. So my conclusion is that the IP of the Phoscon Gateway has changed, however.. I do not find any way of changing that. Does anyone know how to do that? That would be a much easyer sollution, and aswell configure some sort of static IP on the Phoscon GW..

Are you saying that the address reported from deconz is not the correct one?

No. I think it's reporting the correct one. But the integration is configured against an old one.

It's been 172.30.33.3, and has changed in the reboot to 172.30.33.2, but the integrations tries to connect to the OLD ip.

The sollution is probably one of two things, but i haven't figured out how to do niether of them. 1.) Configure an static IP for the gateway that matches the config. (which might be a problem if another addon might get it later on from DHCP (I actually have no idea if its a DHCP or some other magic that decides the internal ips). 2.) Change the configuration for the integration every time it happens.. Not the best way, but simple enough if you can find a setting for it..

taminooo avatar Sep 01 '22 15:09 taminooo

I have the same problem, and had it for a cuple of months. My ip net is: 192.168.123.x I use Home Assistant OS, with Decons on the same host. Latest version of everything. (and done a few updates since i got the problem) The Error from the log is: "Error connecting to deCONZ gateway at 172.30.33.3" When i log in to Deconz/Phoscon it says: "LIN-PhosconGW172.30.33.2" in the upper right corner. So my conclusion is that the IP of the Phoscon Gateway has changed, however.. I do not find any way of changing that. Does anyone know how to do that? That would be a much easyer sollution, and aswell configure some sort of static IP on the Phoscon GW..

Are you saying that the address reported from deconz is not the correct one?

No. I think it's reporting the correct one. But the integration is configured against an old one.

It's been 172.30.33.3, and has changed in the reboot to 172.30.33.2, but the integrations tries to connect to the OLD ip.

The sollution is probably one of two things, but i haven't figured out how to do niether of them. 1.) Configure an static IP for the gateway that matches the config. (which might be a problem if another addon might get it later on from DHCP (I actually have no idea if its a DHCP or some other magic that decides the internal ips). 2.) Change the configuration for the integration every time it happens.. Not the best way, but simple enough if you can find a setting for it..

You're running the add-on right? How did you set it up? From the + button on the integration page or from the discovered add-on?

Kane610 avatar Sep 01 '22 18:09 Kane610

I got the same problem, but I haven't found the ""reconfigure" button so mine is still not working (step 2 and 3 in OP). No workaround working for me, very frustrating. Got this issue few times before but rebooting multiple times fixed it for those reboots, this is not working anymore for me. I reckon the problem is that de deconz container got a different IP than the configurated one but cant find how to change those...

roelerps avatar Sep 08 '22 19:09 roelerps

Same problem here, anyone that can help? Thanks

facco88 avatar Sep 08 '22 22:09 facco88

I have the same problem, and had it for a cuple of months. My ip net is: 192.168.123.x I use Home Assistant OS, with Decons on the same host. Latest version of everything. (and done a few updates since i got the problem) The Error from the log is: "Error connecting to deCONZ gateway at 172.30.33.3" When i log in to Deconz/Phoscon it says: "LIN-PhosconGW172.30.33.2" in the upper right corner. So my conclusion is that the IP of the Phoscon Gateway has changed, however.. I do not find any way of changing that. Does anyone know how to do that? That would be a much easyer sollution, and aswell configure some sort of static IP on the Phoscon GW..

Are you saying that the address reported from deconz is not the correct one?

No. I think it's reporting the correct one. But the integration is configured against an old one. It's been 172.30.33.3, and has changed in the reboot to 172.30.33.2, but the integrations tries to connect to the OLD ip. The sollution is probably one of two things, but i haven't figured out how to do niether of them. 1.) Configure an static IP for the gateway that matches the config. (which might be a problem if another addon might get it later on from DHCP (I actually have no idea if its a DHCP or some other magic that decides the internal ips). 2.) Change the configuration for the integration every time it happens.. Not the best way, but simple enough if you can find a setting for it..

You're running the add-on right? How did you set it up? From the + button on the integration page or from the discovered add-on?

I actually don't remember.. But I think that I used the +button.

taminooo avatar Sep 09 '22 07:09 taminooo

Same problem, integration auto discovered setup to 172.30.33.3, after reboot ip on deconz changed to 172.30.33.4, integration tries to connect to 172.30.33.3, and fails. Has to be removed and added again.

boneheaddancer avatar Sep 12 '22 07:09 boneheaddancer

Is there really no other sollution than removing the addon and adding it again.? What a pain. :(

taminooo avatar Sep 12 '22 08:09 taminooo

I was able to remedy this by accident once, by restoring HA from a backup. After that, the problem disappeared!!! Don't know if it will repeat for others.

On Mon, Sep 12, 2022 at 10:22 AM taminooo @.***> wrote:

Is there really no other sollution than removing the addon and adding it again.? What a pain. :(

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/70874#issuecomment-1243384871, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATLN3QMTOUQAR7QYW6OR5LTV53R4FANCNFSM5UOU2NRQ . You are receiving this because you authored the thread.Message ID: @.***>

Tjomsen avatar Sep 12 '22 09:09 Tjomsen

same problem, i also installed it again and it doesn't fix, what can i do? Please help me

dolam avatar Sep 12 '22 16:09 dolam

It is possible to edit the IP of the Deconz in the file core.config_entries manually. You have to login to your home assistant via ssh (for e.g. with the terminal from the Add-on "SSH & Web Terminal") and write:

cd /config/.storage vi core.config_entries

There you find somewhere the entry of deconz with the wrong IP (something like this):

    "entry_id": "c195c9a63c3b23b05200538f5f7def71",                                          
    "version": 1,                                                                            
    "domain": "deconz",                                                                      
    "title": "00212E02A4BD",                                                                 
    "data": {                                                                                
      "host": "172.30.33.4",                                                                 
      "port": 40850,                                                                         
      "api_key": "7CY7X44B7B"                                                                

The host IP has to be edited to the IP which is shown in the upper right corner in the Phoscon app.

The commands for the vi-editor are little specific: To save the file in vi, press Esc key, type :w and hit Enter key or save the file and quit vi by pressing Esc key, type :x and hit Enter key.

Then you have to reboot the Home Assitant and I hope it should work again. ;-)

For me I could also reboot and everything. Just if I update Home Assistant again I have also to do the loop again.

basecore avatar Sep 12 '22 18:09 basecore

@basecore thanks, you solved a big problem that has been bothering me for

It is possible to edit the IP of the Deconz in the file core.config_entries manually. You have to login to your home assistant via ssh (for e.g. with the terminal from the Add-on "SSH & Web Terminal") and write:

For me I could also reboot and everything. Just if I update Home Assistant again I have also to do the loop again.

dolam avatar Sep 13 '22 07:09 dolam

@basecore thanks a lot for sharing your fix.

some info as I had some trouble.

  1. use a space after "cd" (stupid mistake) cd config/.storage vi core.config_entries

  2. for vi some basic commands are helpful https://www.cs.colostate.edu/helpdocs/vi.html

BR Fuchs

Fuchs5 avatar Oct 02 '22 18:10 Fuchs5

I'm on a quite unstable vbox, and the error on deconz integration only happens on hard reboots. It is also possible to give the "File editor" addon access to .storage and edit core entries from there. If one is not comfortable with using vi.

Skinderholm avatar Oct 02 '22 19:10 Skinderholm