sopelj / hass-ember-mug-component

Ember Mug Integration for Home Assistant
MIT License
111 stars 4 forks source link

Ember Mug - Connectivity & How to get MAC ID for Mug? #3

Closed fireheadman closed 2 years ago

fireheadman commented 2 years ago

Could you please give a snippet/info on how to get the MAC ID for the mug? I personally use an iOS device, so maybe include for both Android and iOS.

Thanks

fireheadman commented 2 years ago

update: was able to power on a galaxy s5 and install the ember app, pair the mug to it.... from there I was able to get the MAC from the bluetooth settings.

still unsure how a person without an android device would be able to get this info as the iOS native bluetooth app doesn't disclose this info. maybe there is a 3rd party bluetooth scanner that can show this?

next step was to insert a bluetooth dongle into my HA server and reboot it, then added the ember.yaml to my integrations.

fireheadman commented 2 years ago

Looks like this is all I get now... 2022-01-04 12:37:37 INFO (MainThread) [homeassistant.setup] Setting up ember_mug 2022-01-04 12:37:37 INFO (MainThread) [homeassistant.setup] Setup of domain ember_mug took 0.0 seconds

But when I search the entities, nothing is to be found. I've redacted my mac id....

bash-5.1# cat ember.yaml
---
#
#  Ember Mug
#
ember_mug:
  mac: C5:B4:F7:XX:XX:XX  # Replace with your Mug's MAC address
  name: "Ember Mug"  # Optional Name
  temperature_unit: "F"  # Optional: Default [C]
sopelj commented 2 years ago

Yeah, I don't have an iOS device to test, but yeah it looks like Apple decided to hide it from iOS 12+. So an android phone or desktop computer with bluetooth is currently the only way to obtain the MAC address.

I've been playing with config flow in home assistant (configuration via the UI) and that should allow me to either auto discover the device or at least list them in the UI. I just haven't had time to do it yet.

If you have the Terminal/SSH addon installed you can go into the console and use bluetoothctl and scan on to list nearby devices. You can find it there quickly.

That's weird. Do you have any other messages later? That just means the integration was loaded. You can specifically enable debug logs for this integration in your config if you want. That might help get a clearer error.

logger:
  default: error
  logs:
    custom_components.ember_mug: debug
    custom_components.ember_mug.mug: debug
    custom_components.ember_mug.mug.api: debug
fireheadman commented 2 years ago

I just saw my dongle driver wasn't loading... so found this article and followed it: https://kb.plugable.com/questions/696086

fireheadman@lancelot:~$ dmesg |grep -i blue
[   35.922959] Bluetooth: Core ver 2.22
[   35.922982] Bluetooth: HCI device and connection manager initialized
[   35.922986] Bluetooth: HCI socket layer initialized
[   35.922989] Bluetooth: L2CAP socket layer initialized
[   35.922995] Bluetooth: SCO socket layer initialized
[   36.054494] Bluetooth: hci0: BCM: chip id 63
[   36.055473] Bluetooth: hci0: BCM: features 0x07
[   36.071482] Bluetooth: hci0: lancelot
[   36.072503] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[   36.072727] bluetooth hci0: firmware: failed to load brcm/BCM20702A1-0a5c-21e8.hcd (-2)
[   36.072847] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e8.hcd failed with error -2
[   36.072850] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e8.hcd not found
[   36.347614] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   36.347616] Bluetooth: BNEP filters: protocol multicast
[   36.347620] Bluetooth: BNEP socket layer initialized
[   50.580535] Bluetooth: RFCOMM TTY layer initialized
[   50.580544] Bluetooth: RFCOMM socket layer initialized
[   50.580549] Bluetooth: RFCOMM ver 1.11

and after a reboot... the drivers are better, but still unable to pair to the ember mug

