diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 286a85d..afacc4c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,47 +1,51 @@ { "name": "Home Assistant Dev Container", "image": "homeassistant/home-assistant:stable", - "runArgs": [ - "-e", - "GIT_EDTIOR='code --wait'" - ], + "runArgs": [ + "-e", + "GIT_EDTIOR='code --wait'" + ], "customizations": { - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance", - "ms-toolsai.jupyter", - "ms-python.black-formatter", - "ms-python.autopep8", - "ms-python.pylint", - "ms-vscode.remote-containers", - "charliermarsh.ruff", - "yzhang.markdown-all-in-one", - "kevinrose.vsc-python-indent", - "keesschollaart.vscode-home-assistant", - "donjayamanne.githistory", - "mhutchie.git-graph", - "mikoz.black-py" - ], - "settings": { - "terminal.integrated.shell.linux": "/bin/bash", - "python.pythonPath": "/usr/local/bin/python", - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.formatting.provider": "black", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter", + "ms-python.black-formatter", + "ms-python.autopep8", + "ms-python.pylint", + "ms-vscode.remote-containers", + "charliermarsh.ruff", + "yzhang.markdown-all-in-one", + "kevinrose.vsc-python-indent", + "keesschollaart.vscode-home-assistant", + "donjayamanne.githistory", + "mhutchie.git-graph", + "mikoz.black-py" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": "/usr/local/bin/python", + "python.formatting.provider": "black", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true + } } }, "mounts": [ - "source=${localWorkspaceFolder}/custom_components,target=/root/.homeassistant/custom_components,type=bind" + "source=${env:HOME}/.ssh,target=/root/.ssh,type=bind,readonly", + "source=${env:HOME}/.ssh/known_hosts,target=/root/.ssh/known_hosts,type=bind,readonly", + "source=${env:HOME}/.gitconfig,target=/root/.gitconfig,type=bind,readonly", + "source=${localWorkspaceFolder}/custom_components,target=/root/.homeassistant/custom_components,type=bind" ], "forwardPorts": [ 8123 ], "remoteEnv": { - "TZ": "Europe/Vilnius" + "TZ": "Europe/Vilnius" }, - "postCreateCommand": "pip install -r requirements.txt && hass" + "postCreateCommand": "pip install -r requirements.txt && hass", + "postStartCommand": "export PYTHONPATH=$(python -c 'import site; print(site.getsitepackages()[0])')" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8273ccf..64b7551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +## Release 0.2.1 + +Date: `2024-07-28` + +### Changes + +- Bumped meteo_lt-pkg to 0.2.1 to change UTC datetime format from "Z" to "+00:00" +- Devcontainer fixes and improvements +- Readme update + +## Release 0.2.0 + +Date: `2024-07-27` + +### Changes + +- Separate sensors for every current conditions attribute +- Added last_updated to all entities to see coordinator working +- Trying to fix updating + ## Release 0.1.8 Date: `2024-07-26` diff --git a/README.md b/README.md index 1ad26a7..39fa144 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,22 @@ Home Assistant integration for Meteo.Lt REST API This integration adds support for retrieving the Forecast data from [Api.Meteo.Lt](https://api.meteo.lt) and setting up following platforms in Home Assistant: -Platform | Description --- | -- -`weather` | A Home Assistant `weather` entity, with current data, and hourly forecast data. The first forecast record is treated as current data. -`sensor` | A Home Assistant `sensor` entity, with all available data taken from the forecast first record. +Platform | Entity ID | Description +-- | -- | -- +`weather`| `weather.meteo_lt_ABCD` | A Home Assistant `weather` entity, with current data, and hourly forecast data. The first forecast record is treated as current data. +`sensor` | `sensor.meteo_lt_ABCD_current_conditions` | Sensor with all available data taken from the forecast first record and native value set to `temperature` +`sensor` | `sensor.meteo_lt_ABCD_temperature` | Sensor with `temperature` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_apparent_temperature` | Sensor with `apparent_temperature` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_wind_speed` | Sensor with `wind_speed` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_wind_gust_speed` | Sensor with `wind_gust_speed` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_wind_bearing` | Sensor with `wind_bearing` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_cloud_coverage` | Sensor with `cloud_coverage` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_pressure` | Sensor with `pressure` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_humidity` | Sensor with `humidity` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_precipitation` | Sensor with `precipitation` attribute taken from the forecast first record +`sensor` | `sensor.meteo_lt_ABCD_condition` | Sensor with `condition` attribute taken from the forecast first record + +Where `ABCD` is name of the nearest place calculated using place list downloaded from `api.meteo.lt` Implementation has been done using Home Assistant version **2024.7.3**. Older versions could work too as long as the new Weather entity forecast types exist. Integration does **not** create Forecast Attributes. @@ -39,7 +51,7 @@ If you are not familiar with HACS, or haven't installed it, I would recommend to 1. Restart Home Assistant 1. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Meteo.Lt": - Enter latitude and longitude to use for the integration. Default values are Home Assistant Home location. - - Unlimitted number of locations is supported - `weather.meteo_lt_ABCD` and `sensor.meteo_lt_ABCD_current_conditions` entities are created where `ABCD` is name of the nearest calculated place from available places in api.meteo.lt. Note, that if an entity for the same place exists, new entity gets numeric suffix to the name. + - Unlimitted number of locations is supported. If an entity for the same place exists, new entity gets numeric suffix to the name. ## Enable Debug Logging diff --git a/custom_components/meteo_lt/manifest.json b/custom_components/meteo_lt/manifest.json index b6055a9..62c79ff 100644 --- a/custom_components/meteo_lt/manifest.json +++ b/custom_components/meteo_lt/manifest.json @@ -1,14 +1,20 @@ { "domain": "meteo_lt", "name": "Meteo.Lt", - "codeowners": ["@Brunas"], + "codeowners": [ + "@Brunas" + ], "config_flow": true, "dependencies": [], "documentation": "https://github.com/Brunas/meteo_lt", "integration_type": "service", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/Brunas/meteo_lt/issues", - "loggers": ["meteo_lt"], - "requirements": ["meteo_lt-pkg==0.2.0"], - "version": "0.2.0" + "loggers": [ + "meteo_lt" + ], + "requirements": [ + "meteo_lt-pkg==0.2.1" + ], + "version": "0.2.1" } \ No newline at end of file diff --git a/custom_components/meteo_lt/sensor.py b/custom_components/meteo_lt/sensor.py index ac1eb50..f238363 100644 --- a/custom_components/meteo_lt/sensor.py +++ b/custom_components/meteo_lt/sensor.py @@ -1,5 +1,7 @@ """sensor.py""" +# pylint: disable=too-many-arguments + from typing import Dict, Any from homeassistant.components.sensor import SensorEntity from homeassistant.const import (