[verisure] Avoid updates duplication after communication errors (#13652)

Avoid registering several times the same device status listener.
It is called by the thing handler each time the bridge status changed to ONLINE.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2022-11-05 14:42:01 +01:00 committed by GitHub
parent f184e4e88f
commit c81790cebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,8 +27,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
@ -82,7 +82,7 @@ public class VerisureSession {
private final Map<String, VerisureThingHandler<?>> verisureHandlers = new ConcurrentHashMap<>();
private final Logger logger = LoggerFactory.getLogger(VerisureSession.class);
private final Gson gson = new Gson();
private final List<DeviceStatusListener<VerisureThingDTO>> deviceStatusListeners = new CopyOnWriteArrayList<>();
private final Set<DeviceStatusListener<VerisureThingDTO>> deviceStatusListeners = ConcurrentHashMap.newKeySet();
private final Map<BigDecimal, VerisureInstallation> verisureInstallations = new ConcurrentHashMap<>();
private static final List<String> APISERVERLIST = Arrays.asList("https://m-api01.verisure.com",
"https://m-api02.verisure.com");