fireheadman@lancelot:~$ dmesg|grep -i blue
[   35.758159] Bluetooth: Core ver 2.22
[   35.758176] Bluetooth: HCI device and connection manager initialized
[   35.758179] Bluetooth: HCI socket layer initialized
[   35.758181] Bluetooth: L2CAP socket layer initialized
[   35.758192] Bluetooth: SCO socket layer initialized
[   35.918402] Bluetooth: hci0: BCM: chip id 63
[   35.919402] Bluetooth: hci0: BCM: features 0x07
[   35.935429] Bluetooth: hci0: lancelot
[   35.936408] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[   35.937228] bluetooth hci0: firmware: direct-loading firmware brcm/BCM20702A1-0a5c-21e8.hcd
[   36.193121] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   36.193123] Bluetooth: BNEP filters: protocol multicast
[   36.193127] Bluetooth: BNEP socket layer initialized
[   36.686460] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1338
[   36.702418] Bluetooth: hci0: Broadcom Bluetooth Device
[   50.501914] Bluetooth: RFCOMM TTY layer initialized
[   50.501922] Bluetooth: RFCOMM socket layer initialized
[   50.501927] Bluetooth: RFCOMM ver 1.11
fireheadman commented 2 years ago

so tried the command line to pair

fireheadman@lancelot:~$ sudo bluetoothctl
[sudo] password for fireheadman:
Agent registered
[bluetooth]# paired-devices
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 5C:F3:70:XX:XX:XX Discoverable: yes
[bluetooth]# pair C5:B4:F7:XX:XX:XX
Attempting to pair with C5:B4:F7:XX:XX:XX
[CHG] Device C5:B4:F7:XX:XX:XX Connected: yes
[CHG] Device C5:B4:F7:XX:XX:XX Connected: no
[CHG] Device C5:B4:F7:XX:XX:XX Paired: yes
Pairing successful
[bluetooth]# paired-devices
Device C5:B4:F7:XX:XX:XX Ember Ceramic Mug

However still not seeing it in HA. Will see what the debug shows.... one min.

fireheadman commented 2 years ago

using the debug for logger, I show nothing new in the logs.

bash-5.1# grep -i ember home-assistant.log
2022-01-04 13:15:22 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ember_mug which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-04 13:15:34 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'alexa_media', 'counter', 'ipp', 'zeroconf', 'ember_mug', 'sensor', 'cast', 'enphase_envoy', 'group', 'utility_meter', 'trace', 'unifiprotect', 'automation', 'logbook', 'binary_sensor', 'openweathermap', 'hacs', 'tplink', 'mobile_app', 'ffmpeg', 'dhcp', 'forecast_solar', 'neato', 'speedtestdotnet', 'brother', 'discovery', 'myq', 'unifi', 'energy', 'bhyve', 'network', 'sun', 'input_number', 'google', 'updater', 'scene', 'system_health', 'plex', 'dlna_dmr', 'econet', 'persistent_notification', 'media_player', 'timer', 'homekit_controller', 'map', 'device_tracker', 'input_select', 'sonos', 'tag', 'my', 'usb', 'input_datetime', 'co2signal', 'tts', 'media_source', 'roku', 'smartthings', 'upnp', 'ssdp', 'zone', 'input_text', 'envisalink', 'blueprint', 'history', 'template', 'input_boolean', 'script', 'tuya', 'light', 'default_config', 'tile', 'switch'}
2022-01-04 13:15:34 INFO (MainThread) [homeassistant.setup] Setting up ember_mug
2022-01-04 13:15:34 INFO (MainThread) [homeassistant.setup] Setup of domain ember_mug took 0.0 seconds
bash-5.1# pwd
/config/integrations
bash-5.1# cat logger.yaml
---
# The logger integration lets you define the level of logging activities
# in Home Assistant.
#
# I use this to reduce error messages for specific things,
# so I can focus on log messages that matter to me.
#
logger:
  ##default: warning
  default: info

  logs:
    #pyeconet: debug
    #custom_components.sensor.authenticated: debug
    #homeassistant.components.enphase_envoy: debug
    charset_normalizer: warning
    homeassistant.components.media_player: error
    #custom_components.localtuya: debug
    custom_components.ember_mug: debug
    custom_components.ember_mug.mug: debug
    custom_components.ember_mug.mug.api: debug

  ##filters:
  ##  pychromecast.socket_client:
  ##    # Surpress to chatty Cast integration
  ##    - "Failed to connect to service ServiceInfo"
  ##    - "Error communicating with socket, resetting connection"
fireheadman commented 2 years ago

If you can think of anything else... I'm open ears to try it.

fireheadman commented 2 years ago

this might be the issue...

[bluetooth]# paired-devices
Device C5:B4:F7:XX:XX:XX Ember Ceramic Mug
[bluetooth]# trust C5:B4:F7:XX:XX:XX
[CHG] Device C5:B4:F7:XX:XX:XX Trusted: yes
Changing C5:B4:F7:XX:XX:XX trust succeeded
[bluetooth]# connect C5:B4:F7:XX:XX:XX
Attempting to connect to C5:B4:F7:XX:XX:XX
Failed to connect: org.bluez.Error.Failed
[bluetooth]# info C5:B4:F7:XX:XX:XX
Device C5:B4:F7:XX:XX:XX (random)
    Name: Ember Ceramic Mug
    Alias: Ember Ceramic Mug
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: no
    LegacyPairing: no
    ManufacturerData Key: 0xffff
    ManufacturerData Value:
  c1                                               .
sopelj commented 2 years ago

That's extremely weird. Is this console you're using your Home Assistant instance? How are you running home assistant? Are you sure the Bluetooth is accessible to the instance? Your ember.yaml is correctly included in your config.yml? Even if it fails to connect to your Mug you should see it mention your mug in the log.

2022-01-04 13:31:31 DEBUG (MainThread) [custom_components.ember_mug] Setup platform
2022-01-04 13:31:31 INFO (MainThread) [custom_components.ember_mug] Ember Mug Jesse's Ember Mug Setup
2022-01-04 13:31:32 INFO (MainThread) [custom_components.ember_mug] Start running Jesse's Ember Mug
2022-01-04 13:31:32 INFO (MainThread) [custom_components.ember_mug] Starting mug loop C9:0F:XX:XX:XX

Do you have any other devices still paired with it? They might be fighting over it. haha. You need to restart home assistant between changes to config.yml a lot of the time.

fireheadman commented 2 years ago

yes, I can access bluetoothctl via my ha instance. my HA setup is a physical server (ubuntu setup) via HA in docker... official method.

I have my config split, so its an individual yaml for each integration. However, I can (for grins) put this into my config.yaml for testing.

Another thing I am seeing is this:

[bluetooth]# info C5:B4:F7:XX:XX:XX
Device C5:B4:F7:XX:XX:XX (random)
    Name: Ember Ceramic Mug
    Alias: Ember Ceramic Mug
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: no
    LegacyPairing: no
[bluetooth]# connect C5:B4:F7:XX:XX:XX
Attempting to connect to C5:B4:F7:XX:XX:XX
Failed to connect: org.bluez.Error.Failed
fireheadman commented 2 years ago

do you happen to know which bluetooth related pkgs you have installed? maybe I am missing one/some of them? I never needed bluetooth until today for HA, so stuck a usb dongle in it (since this is a server grade system).

and this is a great link for cmds... https://simpleit.rocks/linux/shell/connect-to-bluetooth-from-cli/

sopelj commented 2 years ago

Oh ok. Yeah, I know you can run it in Docker. I just wasn't sure if it passes through devices automatically or not. I've been using the OVA images for Home Assistant OS in a VM with USB pass-through. I just wasn't sure if the docker running home assistant had access to the Bluetooth dongle automatically. I just ask because the user and hostname looked like a local or server environment as opposed to testing inside the actual Docker/VM running home assistant. It's an important distinction because that's where the integration will be run normally.

The Integration uses a Python package called bleak, but it should be installed automatically since its listed in the packages dependencies. In the docker you would have to have bluez installed. I would thing home assistant includes it already. It definitely does in the Home Assistant OS images.

fireheadman commented 2 years ago

Here's what I have: (just installed the bluez-tools)

fireheadman@lancelot:~$ sudo apt list --installed|grep -i bluez

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

bluez-obexd/oldstable,oldstable,now 5.50-1.2~deb10u2 amd64 [installed,automatic]
bluez-tools/oldstable,now 2.0~20170911.0.7cb788c-2 amd64 [installed]
bluez/oldstable,oldstable,now 5.50-1.2~deb10u2 amd64 [installed,automatic]

And this is 'bluetoothctl' being access from the host OS and from hass (docker container) The values match also between the host to the docker container

HOST OS

