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

Request for RAW data type #89

Closed
Patrick010 opened this issue Sep 11, 2023 · 14 comments
Closed

Request for RAW data type #89

Patrick010 opened this issue Sep 11, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@Patrick010
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

There is no data type available for the relaying of raw BLE data. All data types convert or alter the payload in some way or another.
For my use case I need access to the hex payload as sent by the beacon.
https://community.home-assistant.io/t/bthome-discussion-topic/504361/35 lead to the conclusion that a raw data type will solve this.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add a RAW data type for the relaying of raw BLE data with a length of, say, 24 characters (BLE payloads can become very long, very easy)

Additional context
Add any other context or screenshots about the feature request here.

@Patrick010 Patrick010 added the enhancement New feature or request label Sep 11, 2023
@Ernst79
Copy link
Collaborator

Ernst79 commented Sep 11, 2023

I propose we use the same variable length as for text sensors, not a fixed 24 char length. by using the first byte to indicate how long the byte string is.

@Patrick010
Copy link
Author

Patrick010 commented Oct 1, 2023

@Ernst79, any idea when the PR will be merged?

@Ernst79
Copy link
Collaborator

Ernst79 commented Oct 1, 2023

I was waiting for a review of bdraco, but I think he missed the request. I’ll ask on discord

@Patrick010
Copy link
Author

Thanks

@Patrick010
Copy link
Author

I see it's merged, but docs need to be updated. Can I use 0x54 followed by a length byte, same as the text data type?

@Ernst79
Copy link
Collaborator

Ernst79 commented Oct 3, 2023

Yep, but it isn't added to Home Assistant yet. This won't be before the November release of HA, as the October release is already in beta (no new features can be added now).

@Patrick010
Copy link
Author

That's unfortunate, I'll have to be patient then.
But great that it has been implemented. Thanks once more :)

@Ernst79
Copy link
Collaborator

Ernst79 commented Oct 3, 2023

Docs have been updated now, btw.

@Patrick010
Copy link
Author

Can I manually install this in HA? I tried pip install, but type 0x54 isnt recognised.

@Ernst79
Copy link
Collaborator

Ernst79 commented Oct 3, 2023

Normally, you can copy the homeassistant/components/bthome folder to /config/custom_components/bthome, and than modify manifest.json. A custom component with the same name overrules the built in one. After a restart, it should update the requirements from the manifest.json. But it has been a while since I did this.

@Patrick010
Copy link
Author

Tried this, but doesnt work. I've modified the .json and set "requirements": ["bthome-ble==3.2.0"]
I also had to set a version since this is mandatory for custom components, so I added "version": "3.2.0",
No idea if this correct or if anything else must be done.
Even though it is a highly educational exercise for me, I can imagine that you dont feel like solving this. So I'll have to wait for the next HA update ;)

@Ernst79
Copy link
Collaborator

Ernst79 commented Oct 3, 2023

Ah, sorry, you have to add it to sensor.py as well. Add the following to the SEnSOR_DESCRIPTIONS.

    # Raw (-)
    (BTHomeExtendedSensorDeviceClass.RAW, None): SensorEntityDescription(
        key=str(BTHomeExtendedSensorDeviceClass.RAW),
    ),

I have the PR ready locally, but my development environment is a bit messed up. Have to fix that first

adding the version is ok, that is mandatory, yes. The number doesn’t matter, can be anything

@Patrick010
Copy link
Author

That would explain the Unexpected error updating FF:FF:FF:FF:00:01 data: (<ExtendedSensorDeviceClass.RAW: 'raw'>, None)
Added it to sensor.py and yes! it works 👍

image

@Ernst79
Copy link
Collaborator

Ernst79 commented Oct 6, 2023

The PR to add bthome 3.2.0 for Home Assistant has been merged into development. So, it should be available in HA 2023.11. I'm closing this issue here.

@Ernst79 Ernst79 closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants