Closed apexad closed 4 years ago
Hi @apexad,
You can start by cloning https://github.com/asednev/govee-bt-client and debugging the client to understand where the gap is. The error you're getting is due to validPeripheral
evaluating to false
in the client: https://github.com/asednev/govee-bt-client/blob/master/index.ts#L9
Your MAC address looks like a match, so the problem is likely with the manufacturerData
from advertisement.
const hex = advertisement.manufacturerData.toString('hex');
// add this line to debug:
console.log('manufacturerData', hex);
if (!hex.includes(h5075_uuid_rev)) { return false; }
This is the full log:
=== start discovery
discovered 8263c522f7cf48cab27dbf0405927198 8263c522f7cf48cab27dbf0405927198 disconnected -66
manufacturerData 88ec000359324100
8263c522f7cf48cab27dbf0405927198: 88ec000359324100
{
uuid: '8263c522f7cf48cab27dbf0405927198',
address: '',
model: 'GVH5075_6239',
battery: 65,
humidity: 44.2,
tempInC: 21.9442,
tempInF: 71.49956,
rssi: -66
}
discovered 8263c522f7cf48cab27dbf0405927198 8263c522f7cf48cab27dbf0405927198 disconnected -66
manufacturerData 4c000215494e54454c4c495f524f434b535f48575075f2ffc2
invalid peripheral, scan for another
discovered 8263c522f7cf48cab27dbf0405927198 8263c522f7cf48cab27dbf0405927198 disconnected -57
manufacturerData 88ec0003554a4100
8263c522f7cf48cab27dbf0405927198: 88ec0003554a4100
{
uuid: '8263c522f7cf48cab27dbf0405927198',
address: '',
model: 'GVH5075_6239',
battery: 65,
humidity: 44.2,
tempInC: 21.8442,
tempInF: 71.31956,
rssi: -57
}
discovered 8263c522f7cf48cab27dbf0405927198 8263c522f7cf48cab27dbf0405927198 disconnected -57
manufacturerData 4c000215494e54454c4c495f524f434b535f48575075f2ffc2
invalid peripheral, scan for another
=== stop discovery
So, the above log is from my Mac, but homebridge running in raspberry pi. pi does not see the Govee thermostat currently despite being very close, but through a cabinet.
I was about to ask whether you ran it on Raspberry Pi. I never tested this setup on Raspberry Pi because I don't have one.
If you were to run homebridge on your Mac, I am pretty sure your Govee thermostat would be detected.
At this point I think it's best for you to continue debugging on your Raspberry Pi. You need advertisement with payload that starts with 88ec
in order to decode readings. Could be something with the way your bluetooth module works or returns data.
manufacturerData 4c000215494e54454c4c495f524f434b535f48575075f2ffc2 is? Doing some debugging on my Raspberry Pi I am getting this:
discovered a4c138bc6239 a4c138bc6239 a4:c1:38:bc:62:39 disconnected -27
mData 4c000215494e54454c4c495f524f434b535f48575075f2ffc2
a4c138bc6239: 4c000215494e54454c4c495f524f434b535f48575075f2ffc2
{
uuid: 'a4c138bc6239',
address: 'a4:c1:38:bc:62:39',
model: 'GVH5075_6239',
battery: 84,
humidity: 2.2,
tempInC: 139.5022,
tempInF: 283.10396,
rssi: -27
}
...initially I thought it was maybe another Govee product I have (a LED light strip), but see the model number there? Obviously it's totally whack numbers as far as tempInC and tempInF though, so confused.
I don't see the other payload on Raspberry pi.
Alright, so I figured out how to get it working on Raspberry Pi. Apparently it is not broadcasting 'all' bluetooth events so the following is needed to change this behavior:
export NOBLE_REPORT_ALL_HCI_EVENTS=1
(Trying to figure out how to do that in javascript and not as an environment variable)
Then, it also required this change:
-const govee_bt_mac = "a4-c1-38";
+const govee_bt_mac = "a4:c1:38";
I'll investigate further, but otherwise will submit a PR soon. Closing this issue.
Thanks for sharing, I was concerned about -
separator being too device specific. Indeed it is. If you don't follow up with PR in the next few days, I will take it upon myself to make the library more robust.
Alright, so I figured out how to get it working on Raspberry Pi. Apparently it is not broadcasting 'all' bluetooth events so the following is needed to change this behavior:
export NOBLE_REPORT_ALL_HCI_EVENTS=1
(Trying to figure out how to do that in javascript and not as an environment variable)
Then, it also required this change:
-const govee_bt_mac = "a4-c1-38"; +const govee_bt_mac = "a4:c1:38";
I'll investigate further, but otherwise will submit a PR soon. Closing this issue.
Hello @apexad I was hoping you could provide some help with getting this plugin to run with RPI. I’m a novice with some of these commands/config setups but have Homebridge successfully running with about 5 plugins. I’d love to see your steps on how you achieved to get the Govee Thermostat sensors in Homebridge. Thanks in advance!
@cargueta001 I’ve already fixed the underlying client code this homebridge plugin uses. @asednev should be updating the homebridge plugin soon.
@cargueta001 I just published an update, go ahead and update your Homebridge Govee plugin to version 1.0.3 and see if that works with your Raspberry Pi.
Thanks @asednev I will give it a try later today. Also, I need to make sure that I’m adding the plug-in config data to the config file correct?
@cargueta001 if you install your Homebridge plugins using web UI, there is no need to manipulate config file directly. You can open plugin settings on the Plugins page. The plugin doesn't require any configuration unless you want to enable debug logs or change low battery threshold.
Unfortunately @asednev I’m running into some errors. I’m attaching two screenshots that show my log and also the errors during install. Any suggestions would be great 👍🏻
@cargueta001 Looks like you may not have installed the pre-reqs:
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
@apexad I’ve verified that it’s installed and also tried to install it globally and still no luck installing the plugin.
Try sudo setcap cap_net_raw+eip $(eval readlink -f $(which node))
which sets node t be able to use bluetooth by my understanding...
Also, jut to confirm, run the latest version of this plugin which will include latest govee-bt-client
Try
sudo setcap cap_net_raw+eip $(eval readlink -f $(which node))
which sets node t be able to use bluetooth by my understanding...
This unfortunately didn’t yield anything 🤷🏻♂️
Try
sudo setcap cap_net_raw+eip $(eval readlink -f $(which node))
which sets node t be able to use bluetooth by my understanding...This unfortunately didn’t yield anything 🤷🏻♂️
I tried the plugin once again and took some screenshots of the various errors that pop up. Hope this is helpful and thanks for bearing with any misunderstandings on my part.
Are you using HOOBS?
Are you using HOOBS?
Not using HOOBS. My setup is with Docker Homebridge by Oznu.
Errors definitely suggest there is something with dependencies for noble. Basically some of the dependencies were not built for the architecture you're using.
Even if you get past all of the errors, you will need to figure out how to expose your bluetooth module to docker container. That may require non-trivial manipulations with Docker.
Unfortunately I don't have a system running on arm to help you with that. Maybe after new Mac comes out for arm architecture.
I agree with @asednev that using Docker here presents a different situation. I am not familiar with Docker in a way that I could help. I would suggest going to the homebridge discord to ask for general help on getting noble/Bluetooth working in Docker.
Describe Your Problem: I have a 5075, this plugin is not detecting it/not working Thermometer is otherwise working fine and shows data in the Govee app The Thermostat is less than 10 feet away form the Raspberry Pi running homebridge
Logs:
Many of these over and over again...
Plugin Config:
Screenshots: None Environment: