Successfully migrated from ZHA to Z2M without re-pairing #24478
Replies: 20 comments 55 replies
-
|
Interesting! Had a chat with @Nerivec about this, it should be easy to add an automatic interview when an unknown device sends a message. So the procedure would be:
|
Beta Was this translation helpful? Give feedback.
-
|
What to do after coming home from a nice party? Feed the cats and deliver the code, of course! Note: The most straightforward way would be to instruct users to download a backup from ZHA and then disable it. However, you could probably also just curl the backup from the other extension.
|
Beta Was this translation helpful? Give feedback.
-
|
Does |
Beta Was this translation helpful? Give feedback.
-
|
I was able to download zigbee.db on a HAOS OVA install by using the File editor addon. Then dumping some attributes from it there are quite a few tables and they are versioned: I think we're only interested in There's not a good way of exporting devices from HA and I don't have access to |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for this. Note that the ext_pan_id is in reverse order in the Z2M configuration vs. a ZHA backup for me (no clue who is right) ZHA backup "network_info": {
"extended_pan_id": "7e:51:d3:4f:64:50:5a:6e",Z2M config ext_pan_id:
- 110
- 90
- 80
- 100
- 79
- 211
- 81
- 126 |
Beta Was this translation helpful? Give feedback.
-
|
Tried following this but something is unhappy: A quick web search suggests that maybe the problem is that there are other routers around that are still running the network and that's causing some kind of conflict? |
Beta Was this translation helpful? Give feedback.
-
|
I want to say thank you for this thread, and add some notes for anyone else who wants to try this:
So it took me a while to realize that was why it said this.. I originally assumed it was smarter than me, but none of my devices were talking right. Eventually I used the settings/advanced menu of z2m's front end to reverse the bytes and that fixed it (I assume deleting the
|
Beta Was this translation helpful? Give feedback.
-
|
Happy new year everyone. I'm starting from scratch on the zigbee2mqtt side. Provided Z2M configuration is complete (Zigbee network...), does it hurt to start without a device list so that I get the base |
Beta Was this translation helpful? Give feedback.
-
|
So here's what I did. Based on details in pretty much all previous posts. I performed data manipulation on the side for ease of use, config files are copied back and forth with the machine running zigbee2mqtt.
Everything works. |
Beta Was this translation helpful? Give feedback.
-
|
Dear all, |
Beta Was this translation helpful? Give feedback.
-
|
Would someone be able to write a (detailed) howto on how to do this? I've started of with ZHA but feel this is a mistake:
You would have everlasting ❤️ 🙏 . |
Beta Was this translation helpful? Give feedback.
-
|
I believe this should work? Using the Home Assistant Terminal and Studio Code Server add-ons (for easier editing/access), in Terminal run: $ tail -n 1 config/zigbee2mqtt/database.db
# note the highest ID value, replace below where it says "+ 2"
$ sqlite3 config/zigbee.db
sqlite> select CONCAT('{"id": ', (ROW_NUMBER() OVER (ORDER BY d.ieee)) + 2, ', "type": "EndDevice", "ieeeAddr": "0x', REPLACE(d.ieee, ':', ''), '", "nwkAddr": ', d.nwk, '}') FROM devices d JOIN endpoints e ON d.ieee = e.ieee ;This will give you a list like {"id": 8, "type": "EndDevice", "ieeeAddr": "0x00178801023dd160", "nwkAddr": 23188}That you should be able to paste into the zigbee2mqtt/database.db. |
Beta Was this translation helpful? Give feedback.
-
|
@toine512 @seidtgeist Thx! I prepared some page to do all that stuff :) https://paweb88.github.io/zha-z2m/index.html ( soryy is in Polish right now, but I plan to translate it and make some UI ) |
Beta Was this translation helpful? Give feedback.
-
|
This is really cool. I'm going to give this a whirl. I wrote a quick python script which can run under pyscript to generate the yaml and json files. Doesn't require a backup file and interfaces with HA API to gather all info. https://gist.github.com/archite/1930050f3c5ac032b418f83313d8d5dc Once again, thanks for finding the process! |
Beta Was this translation helpful? Give feedback.
-
|
You must ensure that you’ve added this block to your |
Beta Was this translation helpful? Give feedback.
-
|
Hi! |
Beta Was this translation helpful? Give feedback.
-
|
Well pasting in the configuration after installation but before onbarding I end up with bad gateway - if I don't pase anything in it works..
|
Beta Was this translation helpful? Give feedback.
-
|
Not sure what's going on here after importing the database: [18:44:30] INFO: Preparing to start... |
Beta Was this translation helpful? Give feedback.
-
|
After thoroughly reading this thread, looking at all the code and doing a mental calculation of the time/work involved, I figure the processes in here are worth doing only if you have over 100 Zigbee devices. Less than that and it seems like it will be much faster and much less headache to simply re-pair all of them manually, including making any adjustments to automations. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@Koenkk First of all, love the project! Thank you! I'm so glad to be able to set light gradients on my Signe again, and the software updates are a welcome plus (for no reason other than feeling up to date).
So, I've had a fun night and automated the device migration part with a script:
database.dbentry, e.g.:{ "id": 3, // next highest id "type": "EndDevice", // this will be updated by interview process "ieeeAddr": "0x0017880110409015", // reformatted ieee from zigbee.db "nwkAddr": 19243, // nwk from zigbee.db "manufId": 4107 // endpoint attribute mapped from zigbee.db, mapped via Z2M's cluster.ts }zigbee2mqtt/database.dbzigbee2mqtt/configuration.yaml:This could be automated further for a full ZHA import:
I guess you know all this already, but I've read quite a few forum discussion and watched youtube videos where people crawl through their homes, re-pairing all of their devices manually 🤭
I could write this as a standalone TS script if you're interested?
Beta Was this translation helpful? Give feedback.
All reactions