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

How to use this as standalone? #34

Closed
e-minguez opened this issue Feb 13, 2020 · 16 comments
Closed

How to use this as standalone? #34

e-minguez opened this issue Feb 13, 2020 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@e-minguez
Copy link

e-minguez commented Feb 13, 2020

First thing is first, so thank you for this project, it really improves the current status of the sensors in home assistant.
My question is more related on how to use as standalone or as a library to be integrated in something like this https://github.com/algirdasc/xiaomi-ble-mqtt
The use case is to be able to use a simple device such as rpi to gather the data and send it to home assistant via mqtt for those sensors that the home assistant bluetooth device cannot reach.
See algirdasc/xiaomi-ble-mqtt#17 for the 'reverse' issue.

Thanks!

@Magalex2x14
Copy link
Collaborator

Magalex2x14 commented Feb 13, 2020

Hello!

The first thing that comes to mind is to use a device with ESPHome firmware, which also uses a passive method and has a native api for integration into HA. At the moment, it supports: LYWSDCGQ, LYWSD02, CGG1, HHCCJCY01.

The second option is a custom component remote_homeassistant. I have not tried it, but the description is exactly what you need. Quote:
"The master instance connects to the Websocket APIs of the secondary instance ...
After the connection is completed, the remote states get populated into the master instance. The entity ids can optionally be prefixed via the entity_prefix parameter.
A possible use case for this is to be able to use different Z-Wave networks, on different Z-Wave sticks (with the second one possible running on another computer in a different location)."

@Magalex2x14
Copy link
Collaborator

But I’ll consider the idea of ​​implementing our component as a separate executable or library.

@Magalex2x14 Magalex2x14 added the enhancement New feature or request label Feb 13, 2020
@hancockks
Copy link

A standalone library would be great!

@mplinuxgeek
Copy link

+1
I'd love to be able to use this stand alone on a Raspberry Pi Zero to feed Home Assistant without the overhead of running a Home Assistant instance.

@deviant-aut
Copy link

thanks for your efforts so far.
something like mitemp_bt2mqtt would be great!

@sremy91
Copy link

sremy91 commented Nov 9, 2020

Hi,

It would be indeed nice to get a standalone version. I'll have a look to ESPHome, is it able to make it working? I mean, can we use ESPHome to get those sensor data to a custom app (and not Home Assistant)?

Thanks

@borpin
Copy link

borpin commented Feb 7, 2021

On the basis of the errors I have seen with Multiple BT devices, It would be great if there was a 'wrapper' that enabled this component to be used as a standalone system on any Linux device.

@SAOPP
Copy link

SAOPP commented Jul 28, 2021

Guys, the topic is dead?

@Ernst79
Copy link
Collaborator

Ernst79 commented Jul 28, 2021

No, it's not dead, but it isn't high on the priority list.

Last months, I've moved the parser towards a separate folder, which allows it to be moved to an external pypi package in the future, if we want. But it still depends on BLE monitor configuration options, like report_unknown. I'm afraid that it won't happen very fast, as my time is limited and other issues are higher on the priority list.

@SAOPP
Copy link

SAOPP commented Jul 28, 2021

Okay, great, thanks for your answer!

Of course, having stand-alone mode, one could get more user experience. Since the dongle is not always convenient to use. For example, when your server is outside the coverage area of ​​the required territory.

@salleq
Copy link

salleq commented Jul 29, 2021

I also wish a standalone version of this to feed my HA through MQTT or something similar. The reason I don't use ESPhome for this is the lousy BT signal of ESP32. Raspberry PI has so much better BT hardware.
EDIT: For now I'm going to circumvent this by sending my auxiliary HA installation sensor data to influxDB which - I'm already using for grabbing these BTle sensors from.

@pethans
Copy link

pethans commented Jul 31, 2021

Perhaps consider a feature enhancement to specify and read data from an MQTT topic, e.g. messages with a “MAC” and “data” JSON fields, and parse the data as if it were scanned from the local hci.

As a start, this would enable third-party scanner code to have an interface to which they can send encapsulated raw ble frames and know they’ll get parsed without having to replicate this integration’s intelligence. At some point, this integration could release official “satellite scanner” code that runs on other platforms (python, esp32, android, etc). Would this work?

@Ernst79
Copy link
Collaborator

Ernst79 commented Aug 1, 2021

Ok guys, I've started to work on this. I'll keep track on the process in this post

  • create relevant parts of the ble_parser as input parameter (report_unkonwn, discovery, whitelist, aeskeys, tracker_list)
  • create defaults in ble_parser that are now in ble_monitor __init__.py (adv_priority, movement_list, lpacket_ids`).
  • Update ble_monitor with the above changes (4.4.0)
  • Create testpypi for testing
  • Create new github for ble_parser (https://github.com/Ernst79/bleparser)
  • Write documentation (minimum first documentation)
  • Release ble_parser on pypi
  • Update ble_monitor to use pypi package

The aim is that we create a pypi package that does the parsing, so it only will convert an advertisement to a dictionary with readable data. The data collecting should be done with other packages, like aioblescan (this is what ble_monitor uses), bleson, etc, etc.

@Ernst79 Ernst79 self-assigned this Aug 1, 2021
@Ernst79
Copy link
Collaborator

Ernst79 commented Aug 2, 2021

So, the first release is online (0.1.0). You can install it with pip install bleparser

@Magalex2x14 @Thrilleratplay, I will add you both to the repository as editors.

I will wait a couple of weeks before switching with BLE monitor to use bleparser, due to my holidays. During this time, people can test and report bugs if they want to use it for their own projects. After that, I propose to switch and use bleparser.

https://github.com/Ernst79/bleparser
https://pypi.org/project/bleparser

@freol35241
Copy link

freol35241 commented Sep 7, 2021

@Ernst79 thanks for the separate library!

For what its worth, to anyone interested in a bare minimum ble2mqtt python script based on aioblescan and bleparser:
https://gist.github.com/freol35241/48ca1d5e388b6892990dfd7fd6b3d2a2

@Ernst79
Copy link
Collaborator

Ernst79 commented Sep 11, 2021

@freol35241 I've added your mqtt example to the bleparser repository in the examples folder. Thanks.

I'm closing this issue, as it is resolved with
https://github.com/Ernst79/bleparser
https://pypi.org/project/bleparser

@Ernst79 Ernst79 closed this as completed Sep 11, 2021
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