fireheadman@lancelot:~$
fireheadman@lancelot:~$ bluetoothctl
Agent registered
[bluetooth]# list
Controller 5C:F3:70:XX:XX:XX lancelot [default]
[bluetooth]# paired-devices
Device C5:B4:F7:XX:XX:XX Ember Ceramic Mug
[bluetooth]# exit
fireheadman@lancelot:~$

DOCKER CONTAINER

fireheadman@lancelot:~$ sudo docker exec -it homeassistant /bin/bash
bash-5.1# bluetoothctl
Agent registered
[bluetooth]# list
Controller 5C:F3:70:XX:XX:XX lancelot [default]
[bluetooth]# paired-devices
Device C5:B4:F7:XX:XX:XX Ember Ceramic Mug
fireheadman commented 2 years ago

swapping out my dongle for another one I found to see if its the dongle that is bad

fireheadman commented 2 years ago

looks like I have painted myself in a corner now. had to unpair (untrust/remove) the Ember Mug from dongle#1.

swapped dongles out, rebooted, verified new dongle was online (MAC is different)... SCAN performed and nothing present. rebooted again, still nothing. swapped back to Dongle#1, rebooted... SCAN performed and nothing.

system can't see the ember at all now. verified my phone can still pair it, then factory reset it (14seconds and back to pairing more). at a lose now. will play more, but guessing something in system is caching or blacklisted my mug/mac.?

fireheadman commented 2 years ago

what a PITA this is... found the cache location

fireheadman@lancelot:~$ sudo ls -la /var/lib/bluetooth/5C:F3:70:XX:XX:XX/cache
total 16
drwx------ 2 root root 4096 Jan  4 14:22 .
drwx------ 3 root root 4096 Jan  4 14:22 ..
-rw------- 1 root root   25 Jan  4 13:10 00:06:80:XX:XX:XX
-rw------- 1 root root   33 Jan  4 14:22 C5:B4:F7:XX:XX:XX

Removed everything, then rebooted... Actually did way to much and not even sure what the issue was, but now it is paired/connected. At this point, gave up on redacting to... it is after all just bluetooth, worst a hacker could do it make my coffee cold? (LOL)

rfkill list (this can show if bluetooth is being blocked... which was one of the last things I messed with)

root@lancelot:~# rfkill list
3: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
4: hci1: Bluetooth
    Soft blocked: yes
    Hard blocked: no
root@lancelot:~# rfkill unblock bluetooth

along with modprobe modprobe -r btusb; modprobe btusb;

combo --> rfkill block bluetooth; rfkill list; /etc/init.d/bluetooth restart;/etc/init.d/bluetooth status;modprobe -r btusb; modprobe btusb;/etc/init.d/bluetooth restart; /etc/init.d/bluetooth status

image

fireheadman commented 2 years ago

problem still exists though..... HA can't see the Ember Mug and debuggin shows nothing, so now that I am back to this stage, I will move it into my config.yaml and restart HA.

fireheadman commented 2 years ago
[Ember Ceramic Mug]# info
Device C5:B4:F7:FB:38:89 (random)
    Name: Ember Ceramic Mug
    Alias: Ember Ceramic Mug
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Vendor specific           (00001530-1212-efde-1523-785feabcd123)
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Vendor specific           (fc543622-236c-4c94-8fa9-944a3e5353fa)
    ManufacturerData Key: 0xffff
    ManufacturerData Value:
  c1

Stepped away for a few min, came back and realized my mistake in this. It isn't an integration, it's just a sensor... so my bad, I totally misinterpreted that.

Now that I have it in the sensors location, here is what the logs are showing:

bash-5.1# grep -i ember home-assistant.log
2022-01-04 16:29:40 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration ember_mug which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-04 16:29:59 INFO (MainThread) [homeassistant.setup] Setting up ember_mug
2022-01-04 16:29:59 INFO (MainThread) [homeassistant.setup] Setup of domain ember_mug took 0.0 seconds
2022-01-04 16:30:00 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ember_mug
2022-01-04 16:30:00 DEBUG (MainThread) [custom_components.ember_mug] Setup platform
2022-01-04 16:30:00 INFO (MainThread) [custom_components.ember_mug] Ember Mug Ember Mug Setup
2022-01-04 16:30:00 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ember_mug entity: sensor.ember_mug
2022-01-04 16:30:00 INFO (MainThread) [custom_components.ember_mug] Start running Ember Mug
2022-01-04 16:30:00 INFO (MainThread) [custom_components.ember_mug] Starting mug loop C5:B4:F7:FB:38:89
2022-01-04 16:30:02 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:02 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:02 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:30:03 DEBUG (MainThread) [custom_components.ember_mug] Update in HASS requested
2022-01-04 16:30:03 WARNING (MainThread) [custom_components.ember_mug] Failed to connect to C5:B4:F7:FB:38:89 after 10 tries. Will try again in 2min
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:32:03 DEBUG (MainThread) [custom_components.ember_mug] Update in HASS requested
2022-01-04 16:32:03 WARNING (MainThread) [custom_components.ember_mug] Failed to connect to C5:B4:F7:FB:38:89 after 10 tries. Will try again in 2min

do I need to unpair this device from bluetoothctl so that homeassistant can pair it?.... little lost at this point

fireheadman commented 2 years ago

went ahead and unpaired the mug from bluetoothctl, then made sure it was seen (but not re-paired). Then restarted HA. This is what I see (pretty much same things as above):

fireheadman@lancelot:~$ sudo docker exec -it homeassistant /bin/bash
[sudo] password for fireheadman:
bash-5.1# tail -f home-assistant.log |grep -i ember
2022-01-04 16:47:27 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ember_mug which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-04 16:47:47 INFO (MainThread) [homeassistant.setup] Setting up ember_mug
2022-01-04 16:47:47 INFO (MainThread) [homeassistant.setup] Setup of domain ember_mug took 0.0 seconds
2022-01-04 16:47:47 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ember_mug
2022-01-04 16:47:47 DEBUG (MainThread) [custom_components.ember_mug] Setup platform
2022-01-04 16:47:47 INFO (MainThread) [custom_components.ember_mug] Ember Mug Ember Mug Setup
2022-01-04 16:47:47 INFO (MainThread) [custom_components.ember_mug] Start running Ember Mug
2022-01-04 16:47:47 INFO (MainThread) [custom_components.ember_mug] Starting mug loop C5:B4:F7:FB:38:89
2022-01-04 16:47:49 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:50 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:50 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:50 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:50 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:50 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:50 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:51 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:51 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:51 ERROR (MainThread) [custom_components.ember_mug] Init: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
2022-01-04 16:47:51 DEBUG (MainThread) [custom_components.ember_mug] Update in HASS requested
2022-01-04 16:47:51 WARNING (MainThread) [custom_components.ember_mug] Failed to connect to C5:B4:F7:FB:38:89 after 10 tries. Will try again in 2min
fireheadman commented 2 years ago

I managed to get this one time...

fireheadman@lancelot:~$ sudo docker exec -it homeassistant /bin/bash
bash-5.1# tail -f home-assistant.log |grep -i ember
2022-01-04 16:53:08 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration ember_mug which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-04 16:53:28 INFO (MainThread) [homeassistant.setup] Setting up ember_mug
2022-01-04 16:53:28 INFO (MainThread) [homeassistant.setup] Setup of domain ember_mug took 0.0 seconds
2022-01-04 16:53:28 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ember_mug
2022-01-04 16:53:29 DEBUG (MainThread) [custom_components.ember_mug] Setup platform
2022-01-04 16:53:29 INFO (MainThread) [custom_components.ember_mug] Ember Mug Ember Mug Setup
2022-01-04 16:53:30 INFO (MainThread) [custom_components.ember_mug] Start running Ember Mug
2022-01-04 16:53:30 INFO (MainThread) [custom_components.ember_mug] Starting mug loop C5:B4:F7:FB:38:89
2022-01-04 16:53:35 INFO (MainThread) [custom_components.ember_mug] Connected to C5:B4:F7:FB:38:89
2022-01-04 16:53:36 INFO (MainThread) [custom_components.ember_mug] Try to subscribe to Push Events
2022-01-04 16:53:36 DEBUG (MainThread) [custom_components.ember_mug] Current temp None
2022-01-04 16:53:36 DEBUG (MainThread) [custom_components.ember_mug] Target temp None
2022-01-04 16:53:36 DEBUG (MainThread) [custom_components.ember_mug] Battery is at 86.0. On base: False
2022-01-04 16:53:36 DEBUG (MainThread) [custom_components.ember_mug] Liquid level now: None
2022-01-04 16:53:37 DEBUG (MainThread) [custom_components.ember_mug] Update in HASS requested

