Skip to content

Commit

Permalink
Convert to TireLinc integration (#1)
Browse files Browse the repository at this point in the history
* initial parser

* additional sensors

* additional sensors

* uncomment signal_strength

* initial multiple sensor updates

* add .DS_Store to .gitignore

* Refactor to TireLinc

* Rename component folder

* update LICENSE

* update readme

* update readme

* update readme

* update readme
  • Loading branch information
k3vmcd authored May 14, 2024
1 parent 3ec5cbc commit 2338aad
Show file tree
Hide file tree
Showing 19 changed files with 389 additions and 242 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2024 Vasilis Koulis
Copyright (c) 2024 Kevin McDonald

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
51 changes: 40 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
[![GitHub Release](https://img.shields.io/github/release/bkbilly/medisanabp_ble.svg?style=flat-square)](https://github.com/bkbilly/medisanabp_ble/releases)
[![License](https://img.shields.io/github/license/bkbilly/medisanabp_ble.svg?style=flat-square)](LICENSE)
[![GitHub Release](https://img.shields.io/github/release/k3vmcd/ha-tirelinc.svg?style=flat-square)](https://github.com/k3vmcd/ha-tirelinc/releases)
[![License](https://img.shields.io/github/license/k3vmcd/ha-tirelinc.svg?style=flat-square)](LICENSE)
[![hacs](https://img.shields.io/badge/HACS-default-orange.svg?style=flat-square)](https://hacs.xyz)


# Medisana Blood Pressure BLE
Integrates Bluetooth LE (https://www.medisana.com/en/Health-control/Blood-pressure-monitor/) to Home Assistant using active connection to get infromation from the sensors.
# Home Assistant TireLinc Integration
Integrates TireLinc TPMS (https://www.lippert.com/rv-camping/collections/tire-linc) to Home Assistant using active connection to get information from the sensors.

Current Limitations:
- You MUST successfully pair the tires to the central TireLinc repeater using the manufacturer device before data will be received by this integration. The tires report their sensor data on the 433MHz band and the central repeater unit translates that into the Bluetooth signal required by this integration. This integration will NOT read the 433MHz data directly.
- Scans 4 tires only. May throw errors with 2 tires and currently will not scan 6 tires. (The user may manually adjust the code to edit the number of tires scanned by editing `./sensor.py`, `./tirelinc/const.py`, and `./tirelinc/parser.py`).
- Code that could possibly expose the configured alert thresholds is currently unused and will not expose these sensors (unless user manually adds the sensors with additional edits to sensor.py). It is left in there to decode what was discovered in reverse engineering the hex data bytes. These thresholds - min/max pressure, max temperature, and max temperature change alerts - are configured in the manufactuerer device. The expectation of this integration is the user would configure native Home Assistant automations and set their own, separate thresholds within Home Assistant and therefore these manufacturer data would be irrelevant/confusing.
- There is a known issue with polling frequency. During testing, the polling interval is shown to be quite random and range from 3 minutes up to more than 1 hour in between updates.
- The TireLinc system regularly "loses" sensors and it is not possible for this integration to correct this shortcoming. Usually the TireLinc system should update every 15 minutes when stationary and every 5 minutes when moving. However, sometimes specific sensors do not report in until they move, and even then their update frequency is not always a consistent 5 minute interval. Potentially this is related to signal/noise ratio between the tire sensors and the central repeater. Yet, for the developer, this integration is shown to be more reliable than the manufacturer unit to report the most current data the central repeater has on each tire.


Exposes the following sensors:
- Battery
- Diastolic pressure
- Systolic pressure
- Pulses
- Measured date
- Tire 1 Pressure
- Tire 1 Temperature
- Tire 2 Pressure
- Tire 2 Temperature
- Tire 3 Pressure
- Tire 3 Temperature
- Tire 4 Pressure
- Tire 4 Temperature

In a 4 tire setup, the tire locations will be:
- Tire 1: Front Left
- Tire 2: Rear Left
- Tire 3: Front Right
- Tire 4: Rear Right

## Installation

Easiest install is via [HACS](https://hacs.xyz/):

[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=bkbilly&repository=medisanabp_ble&category=integration)
[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=k3vmcd&repository=ha-tirelinc&category=integration)

`HACS -> Explore & Add Repositories -> Medisana Blood Pressure BLE`
`HACS -> Explore & Add Repositories -> TireLinc`

The device will be autodiscovered once the data are received by any bluetooth proxy.

If you are using an ESPHome device to connect to TireLinc, ensure you have it configured with:

```
bluetooth_proxy:
active: True
```
and, as the ESPHome docs suggest to improve RAM management:
```
framework:
type: esp-idf
```
3 changes: 0 additions & 3 deletions custom_components/medisanabp_ble/const.py

This file was deleted.

18 changes: 0 additions & 18 deletions custom_components/medisanabp_ble/manifest.json

This file was deleted.

5 changes: 0 additions & 5 deletions custom_components/medisanabp_ble/medisana_bp/const.py

This file was deleted.

152 changes: 0 additions & 152 deletions custom_components/medisanabp_ble/medisana_bp/parser.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""The MedisanaBP integration."""
"""The TireLinc integration."""

from __future__ import annotations

Expand All @@ -17,7 +17,7 @@
from homeassistant.const import Platform
from homeassistant.core import CoreState, HomeAssistant

from .medisana_bp import MedisanaBPBluetoothDeviceData, SensorUpdate
from .tirelinc import TireLincBluetoothDeviceData, SensorUpdate
from .const import DOMAIN

PLATFORMS: list[Platform] = [Platform.SENSOR]
Expand All @@ -26,10 +26,10 @@


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up MedisanaBP BLE device from a config entry."""
"""Set up TireLinc BLE device from a config entry."""
address = entry.unique_id
assert address is not None
data = MedisanaBPBluetoothDeviceData()
data = TireLincBluetoothDeviceData()

def _needs_poll(
service_info: BluetoothServiceInfoBleak, last_poll: float | None
Expand All @@ -47,8 +47,6 @@ def _needs_poll(
)

async def _async_poll(service_info: BluetoothServiceInfoBleak) -> SensorUpdate:
# BluetoothServiceInfoBleak is defined in HA, otherwise would just pass it
# directly to the elissabp code
# Make sure the device we have is one that we can connect with
# in case its coming from a passive scanner
if service_info.connectable:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Config flow for MedisanaBP BLE integration."""
"""Config flow for TireLinc integration."""

from __future__ import annotations

Expand All @@ -14,19 +14,19 @@
from homeassistant.data_entry_flow import FlowResult
from homeassistant.const import CONF_ADDRESS

from .medisana_bp import MedisanaBPBluetoothDeviceData
from .tirelinc import TireLincBluetoothDeviceData
from .const import DOMAIN


class MedisanaBPConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for MedisanaBP."""
class TireLincConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for TireLinc"""

VERSION = 1

def __init__(self) -> None:
"""Initialize the config flow."""
self._discovery_info: BluetoothServiceInfoBleak | None = None
self._discovered_device: MedisanaBPBluetoothDeviceData | None = None
self._discovered_device: TireLincBluetoothDeviceData | None = None
self._discovered_devices: dict[str, str] = {}

async def async_step_bluetooth(
Expand All @@ -35,7 +35,7 @@ async def async_step_bluetooth(
"""Handle the bluetooth discovery step."""
await self.async_set_unique_id(discovery_info.address)
self._abort_if_unique_id_configured()
device = MedisanaBPBluetoothDeviceData()
device = TireLincBluetoothDeviceData()
if not device.supported(discovery_info):
return self.async_abort(reason="not_supported")
self._discovery_info = discovery_info
Expand Down Expand Up @@ -78,7 +78,7 @@ async def async_step_user(
address = discovery_info.address
if address in current_addresses or address in self._discovered_devices:
continue
device = MedisanaBPBluetoothDeviceData()
device = TireLincBluetoothDeviceData()
if device.supported(discovery_info):
self._discovered_devices[address] = (
device.title or device.get_device_name() or discovery_info.name
Expand Down
3 changes: 3 additions & 0 deletions custom_components/tirelinc/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Constants for TireLinc"""

DOMAIN = "tirelinc"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Constants for MedisanaBP BLE."""
"""Constants for TireLinc"""

from __future__ import annotations

from .medisana_bp import DeviceKey
from .tirelinc import DeviceKey

from homeassistant.components.bluetooth.passive_update_processor import (
PassiveBluetoothEntityKey,
Expand Down
18 changes: 18 additions & 0 deletions custom_components/tirelinc/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"domain": "tirelinc",
"name": "TireLinc TPMS",
"bluetooth": [
{
"local_name": "TireLinc*",
"connectable": true
}
],
"codeowners": ["@k3vmcd"],
"config_flow": true,
"dependencies": ["bluetooth_adapters"],
"documentation": "https://github.com/k3vmcd/ha-tirelinc",
"iot_class": "local_push",
"issue_tracker": "https://github.com/k3vmcd/ha-tirelinc/issues",
"requirements": [],
"version": "0.1.0"
}
Loading

0 comments on commit 2338aad

Please sign in to comment.