Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage and installation #1

Open
verhoop opened this issue Apr 8, 2024 · 16 comments
Open

Usage and installation #1

verhoop opened this issue Apr 8, 2024 · 16 comments

Comments

@verhoop
Copy link

verhoop commented Apr 8, 2024

Installed it via HACS, rebooted the installation to complete.
How do I fail search? (Any debug/output log?)
I'm not seeing any new devices coming up.

@verhoop
Copy link
Author

verhoop commented Apr 8, 2024

When adding the integration there are a lot of Bluetooth devices to choose from. (Around 80) possible all the detected BLE devices. How do I know which one is the Blood pressure monitor?

@bkbilly
Copy link
Owner

bkbilly commented Apr 8, 2024

You can enable debugging from the devices page under the Medisana Blood Pressure BLE integration there is a button to Enable debug logging.

The device is detected automatically, so you don't have to choose from this list.
In order to be discovered on Home Assistant, the blood pressure device should show the Bluetooth icon on the screen and it should be near your Bluetooth Proxy.
I am using the BU 530 connect and the icon is shown after I take a measurement or if I long press the power button. This should be similar to other models, but I haven't used any other to test it out.

@verhoop
Copy link
Author

verhoop commented Apr 9, 2024

Hi, Im using a BU 580 connect, but seems like its the same firmware. (also BT symbol after measurement and hold down to resend)
What kind of a BT proxy are you using? Im using a Shelly 1 plus

@bkbilly
Copy link
Owner

bkbilly commented Apr 9, 2024

I believe that it should work on all Medisana Blood Pressure measurements the same way.
You can use any Bluetooth proxy as long as it supports active connections.
I've tried it on the internal Bluetooth of Raspberry and an ESP32 flashed with ESPHome.

@verhoop
Copy link
Author

verhoop commented Apr 9, 2024 via email

@bkbilly
Copy link
Owner

bkbilly commented Apr 9, 2024

You shouldn't have the app open because only one device can be connected. The pairing process is done automatically by the integration I created.
I am using a Raspberry Pi 4B that has Bluetooth on board and I've installed Home Assistant Operating System.
To enable the Bluetooth I added the Bluetooth integration under the devices page.

@verhoop
Copy link
Author

verhoop commented Apr 9, 2024 via email

@bkbilly
Copy link
Owner

bkbilly commented Apr 9, 2024

Yeah, I've tried both ways and it works.

@verhoop
Copy link
Author

verhoop commented Apr 10, 2024

Thanks, it was the shelly plus device which didnt want to play along.
I ordered an ESP32 and flashed it with Bluetooth Proxy and it worked flawlessly. :)
PS, I got a Medisana Scale as well, there are some integrations done but via python and MQTT.
Would be nice to incorporate it as well. I will try to see if I can alter your code and apply it to the scale as well. (im more an infrastructure guy, not developer)

PPS, Strange.. The initial reading went well. (values popped up in the sensor), second reading the BLM gave me an error E4 (meaning no bluetooth communication. (also with the push start when sleeping part)

@bkbilly
Copy link
Owner

bkbilly commented Apr 10, 2024

Medisana devices depend on subscription to Bluetooth messages which don't work as well as the rest of the BLE integrations of Home Assistant. I've also encountered error codes, but usually the readings are recognized. I don't know how fix this to make sure the values are better recognized.

I found this that might help you find on which topics you should subscribe. Unfortunately I don't have a Medisana scale to help you out. I am using a Xiaomi scale and it works flawlessly.

@verhoop
Copy link
Author

verhoop commented Apr 11, 2024

Thanks, Got another one tho :

ValueError: Invalid datetime: sensor.18_7a_93_e9_1e_46_1e46_measured_date has timestamp device class but provides state 2024-04-10T21:53:00+02:00:<class 'str'> resulting in ''str' object has no attribute 'tzinfo''
2024-04-11 08:08:27.817 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up medisanabp_ble platform for sensor

alueError: Invalid datetime: sensor.18_7a_93_e9_1e_46_1e46_measured_date has timestamp device class but provides state 2024-04-10T21:53:00+02:00:<class 'str'> resulting in ''str' object has no attribute 'tzinfo''
2024-04-11 08:08:27.817 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up medisanabp_ble platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 600, in state
if value.tzinfo is None:
^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'tzinfo'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/medisanabp_ble/sensor.py", line 119, in async_setup_entry
coordinator.async_register_processor(processor, SensorEntityDescription)
File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 341, in async_register_processor
processor.async_register_coordinator(self, entity_description_class)
File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 475, in async_register_coordinator
self.async_update_listeners(data)
File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 567, in async_update_listeners
update_callback(data)
File "/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py", line 677, in _handle_processor_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 611, in state
raise ValueError(
ValueError: Invalid datetime: sensor.18_7a_93_e9_1e_46_1e46_measured_date has timestamp device class but provides state 2024-04-10T21:53:00+02:00:<class 'str'> resulting in ''str' object has no attribute 'tzinfo''
2024-04-11 08:08:27.897 WARNING (MainThread) [homeassistant.components.daikin] Connection failed for 192.168.50.41
2024-04-11 08:13:04.803 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/init.py", line 505, in _async_wrap_bluetooth_connection_error_retry
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^

@verhoop
Copy link
Author

verhoop commented Apr 11, 2024

Same as this?
home-assistant/core@7b7de62

@bkbilly
Copy link
Owner

bkbilly commented Apr 12, 2024

This is already done on my parser here.
I can't think of any reason of why you get this error.

@smartgate-one
Copy link

smartgate-one commented Jun 12, 2024

My Medisana BU 570 will not be automaticly found. Maybe the Manufacterer_id Advertising is named 1872B instead of 18498 ?

If I add this manually only one actual Dataset will be stored.

@bkbilly
Copy link
Owner

bkbilly commented Jun 15, 2024

You can try changing it on the file manifest.json and restart Home Assistant.
If it works, I could add support for the Manufacturer ID of your blood preasure measurement device.

@Joerg98
Copy link

Joerg98 commented Jun 17, 2024

Hi, I have also a BU 570 and have the same issue as @smartgate-one.

Changing the Manufacterer_id did not seem to make a difference. At least in regards receiving records. not sure on the auto-detect.

Here are some logs:

Log1
Log2

I then changed the parser to:
`
try:

        local_timezone = datetime.now(timezone.utc).astimezone().tzinfo
        datetime_str = f"{dyear}/{dmonth}/{dday} {dhour}:{dminu:0>2} {local_timezone}"
        date = datetime.strptime(datetime_str, '%Y/%m/%d %H:%M %Z')
        self.update_sensor(
            key=str(MedisanaBPSensor.TIMESTAMP),
            native_unit_of_measurement=None,
            native_value=date.replace(tzinfo=local_timezone),
            name="Measured Date",
        )
    except:
        _LOGGER.error("Can't add Measured Date")

`
Which at least removed the error message around timezone. But the second error is still there:

Log3

I assume the the device is sending also historic values, the first received (old) record is parsed and then something goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants