kevinvincent / ha-wyzesense

A Home Assistant Component to interface with the WYZE Sense hub and sensor system
368 stars 97 forks source link

MAC is not recognized #151

Open Mokson opened 4 years ago

Mokson commented 4 years ago

Hi 👋 I have 2 contact sensors and when I'm trying to add them in the scan mode - the bridge won't recognize mac address and treats both sensors as 1 entry

{'available': True, 'mac': '\x00\x00\x00\x00\x00\x00\x00\x00', 'state': 1, 'device_class': 'door', 'timestamp': '2020-06-24T14:38:22.371000', 'rssi': -79, 'battery_level': 96}

Sensor found and added as: binarysensor.wyzesense (unless you have customized the entity ID prior).
To add more sensors, call wyzesense.scan again.

Log: https://pastebin.com/0Sa7YgQR

Device | Pi 3b System | HassOS 4.10 Deployment | production

zsmitchell commented 4 years ago

I am having the exact same issue:

2020-06-28 22:05:30 DEBUG (SyncWorker_28) [custom_components.wyzesense.binary_sensor] Registering Sensor Entity: 2020-06-28 22:05:30 DEBUG (SyncWorker_28) [custom_components.wyzesense.binary_sensor] {'available': False, 'mac': '\x00\x00\x00\x00\x00\x00\x00\x00', 'state': 0}

Happened after I replaced the batteries in both sensors. First sensor that I discovered through the service was the sensor that was added as binary_sensor.wyzesense (with no mac). Second sensor said it was discovered, but there was not a new sensor, and I discovered by chance that they were both activating the same one (\x00\x00\x00\x00\x00\x00\x00\x00).

Mac Addresses of the 2 sensors are 777F92DA and 777F935D (Notable only because they are the only 2 sensors that I have that start with 777 - The rest are 778 and 779 - Seemed interesting, so added it)

Device: Running on HP server (intel) Ubuntu 19.10 HA Version: 0.111.4

Log: [https://pastebin.com/rpnX6RqK]

RoldyBuffalo commented 4 years ago

I have this crazy idea....it worked for me but maybe it was a one off.

I changed the battery in my sensor, it was added with a zero mac address.

but what if, now hear me out, but what if the mac address on the sensor was actually being written to by the integration?

Try changing the mac address(es) of the broken sensors from /0/0/0/0/0/0/0/0 to something in the correct naming convention. I used the same exact mac as it was before ymmv, I had it saved in the binary_sensor: config line. It worked for me, but I will say, the battery doesn't seem to be fixed? I'm not really sure what's going on but it saved the sensor, for a while, heck it's still working. but as always, ymmv.

essentially, set this value in the dev tools menu, states menu, and click set state.

It's stayed not a zero mac for 2 days now, and works as intended, after it originally being readded with a zero mac.

image

Mokson commented 4 years ago

Good try, but for me it resets back to 000 after the state is changed (door opened/closed)

beanpowered commented 3 years ago

I also have the same issue. 2 sensors both acting as one. Changing the mac address in Development Tools reverts back. I couldn't find any other place to change it.

freelancer-NY commented 3 years ago

I also have the same issue, though this was a brand new install on Home Assistant

Mokson commented 3 years ago

Can you guys try to pair sensors via Wyze application and then stick the hub back to the Home Assistant device? Sensors worked for me before I've switched to HA, and then I decide to re-pair them via HA and this issue happend

scorfman commented 3 years ago

I'm in the middle of rebuilding my HA install. I had one that didn't re-pair with HA with its MAC address. Another did, and I have several to go. The one that had a MAC was a brand new warranty replacement from Wyze due to it losing its MAC address when the battery went completely dead (common problem apparently). The other was an older one I was pairing with my new HA build. It paired, but with no MAC in the name. I then took that device and paired it using the Wyze app with the dongle hooked back to the wyzecam. It set up with a MAC again when I did that. I then hooked the dongle back to HA. HA made me re-pair both devices before they would work, but after that the one that was missing a MAC address showed up with it's original MAC.

So, quite strange but working so far. Note that if the WyzeSense contact sensor blinks 5 times instead of 3 when the reset is held, your device is bricked. I actually had 4 or 5 devices run out of battery and lose their MAC address, and they were replaced under warranty. The one I am talking about here, wasn't bricked, but had still lost its MAC address. Fortunately the re-pair through the wyze app recovered it.

some-rando commented 3 years ago

I also had several contact sensors with the 5 blinks that had been without batteries or dead batteries. I contacted Wyze customer service chat and they're sending me replacement sensors. This link is where I learned about the null MAC address problem: https://www.reddit.com/r/wyzecam/comments/h8oapo/suspect_i_unintentional_found_the_reason_why_some/

For more details, the five blinks instead of three blinks when pairing seems to be the indicator of death. HA-Wyzesense can "see" and records the MAC address as \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 and can actually pair with a sensor using that null MAC address still. But if you have more than one sensor with a null MAC it can't differentiate the two. So if you have one "dead" sensor it might still be usable. Theoretically you could use multiple dead sensors with null MAC addresses that act as a single entity in Home Assistant, like if you had two (or more) windows and didn't care which was open, you just wanted to know one or more of them is opened.

I did not try to repair these using the Wyze app since I didn't want to risk messing up my Home Assistant install if a firmware upgrade changed the hub and made ha-wyzesense break.

crisflashin commented 3 years ago

I also had several contact sensors with the 5 blinks that had been without batteries or dead batteries. I contacted Wyze customer service chat and they're sending me replacement sensors. This link is where I learned about the null MAC address problem: https://www.reddit.com/r/wyzecam/comments/h8oapo/suspect_i_unintentional_found_the_reason_why_some/

For more details, the five blinks instead of three blinks when pairing seems to be the indicator of death. HA-Wyzesense can "see" and records the MAC address as \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 and can actually pair with a sensor using that null MAC address still. But if you have more than one sensor with a null MAC it can't differentiate the two. So if you have one "dead" sensor it might still be usable. Theoretically you could use multiple dead sensors with null MAC addresses that act as a single entity in Home Assistant, like if you had two (or more) windows and didn't care which was open, you just wanted to know one or more of them is opened.

I did not try to repair these using the Wyze app since I didn't want to risk messing up my Home Assistant install if a firmware upgrade changed the hub and made ha-wyzesense break.

I recently made a ticket in wyze customer support about that.

But now, i wanna unpair that "no mac address" sensor. Did anyone know how to do that without breaking something?

some-rando commented 3 years ago

But now, i wanna unpair that "no mac address" sensor. Did anyone know how to do that without breaking something?

I was able to unpair one of mine by finding the old MAC address. I think I found it in the hidden <homeassistant/.storage/core.entity_registry> file. The sensor should be in there by whatever you named/renamed it, with a entry with the MAC address next to it. Then you go to Developer Tools in Home Assistant, Services tab. Choose the service from the drop down menu. Then just replace the MAC address in the service data example that is filled in for you then press . It should then give you a notification that it was removed.

I can't remember if that fully removed it for me though. I also went into that core.entity_registry file and manually deleted entries that were being persistent. I believe I also manually deleted entries from the core.restore_state file. You have to shut down HA before you edit those files, and if you're on non-Windows OS you'll probably have to edit as root. They recommend not editing these files manually, so be careful to not remove the exactly right amount of characters (delete between "}," and "{") or it could break. Make a backup. Better yet, try the initial unpair in my first paragraph first and see if that works.