From fe623519943544bf9896cf6be76075d45b2e1ba3 Mon Sep 17 00:00:00 2001 From: reemo3dp <150130755+reemo3dp@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:51:06 +0100 Subject: [PATCH] Add support for TMC2240 temperature sensors (#293) --- custom_components/moonraker/sensor.py | 1 + tests/conftest.py | 4 ++++ tests/test_sensor.py | 1 + 3 files changed, 6 insertions(+) diff --git a/custom_components/moonraker/sensor.py b/custom_components/moonraker/sensor.py index ff917b0..020ceae 100755 --- a/custom_components/moonraker/sensor.py +++ b/custom_components/moonraker/sensor.py @@ -354,6 +354,7 @@ async def async_setup_optional_sensors(coordinator, entry, async_add_entities): temperature_keys = [ "temperature_sensor", "temperature_fan", + "tmc2240", "bme280", "htu21d", "lm75", diff --git a/tests/conftest.py b/tests/conftest.py index cef26eb..aa4c5de 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -106,6 +106,9 @@ def get_data_fixture(): "bme280 bme280_temp": { "temperature": 32.43, }, + "tmc2240 tmc2240_stepper_x_temp": { + "temperature": 32.43, + }, "htu21d htu21d_temp": { "temperature": 32.43, }, @@ -269,6 +272,7 @@ def get_printer_objects_list_fixture(): "temperature_fan fan_temp", "temperature_host host_temp", "bme280 bme280_temp", + "tmc2240 tmc2240_stepper_x_temp", "htu21d htu21d_temp", "lm75 lm75_temp", "heater_fan heater_fan", diff --git a/tests/test_sensor.py b/tests/test_sensor.py index e6935e7..219f284 100755 --- a/tests/test_sensor.py +++ b/tests/test_sensor.py @@ -91,6 +91,7 @@ async def test_sensor_services_update(hass, get_data): ("mainsail_extruder_power", "66"), ("mainsail_fan_speed", "51.23"), ("mainsail_fan_temp", "32.43"), + ("mainsail_tmc2240_stepper_x_temp", "32.43"), ("mainsail_bme280_temp", "32.43"), ("mainsail_htu21d_temp", "32.43"), ("mainsail_lm75_temp", "32.43"),