Closed maskaz closed 3 months ago
I have more or less the same. I'm not seeing any ERRORs, but no devices are recognized and added. Discovery of groups/rooms does appear to work.
2024-08-22T18:59:16.504Z DEBUG bifrost > Configuration loaded successfully
2024-08-22T18:59:16.505Z WARN bifrost::state > Missing certificate file [cert.pem], generating..
2024-08-22T18:59:16.524Z DEBUG bifrost::state > No state file found, initializing..
2024-08-22T18:59:16.528Z INFO bifrost::mdns > Registered service bifrost-FFFFFFFFFFFF._hue._tcp.local.
2024-08-22T18:59:16.533Z INFO bifrost > Serving mac [ff:ff:ff:ff:ff:ff]
2024-08-22T18:59:16.536Z DEBUG bifrost::state > Loading certificate from [cert.pem]
2024-08-22T18:59:16.539Z INFO bifrost::server > http listening on x.x.x.x:80
2024-08-22T18:59:16.542Z INFO bifrost::z2m > [z2m] Connecting to ws://zigbee2mqtt:80
2024-08-22T18:59:16.539Z INFO bifrost::server > https listening on x.x.x.x:443
2024-08-22T18:59:16.557Z DEBUG tungstenite::handshake::client > Client handshake done.
2024-08-22T18:59:16.618Z DEBUG bifrost::z2m > [z2m] room/9bcb7698-2f21-56a3-9bce-bdd4153a681e is new, adding..
2024-08-22T18:59:16.619Z DEBUG bifrost::z2m > [z2m] room/925316dd-f868-5459-b65a-3d2ba095517d is new, adding..
2024-08-22T18:59:16.619Z DEBUG bifrost::z2m > [z2m] room/3844467c-33b7-5c3a-a1b3-59f1cd35c2e5 is new, adding..
2024-08-22T18:59:16.619Z DEBUG bifrost::z2m > [z2m] room/260762bd-0b5a-58e0-addb-a2e5816c0e9a is new, adding..
2024-08-22T18:59:16.620Z DEBUG bifrost::z2m > [z2m] room/2c35c167-fad5-528e-9cdb-c146408c09a6 is new, adding..
2024-08-22T18:59:16.660Z WARN bifrost::z2m > [z2m] Notification on unknown topic Lamp 1
2024-08-22T18:59:16.660Z WARN bifrost::z2m > [z2m] Notification on unknown topic Lamp 2
...
I realize I didn't document this well enough in the README - my bad 😅
Good news and (minor) bad news.
The (minor) bad news: Bifrost does not support adding new lights.
The good news: The solution is easy: Just add the lights through zigbee2mqtt, and they will appear in bifrost :-)
I do notice that you see this warning "[z2m] Notification on unknown topic Lamp 1"
This means bifrost does get an update for your lamp, but it hasn't seen the device before.
Did you add this device after starting bifrost?
In that case, can you try restarting bifrost?
Every time the server starts, it gets a complete inventory from z2m. It should also work if you add lights while bifrost is running, but that hasn't been extensively tested.
Let me know what you find - sounds like an easy fix
Oh, and if restarting bifrost didn't help, then it's almost certainly because the feature detection fails.
When bifrost hears about new devices (happens every time it's started, and contacts z2m), it goes through z2m's device information, which is a detailed JSON object for each device.
These objects specify the properties of the devices, whether they are switches, sensors, lights, etc.
I've only had a limited range of different Zigbee lights to test on, so that could be the issue.
So, if restarting bifrost doesn't help, can you please try this:
cargo run --example=wscat ws://10.12.0.20:8080 | tee z2m.log
(adjust 10.12.0.20:8080
address to match your z2m
address from your config)
It will print a lot of information for the first couple of seconds, and then it should slow down. When it does, press Ctrl-C to stop it.
Now you should have a file z2m.log
. This will have the raw information from z2m. If you feel comfortable sharing it, please send it to me.
(As far as I know, there are no passwords or zigbee network keys in this output, but it does contain a lot of detailed information about your zigbee devices and z2m setup. Only share it if you are comfortable with doing so)
If you want to share it, either attach it here, or send to chrivers@gmail.com
I have restarted and rebuilt Bifrost multiple times yet it does not recognize any of my zigbee2mqtt connected lights. Every single device shows up in the logs as not being recognized. The output I shared is pretty much the full log output on startup albeit heavily truncated with most of the actual log being the last two lines repeated for every single device connected to zigbee2mqtt. All devices were already connected to zigbee2mqtt before starting Bifrost.
I'll try to get back to you with the full websocket output. I have numerous Trådfri devices which I gather from the examples you also appear to be using, so the problem is unlikely to be related to the devices themselves.
Yes - I have about 80 Trådfri devices, so at least some models of Trådfri definitely work.. ;-)
Looking forward to seeing the log output - I'm sure we can get to the bottom of this
For me, problem is that i cannot even run logging:
cargo run --example=wscat ws://192.168.1.110:8099 | tee z2m.log
error: failed to parse manifest at /home/****/Cargo.toml
Caused by: no targets specified in the manifest either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
Ah, I might have misunderstood. If you've installed bifrost from cargo install --git ...
, then you have the bifrost
binary available, but (afaik), not the examples.
If you clone this repository, cd
into it, then you can run the cargo
command.
Cargo is complaining that it can't find Cargo.toml
in your home directory (as far as I can tell), which would happen if you try cargo run
outside the git checkout directory. Makes sense?
i.e.
mkdir -p ~/git
cd ~/git
git clone https://github.com/chrivers/bifrost.git
cd bifrost
cargo run --example=wscat ws://192.168.1.110:8099 | tee z2m.log
For me Cargo is always searching for Cargo.toml in a home directory, no matter from where i run command. But even after copy Cargo.toml from Bifrost git folder the same error appears:
error: failed to parse manifest at /home/*****/Cargo.toml
Caused by: no targets specified in the manifest either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
I had install Bifrost via 'cargo install --git ...'
That is... weird.
That's definitely not what Cargo normally does, or what it's supposed to do.
What happens if you do this:
mkdir /tmp/foo
cd /tmp/foo
cargo build
Does it still complain of /home/*****/Cargo.toml
in that case?
If so, there's something wrong with your rust/cargo installation. Do you have some unusual settings in your environment, shell profile, or similar?
@maskaz I think you're seeing the same issue as #6. I think a solution is coming along nicely
So if you're still interested, you can try installing that version like so:
cargo install --branch chrivers/z2m-fixes --git https://github.com/chrivers/bifrost.git
Can you see if that helps?
@maskaz The fixes have been merged into master. If you get a chance, can you test again?
Just install normally (cargo install --git https://github.com/chrivers/bifrost.git
)
@maskaz wrote:
Now i cannot compile.
I had removed everything, installed Cargo (Version 1.75.0, OS: Ubuntu 24.04 LTS)
Error: Compiling bifrost v0.1.0 (/home/maskaz/.cargo/git/checkouts/bifrost-5a426757687fce85/2a2873b) error[E0432]: unresolved import std::hash::DefaultHasher
--> src/hue/api/resource.rs:2:172 use std::hash::{DefaultHasher, Hash, Hasher}; ^^^^^^^^^^^^^ no DefaultHasher
inhash
= help: consider importing this struct instead: std::collections::hash_map::DefaultHasher
warning: unused import: Hasher
--> src/hue/api/resource.rs:2:382 use std::hash::{DefaultHasher, Hash, Hasher}; ^^^^^^ = note:
#[warn(unused_imports)]
on by default
I can see the problem now. You're using rust 1.75, and I've used std::hash::DefaultHasher
, which was stabilized in rust 1.76 (one version newer).
Can you please try updating your toolchain, and try again?
Compiled, and another errors :D
2024-08-24T19:03:43.911Z ERROR bifrost::z2m > [server1] Failed to parse critical z2m bridge message on [bridge/devices]:
2024-08-24T19:03:43.911Z ERROR bifrost::z2m > [server1] [{"date_code":"20230505","definition":{"description":"Zigbee smart switch (no neutral)","exposes": (... list of all my devices)
2024-08-24T19:03:43.912Z ERROR bifrost::z2m > [server1] Event loop broke: unknown variant climate
, expected one of binary
, composite
, enum
, light
, list
, lock
, numeric
, switch
at line 1 column 106832
I have one zigbee thermostatic radiator valve and probably this might cause the issue.
Interesting! I think you are correct - this is probably the cause.
I've pushed a fix to the master branch. Can you try reinstalling and see if that helps?
It is alive! Groups added correctly from z2m and now i can control lights from Hue app. Great work!
Great! Hope you enjoy it, and thanks for testing :)
Consider joining us on discord https://discord.gg/YvBKjHBJpA
I'll close this issue
Errors: 2024-08-22T17:10:47.401Z ERROR bifrost::routes::clip > Request failed: State changes not supported for: ZigbeeDeviceDiscovery
2024-08-22T17:10:47.401Z ERROR tower_http::trace::on_failure > response failed classification=Status code: 500 Internal Server Error latency=2 ms
And warnings: (example) 2024-08-22T17:12:22.324Z WARN bifrost::z2m > [server1] Notification on unknown topic 0x8c6fb9fffe1f1fda