mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
Reverting incorrect code move (#16548)
Signed-off-by: gael@lhopital.org <gael@lhopital.org> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
f9b9a709e3
commit
3fd387cab6
@ -21,7 +21,6 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
import org.openhab.binding.netatmo.internal.api.HomeApi;
|
import org.openhab.binding.netatmo.internal.api.HomeApi;
|
||||||
import org.openhab.binding.netatmo.internal.api.NetatmoException;
|
import org.openhab.binding.netatmo.internal.api.NetatmoException;
|
||||||
import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.FeatureArea;
|
import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.FeatureArea;
|
||||||
@ -66,12 +65,6 @@ public class HomeCapability extends RestCapability<HomeApi> {
|
|||||||
if (!config.securityId.isBlank()) {
|
if (!config.securityId.isBlank()) {
|
||||||
homeIds.add(config.securityId);
|
homeIds.add(config.securityId);
|
||||||
}
|
}
|
||||||
if (hasArea(FeatureArea.SECURITY) && !handler.getCapabilities().containsKey(SecurityCapability.class)) {
|
|
||||||
handler.getCapabilities().put(new SecurityCapability(handler));
|
|
||||||
}
|
|
||||||
if (hasArea(FeatureArea.ENERGY) && !handler.getCapabilities().containsKey(EnergyCapability.class)) {
|
|
||||||
handler.getCapabilities().put(new EnergyCapability(handler, descriptionProvider));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -83,6 +76,16 @@ public class HomeCapability extends RestCapability<HomeApi> {
|
|||||||
@Override
|
@Override
|
||||||
protected void updateHomeData(HomeData home) {
|
protected void updateHomeData(HomeData home) {
|
||||||
if (firstLaunch) {
|
if (firstLaunch) {
|
||||||
|
if (featureAreas.contains(FeatureArea.SECURITY)) {
|
||||||
|
handler.getCapabilities().put(new SecurityCapability(handler));
|
||||||
|
} else {
|
||||||
|
handler.removeChannels(thing.getChannelsOfGroup(GROUP_SECURITY));
|
||||||
|
}
|
||||||
|
if (featureAreas.contains(FeatureArea.ENERGY)) {
|
||||||
|
handler.getCapabilities().put(new EnergyCapability(handler, descriptionProvider));
|
||||||
|
} else {
|
||||||
|
handler.removeChannels(thing.getChannelsOfGroup(GROUP_ENERGY));
|
||||||
|
}
|
||||||
home.getCountry().map(country -> properties.put(PROPERTY_COUNTRY, country));
|
home.getCountry().map(country -> properties.put(PROPERTY_COUNTRY, country));
|
||||||
home.getTimezone().map(tz -> properties.put(PROPERTY_TIMEZONE, tz));
|
home.getTimezone().map(tz -> properties.put(PROPERTY_TIMEZONE, tz));
|
||||||
properties.put(GROUP_LOCATION, ((Location) home).getLocation().toString());
|
properties.put(GROUP_LOCATION, ((Location) home).getLocation().toString());
|
||||||
@ -91,21 +94,6 @@ public class HomeCapability extends RestCapability<HomeApi> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void afterNewData(@Nullable NAObject newData) {
|
|
||||||
if (firstLaunch && !hasArea(FeatureArea.SECURITY)) {
|
|
||||||
handler.removeChannels(thing.getChannelsOfGroup(GROUP_SECURITY));
|
|
||||||
}
|
|
||||||
if (firstLaunch && !hasArea(FeatureArea.ENERGY)) {
|
|
||||||
handler.removeChannels(thing.getChannelsOfGroup(GROUP_ENERGY));
|
|
||||||
}
|
|
||||||
super.afterNewData(newData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasArea(FeatureArea searched) {
|
|
||||||
return featureAreas.contains(searched);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Errored equipments are reported at home level - so we need to explore all the tree to identify modules
|
* Errored equipments are reported at home level - so we need to explore all the tree to identify modules
|
||||||
* depending from a child device.
|
* depending from a child device.
|
||||||
|
Loading…
Reference in New Issue
Block a user