but most of the restarts are hanging up HA, and I see this:

bash-5.1# grep -i ember home-assistant.log
2022-01-04 17:02:27 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration ember_mug which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-04 17:02:46 INFO (MainThread) [homeassistant.setup] Setting up ember_mug
2022-01-04 17:02:46 INFO (MainThread) [homeassistant.setup] Setup of domain ember_mug took 0.0 seconds
2022-01-04 17:02:46 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ember_mug
2022-01-04 17:02:46 DEBUG (MainThread) [custom_components.ember_mug] Setup platform
2022-01-04 17:02:46 INFO (MainThread) [custom_components.ember_mug] Ember Mug Ember Mug Setup
2022-01-04 17:02:46 INFO (MainThread) [custom_components.ember_mug] Start running Ember Mug
2022-01-04 17:02:46 INFO (MainThread) [custom_components.ember_mug] Starting mug loop C5:B4:F7:FB:38:89
2022-01-04 17:02:59 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 1. waiting 30sec
2022-01-04 17:03:09 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 2. waiting 30sec
2022-01-04 17:03:19 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 3. waiting 30sec
2022-01-04 17:03:29 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 4. waiting 30sec
2022-01-04 17:03:40 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 5. waiting 30sec
2022-01-04 17:03:50 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 6. waiting 30sec
2022-01-04 17:04:00 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 7. waiting 30sec
2022-01-04 17:04:10 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 8. waiting 30sec
2022-01-04 17:04:20 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 9. waiting 30sec
2022-01-04 17:04:30 ERROR (MainThread) [custom_components.ember_mug] Init: Device with address C5:B4:F7:FB:38:89 was not found. on attempt 10. waiting 30sec
2022-01-04 17:04:30 DEBUG (MainThread) [custom_components.ember_mug] Update in HASS requested
2022-01-04 17:04:30 WARNING (MainThread) [custom_components.ember_mug] Failed to connect to C5:B4:F7:FB:38:89 after 10 tries. Will try again in 2min

and if you keep another window up with bluetoothctl, you can see that the mug auto-paired from HA, but on a restart it will spew changes like this image

fireheadman commented 2 years ago

so for now I will disable this integration. if you would like another set of eyes to help on it, feel free to ping me. I'm definitely interested in your project.

Curious how far away I can get my mug before bluetooth can't poll it. My server is in the basement and my office is on the other end of the house.

sopelj commented 2 years ago

Oh I'm glad you got it to connect at least once it Home Assistant.

Are you sure you don't have another device that might be paired with it too? That would explain the intermittent connections. Maybe your server and docker both have access to the dongle and they're fighting?

As you can see by the MAC addresses in your bluetoothctl the information it is spewing is not related to the mug, but other devices. Some devices are very noisy especially low energy ones. But that is unrelated to your connection issues.

fireheadman commented 2 years ago

yeah, it was only paired to my iPhone and Android relic I dug out of the archives. Both had the app removed and bluetooth device unpaired.

The mug sat in pairing mode for about 20min, so if something else were to have grabbed it to pair with, the light would have stopped flashing blue.... I might see about getting a long range bluetooth usb dongle instead of these nano ones.

sopelj commented 2 years ago

Hey, have you had any luck since? I made big changes in the 0.2.1. Maybe it will help you. You can no configure it via the UI and it should find your device. So no more needing to know/find your MAC address. However you do still need to be sure to remove your original config and make sure you reset it again before trying.

fireheadman commented 2 years ago

Gave it more thought…. Since I bring my mug in the truck I need the app connected. So this isn’t gonna work for me. I like the idea/concept of it though.

sopelj commented 2 years ago

Oh ok, I could see where that might be a problem. Well, the setup via the UI should solve the "Finding MAC Address problem, so I'll close the issue. If you do end up using it again and have any problems or suggestions don't hesitate to create a new one.