Add Mysensors battery sensor (#100749)
* Move child related stuff to MySensorsChildEntity * Dispatch signal for newly discovered MySensors node * Create battery entity for each MySensors node * Removed ATTR_BATTERY_LEVEL attribute from each node sensor Attribute is redundant with newly introduced battery sensor entity * Apply suggestions from code review --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
6d624ecb46
commit
09729e8c46
18 changed files with 303 additions and 139 deletions
|
@ -470,3 +470,19 @@ def text_node(gateway_nodes: dict[int, Sensor], text_node_state: dict) -> Sensor
|
|||
nodes = update_gateway_nodes(gateway_nodes, text_node_state)
|
||||
node = nodes[1]
|
||||
return node
|
||||
|
||||
|
||||
@pytest.fixture(name="battery_sensor_state", scope="session")
|
||||
def battery_sensor_state_fixture() -> dict:
|
||||
"""Load the battery sensor state."""
|
||||
return load_nodes_state("battery_sensor_state.json")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def battery_sensor(
|
||||
gateway_nodes: dict[int, Sensor], battery_sensor_state: dict
|
||||
) -> Sensor:
|
||||
"""Load the battery sensor."""
|
||||
nodes = update_gateway_nodes(gateway_nodes, deepcopy(battery_sensor_state))
|
||||
node = nodes[1]
|
||||
return node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue