diff --git a/custom_components/nea_sg_weather/sensor.py b/custom_components/nea_sg_weather/sensor.py index 1831615a38..52f6923a23 100644 --- a/custom_components/nea_sg_weather/sensor.py +++ b/custom_components/nea_sg_weather/sensor.py @@ -243,6 +243,29 @@ def state(self): """Return the weather condition.""" return self.coordinator.data.rain.data[self._rain_sensor_id]["value"] + @property + def entity_picture(self): + """Return the entity picture url to display rainfall quantity""" + rainfall_quantity = ( + 0 + if self.state == 0 + else 0.2 + if self.state < 0.35 + else 0.5 + if self.state < 0.75 + else 1 + if self.state < 1.5 + else 2 + if self.state < 2.5 + else 3 + if self.state < 3.5 + else 4 + if self.state < 4.5 + else 5 + ) + + return "/local/weather/" + str(rainfall_quantity) + ".png" + @property def extra_state_attributes(self) -> dict: """Return dict of additional properties to attach to sensors.""" diff --git a/custom_components/nea_sg_weather/www/weather/0.2.png b/custom_components/nea_sg_weather/www/weather/0.2.png new file mode 100644 index 0000000000..3b75670796 Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/0.2.png differ diff --git a/custom_components/nea_sg_weather/www/weather/0.5.png b/custom_components/nea_sg_weather/www/weather/0.5.png new file mode 100644 index 0000000000..4e99e85ed2 Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/0.5.png differ diff --git a/custom_components/nea_sg_weather/www/weather/0.png b/custom_components/nea_sg_weather/www/weather/0.png new file mode 100644 index 0000000000..e3ccac059b Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/0.png differ diff --git a/custom_components/nea_sg_weather/www/weather/1.png b/custom_components/nea_sg_weather/www/weather/1.png new file mode 100644 index 0000000000..ec22ea17e5 Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/1.png differ diff --git a/custom_components/nea_sg_weather/www/weather/2.png b/custom_components/nea_sg_weather/www/weather/2.png new file mode 100644 index 0000000000..3b033ca1a6 Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/2.png differ diff --git a/custom_components/nea_sg_weather/www/weather/3.png b/custom_components/nea_sg_weather/www/weather/3.png new file mode 100644 index 0000000000..2d0de07b79 Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/3.png differ diff --git a/custom_components/nea_sg_weather/www/weather/4.png b/custom_components/nea_sg_weather/www/weather/4.png new file mode 100644 index 0000000000..0978db4845 Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/4.png differ diff --git a/custom_components/nea_sg_weather/www/weather/5.png b/custom_components/nea_sg_weather/www/weather/5.png new file mode 100644 index 0000000000..6bf859b90a Binary files /dev/null and b/custom_components/nea_sg_weather/www/weather/5.png differ