xiaohuim / homeassistant-magicblue

MagicBlue custom component for Home Assistant
14 stars 13 forks source link

V10 Bulbs not responding with latest HASS (BTle broken pipe error exception) #4

Closed mouth4war closed 6 years ago

mouth4war commented 6 years ago

Hi guys,

Is it just me with this problem? V10 bulbs are just not responding after minutes of uptime in HASS (0.57 onwards). V8 bulbs are working just fine. V10 are functioning fine via the shell.

Something to do with asyncio? I'm on HASSbian stretch. When I stop HASS, the bulbs suddenly become responsive again and go through the queued commands, it looks like.

Betree commented 6 years ago

I'll check if they changed something in dependencies. Are you using magicblue version 0.5.0.dev1 ?

Betree commented 6 years ago

Can you provide your bluepy version ? pip3 show bluepy

mouth4war commented 6 years ago

Bluepy 1.1.2 MBS 0.5.0

Wouldn't dependencies change also affect v8 bulbs?

Betree commented 6 years ago

Probably but first thing that comes to my mind is a possible difference between bluepy versions.

If you're using HASS.io, try using magicblue 0.5.0.dev1. It's a special build we made for it (see this).

Otherwise I need to update my HASS too and I have both v8 + v10 bulbs so I'll be able to test it soon.

mouth4war commented 6 years ago

Looks like a HASS component issue. MBS is able to control the bulbs when they go unresponsive in HASS. On stopping HASS, the queued commands suddenly execute before HASS shuts down completely. Logs show EDIT: broken pipe exception magicblue/btle.

mouth4war commented 6 years ago

I managed to save the exceptions using hassctl log since the HASS log file wasn't getting updated.

This happens after the bulbs go unresponsive and I stop HASS making the lights go crazy executing queued commands.

EDIT: No change with bluepy 1.1.4

Stopping Home Assistant for homeassistant... Exception ignored in: <bound method Peripheral.del of <bluepy.btle.Peripheral object at 0x75dd1390>> Traceback (most recent call last): File "/srv/homeassistant/lib/python3.5/site-packages/bluepy/btle.py", line 520, in del self.disconnect() File "/srv/homeassistant/lib/python3.5/site-packages/bluepy/btle.py", line 416, in disconnect self._writeCmd("disc\n") File "/srv/homeassistant/lib/python3.5/site-packages/bluepy/btle.py", line 268, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe

mouth4war commented 6 years ago

@Betree any clue? Bluepy doesn’t officially support 3.5. Maybe that or something in HASS?

Betree commented 6 years ago

Bluepy not officially supporting 3.5 sounds like a good track to follow.

Checking this is definitely in my TODO list but I'm overwhelmed with over projects at the moment. @mouth4war if you're willing to work on this and take the lead over the homeassistant-magicblue component I'll be glad to link to your repo from main project. Furthermore I can invite you to be a collaborator on main repo so you'll be able to fix and experiment more easily.

mouth4war commented 6 years ago

I have replaced my v10 bulbs (3x) with WiFi bulbs (Xiaomi Phillips). Watching the performance of the v8s and they seem to be fine for now (all 4 of them).

I'm not familiar with python much TBH. Maybe if I learn it someday...