[openweathermap] Fix visibility channels (#18597)

* fix visibility channel

Signed-off-by: Hans Böhm <h.boehm@gmx.at>
This commit is contained in:
Hans Böhm
2025-04-24 13:43:52 +02:00
committed by GitHub
parent 378817d2f1
commit 7fe840abc8
4 changed files with 11 additions and 2 deletions
@@ -496,7 +496,7 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
/**
* Update the hourly forecast time series channel from the last OpenWeatherMap data retrieved.
*
*
* @param channelUID the id identifying the channel to be updated
*/
private void updateHourlyForecastTimeSeries(ChannelUID channelUID) {
@@ -583,6 +583,7 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
State tempstate = new QuantityType<>(localWeatherData.getCurrent().getVisibility(), METRE)
.toUnit(KILO(METRE));
state = (tempstate == null ? state : tempstate);
break;
case CHANNEL_PRECIP_PROBABILITY:
state = getQuantityTypeState(forecastData.getPop() * 100.0, PERCENT);
break;
@@ -788,6 +789,7 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
State tempstate = new QuantityType<>(localWeatherData.getCurrent().getVisibility(), METRE)
.toUnit(KILO(METRE));
state = (tempstate == null ? state : tempstate);
break;
case CHANNEL_PRECIP_PROBABILITY:
state = getQuantityTypeState(forecastData.getPop() * 100.0, PERCENT);
break;
@@ -305,6 +305,7 @@ public class OpenWeatherMapOneCallHistoryHandler extends AbstractOpenWeatherMapH
@Nullable
State tempstate = new QuantityType<>(historyData.getVisibility(), METRE).toUnit(KILO(METRE));
state = (tempstate == null ? state : tempstate);
break;
case CHANNEL_RAIN:
Precipitation rain = historyData.getRain();
state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
@@ -241,7 +241,7 @@
</channel-groups>
<properties>
<property name="thingTypeVersion">2</property>
<property name="thingTypeVersion">3</property>
</properties>
<representation-property>location</representation-property>
@@ -157,6 +157,12 @@
<type>openweathermap:moon-phase</type>
</add-channel>
</instruction-set>
<instruction-set targetVersion="3">
<remove-channel id="visbility" groupIds="forecastHourly"/>
<add-channel id="visibility" groupIds="forecastHourly">
<type>openweathermap:visibility</type>
</add-channel>
</instruction-set>
</thing-type>
</update:update-descriptions>