Skip to content

Commit

Permalink
feat: add speed factor sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJefe committed Sep 20, 2023
1 parent 9044226 commit b42f0a6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions custom_components/moonraker/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,18 @@ async def async_setup_optional_sensors(coordinator, entry, async_add_entities):
unit=PERCENTAGE,
)
sensors.append(desc)
elif obj == "gcode_move":
desc = MoonrakerSensorDescription(
key="speed_factor",
name="Speed factor",
value_fn=lambda sensor: round(
sensor.coordinator.data["status"]["gcode_move"]["speed_factor"] * 100, 2
),
subscriptions=[("gcode_move", "speed_factor")],
icon="mdi:speedometer",
unit=PERCENTAGE,
)
sensors.append(desc)

coordinator.load_sensor_data(sensors)
await coordinator.async_refresh()
Expand Down

0 comments on commit b42f0a6

Please sign in to comment.