Skip to content

Commit

Permalink
chore: update fixture to test sensor and correct linting
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJefe committed Nov 18, 2023
1 parent 1848898 commit 6231bd3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion custom_components/moonraker/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ async def async_setup_optional_sensors(coordinator, entry, async_add_entities):
key="speed_factor",
name="Speed factor",
value_fn=lambda sensor: round(
sensor.coordinator.data["status"]["gcode_move"]["speed_factor"] * 100, 2
sensor.coordinator.data["status"]["gcode_move"]["speed_factor"]
* 100,
2,
),
subscriptions=[("gcode_move", "speed_factor")],
icon="mdi:speedometer",
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_data_fixture():
},
"gcode_move": {
"speed_factor": 2.0,
}
},
},
"printer.info": {
"result": {
Expand Down
1 change: 1 addition & 0 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ async def test_sensor_services_update(hass, get_data):
("mainsail_toolhead_position_z", "10.2"),
("mainsail_slicer_print_duration_estimate", "8232.0"),
("mainsail_object_height", "62.6"),
("mainsail_speed_factor", "200.0"),
],
)
async def test_sensors(
Expand Down

0 comments on commit 6231bd3

Please sign in to comment.