Bump thermopro-ble to 0.9.0 (#108820)

pull/108826/head
John Hess 2024-01-24 20:26:58 -07:00 committed by GitHub
parent f5d439799b
commit 7f56330e3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 109 additions and 7 deletions

View File

@ -1351,8 +1351,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/tfiac/ @fredrike @mellado
/homeassistant/components/thermobeacon/ @bdraco
/tests/components/thermobeacon/ @bdraco
/homeassistant/components/thermopro/ @bdraco
/tests/components/thermopro/ @bdraco
/homeassistant/components/thermopro/ @bdraco @h3ss
/tests/components/thermopro/ @bdraco @h3ss
/homeassistant/components/thethingsnetwork/ @fabaff
/homeassistant/components/thread/ @home-assistant/core
/tests/components/thread/ @home-assistant/core

View File

@ -15,10 +15,10 @@
"connectable": false
}
],
"codeowners": ["@bdraco"],
"codeowners": ["@bdraco", "@h3ss"],
"config_flow": true,
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/thermopro",
"iot_class": "local_push",
"requirements": ["thermopro-ble==0.8.0"]
"requirements": ["thermopro-ble==0.9.0"]
}

View File

@ -2672,7 +2672,7 @@ tessie-api==0.0.9
thermobeacon-ble==0.6.2
# homeassistant.components.thermopro
thermopro-ble==0.8.0
thermopro-ble==0.9.0
# homeassistant.components.thermoworks_smoke
thermoworks-smoke==0.1.8

View File

@ -2028,7 +2028,7 @@ tessie-api==0.0.9
thermobeacon-ble==0.6.2
# homeassistant.components.thermopro
thermopro-ble==0.8.0
thermopro-ble==0.9.0
# homeassistant.components.tilt_ble
tilt-ble==0.2.3

View File

@ -23,3 +23,23 @@ TP357_SERVICE_INFO = BluetoothServiceInfo(
service_data={},
source="local",
)
TP962R_SERVICE_INFO = BluetoothServiceInfo(
name="TP962R (0000)",
manufacturer_data={14081: b"\x00;\x0b7\x00"},
service_uuids=["72fbb631-6f6b-d1ba-db55-2ee6fdd942bd"],
address="aa:bb:cc:dd:ee:ff",
rssi=-52,
service_data={},
source="local",
)
TP962R_SERVICE_INFO_2 = BluetoothServiceInfo(
name="TP962R (0000)",
manufacturer_data={17152: b"\x00\x17\nC\x00", 14081: b"\x00;\x0b7\x00"},
service_uuids=["72fbb631-6f6b-d1ba-db55-2ee6fdd942bd"],
address="aa:bb:cc:dd:ee:ff",
rssi=-52,
service_data={},
source="local",
)

View File

@ -4,12 +4,94 @@ from homeassistant.components.thermopro.const import DOMAIN
from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT
from homeassistant.core import HomeAssistant
from . import TP357_SERVICE_INFO
from . import TP357_SERVICE_INFO, TP962R_SERVICE_INFO, TP962R_SERVICE_INFO_2
from tests.common import MockConfigEntry
from tests.components.bluetooth import inject_bluetooth_service_info
async def test_sensors_tp962r(hass: HomeAssistant) -> None:
"""Test setting up creates the sensors."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id="aa:bb:cc:dd:ee:ff",
)
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 0
inject_bluetooth_service_info(hass, TP962R_SERVICE_INFO)
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 3
temp_sensor = hass.states.get("sensor.tp962r_0000_probe_2_internal_temperature")
temp_sensor_attributes = temp_sensor.attributes
assert temp_sensor.state == "25"
assert (
temp_sensor_attributes[ATTR_FRIENDLY_NAME]
== "TP962R (0000) Probe 2 Internal Temperature"
)
assert temp_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "°C"
assert temp_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
temp_sensor = hass.states.get("sensor.tp962r_0000_probe_2_ambient_temperature")
temp_sensor_attributes = temp_sensor.attributes
assert temp_sensor.state == "25"
assert (
temp_sensor_attributes[ATTR_FRIENDLY_NAME]
== "TP962R (0000) Probe 2 Ambient Temperature"
)
assert temp_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "°C"
assert temp_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
battery_sensor = hass.states.get("sensor.tp962r_0000_probe_2_battery")
battery_sensor_attributes = battery_sensor.attributes
assert battery_sensor.state == "100"
assert (
battery_sensor_attributes[ATTR_FRIENDLY_NAME] == "TP962R (0000) Probe 2 Battery"
)
assert battery_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "%"
assert battery_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
inject_bluetooth_service_info(hass, TP962R_SERVICE_INFO_2)
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 6
temp_sensor = hass.states.get("sensor.tp962r_0000_probe_1_internal_temperature")
temp_sensor_attributes = temp_sensor.attributes
assert temp_sensor.state == "37"
assert (
temp_sensor_attributes[ATTR_FRIENDLY_NAME]
== "TP962R (0000) Probe 1 Internal Temperature"
)
assert temp_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "°C"
assert temp_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
temp_sensor = hass.states.get("sensor.tp962r_0000_probe_1_ambient_temperature")
temp_sensor_attributes = temp_sensor.attributes
assert temp_sensor.state == "37"
assert (
temp_sensor_attributes[ATTR_FRIENDLY_NAME]
== "TP962R (0000) Probe 1 Ambient Temperature"
)
assert temp_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "°C"
assert temp_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
battery_sensor = hass.states.get("sensor.tp962r_0000_probe_1_battery")
battery_sensor_attributes = battery_sensor.attributes
assert battery_sensor.state == "82.0"
assert (
battery_sensor_attributes[ATTR_FRIENDLY_NAME] == "TP962R (0000) Probe 1 Battery"
)
assert battery_sensor_attributes[ATTR_UNIT_OF_MEASUREMENT] == "%"
assert battery_sensor_attributes[ATTR_STATE_CLASS] == "measurement"
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async_block_till_done()
async def test_sensors(hass: HomeAssistant) -> None:
"""Test setting up creates the sensors."""
entry = MockConfigEntry(