mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
[openweathermap] Fix visibility channels (#18597)
* fix visibility channel Signed-off-by: Hans Böhm <h.boehm@gmx.at>
This commit is contained in:
+3
-1
@@ -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;
|
||||
|
||||
+1
@@ -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));
|
||||
|
||||
+1
-1
@@ -241,7 +241,7 @@
|
||||
</channel-groups>
|
||||
|
||||
<properties>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
<property name="thingTypeVersion">3</property>
|
||||
</properties>
|
||||
<representation-property>location</representation-property>
|
||||
|
||||
|
||||
+6
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user