mavrikkk / ha_kettler

allows you to connect Redmond SkyKettle, SkyCooker and SkyHeat to your Home Assistant. see README to know further
132 stars 51 forks source link

Integration creates two sets of entities #36

Closed KhomichMO closed 4 years ago

KhomichMO commented 4 years ago

Kettle: G200S

After each HA reload new set of entities are created: first "RK-G200S", after the next reload - "redmond sky" (RK-G200S is deactivated), then back to RK-G200S and so on.

image

mavrikkk commented 4 years ago

Hi i tried to completely delete the integration, then reboot HA, then install it again, then several reboots to check the bug...and nothing. I have only "RK-G200S" after every reboot. "redmond sky" can appear only if "findType" function doesnt work. You can find it in 'init.py'.

try to change your "findType" function to below:

def findType(self): match_result = search(r'hci([\d]+)', self._device) if match_result is None: _LOGGER.error('match result is None') else: iface = int(match_result.group(1)) scanner = btle.Scanner(iface=iface) ble_devices = {device.addr:str(device.getValueText(9)) for device in scanner.scan(2.0)} dev_name = ble_devices.get(self._mac, 'None') self._type = SUPPORTED_DEVICES.get(dev_name, 1) if dev_name != 'None': self._name = dev_name else: _LOGGER.error('dev_name is None')

mavrikkk commented 4 years ago

here is the better syntax: https://pastebin.com/A0LGHiBh

mavrikkk commented 4 years ago

then catch your logs

KhomichMO commented 4 years ago

Using your code caught this:

dev_name is None 8:43:07 PM – ready4sky (ERROR)

mavrikkk commented 4 years ago

it means, that my integretion cant find your device in 2 sec. try to increase the counter to, may be, 5 sec. ble_devices = {device.addr:str(device.getValueText(9)) for device in scanner.scan(2.0)}

mavrikkk commented 4 years ago

generally, pay attention to your bluetooth hardware (RPI integrated ble is very bad) and the distance between HA and kettle

KhomichMO commented 4 years ago

Seems to work with 5 secs, thanks.