From 3bbb17186b41d142314db52585d494f761f011a6 Mon Sep 17 00:00:00 2001 From: Marc-Olivier Arsenault Date: Sun, 7 Apr 2024 23:44:44 +0000 Subject: [PATCH] Fix dev container setupe --- .devcontainer/devcontainer.json | 3 ++- custom_components/moonraker/sensor.py | 12 +++++++++--- scripts/setup | 2 -- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b806cec..9b4f695 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,7 +11,8 @@ "charliermarsh.ruff", "ms-python.vscode-pylance", "ryanluker.vscode-coverage-gutters", - "esbenp.prettier-vscode" + "esbenp.prettier-vscode", + "ms-vscode.live-server" ], "settings": { "[python]": { diff --git a/custom_components/moonraker/sensor.py b/custom_components/moonraker/sensor.py index 2872d50..31c7d14 100755 --- a/custom_components/moonraker/sensor.py +++ b/custom_components/moonraker/sensor.py @@ -11,7 +11,13 @@ SensorEntityDescription, SensorStateClass, ) -from homeassistant.const import PERCENTAGE, UnitOfLength, UnitOfPressure, UnitOfTemperature, UnitOfTime +from homeassistant.const import ( + PERCENTAGE, + UnitOfLength, + UnitOfPressure, + UnitOfTemperature, + UnitOfTime, +) from homeassistant.core import callback from .const import OBJ, DOMAIN, METHODS, PRINTERSTATES, PRINTSTATES @@ -339,7 +345,8 @@ async def async_setup_optional_sensors(coordinator, entry, async_add_entities): desc = MoonrakerSensorDescription( key=f"{split_obj[0]}_{split_obj[1]}", status_key=obj, - name=split_obj[1].removesuffix("_temp").replace("_", " ").title() + " Temp", + name=split_obj[1].removesuffix("_temp").replace("_", " ").title() + + " Temp", value_fn=lambda sensor: sensor.coordinator.data["status"][ sensor.status_key ]["temperature"], @@ -401,7 +408,6 @@ async def async_setup_optional_sensors(coordinator, entry, async_add_entities): ) sensors.append(desc) - elif split_obj[0] in fan_keys: desc = MoonrakerSensorDescription( key=f"{split_obj[0]}_{split_obj[1]}", diff --git a/scripts/setup b/scripts/setup index 38089cf..c371576 100755 --- a/scripts/setup +++ b/scripts/setup @@ -10,7 +10,5 @@ sudo apt-get install -y libturbojpeg0 ffmpeg python3 -m pip install --requirement requirements.txt -# https://github.com/home-assistant/core/issues/95192 -pip install git+https://github.com/boto/botocore pre-commit install