Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[myq] Fixes breaking API changes to the MyQ binding #11601

Merged
merged 4 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

import static org.openhab.binding.myq.internal.MyQBindingConstants.BINDING_ID;

import java.util.List;
import java.util.Set;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.myq.internal.dto.DevicesDTO;
import org.openhab.binding.myq.internal.dto.DeviceDTO;
import org.openhab.binding.myq.internal.handler.MyQAccountHandler;
import org.openhab.core.config.discovery.AbstractDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryResult;
Expand Down Expand Up @@ -55,9 +56,9 @@ public Set<ThingTypeUID> getSupportedThingTypes() {
public void startScan() {
MyQAccountHandler accountHandler = this.accountHandler;
if (accountHandler != null) {
DevicesDTO devices = accountHandler.devicesCache();
List<DeviceDTO> devices = accountHandler.devicesCache();
if (devices != null) {
devices.items.forEach(device -> {
devices.forEach(device -> {
ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, device.deviceFamily);
if (SUPPORTED_DISCOVERY_THING_TYPES_UIDS.contains(thingTypeUID)) {
ThingUID thingUID = new ThingUID(thingTypeUID, accountHandler.getThing().getUID(),
Expand All @@ -73,6 +74,11 @@ public void startScan() {
}
}

@Override
public void startBackgroundDiscovery() {
startScan();
}

@Override
public void setThingHandler(ThingHandler handler) {
if (handler instanceof MyQAccountHandler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,7 @@
* @author Dan Cunningham - Initial contribution
*/
public class AccountDTO {

public UsersDTO users;
public Boolean admin;
public AccountInfoDTO account;
public String analyticsId;
public String userId;
public String userName;
public String email;
public String firstName;
public String lastName;
public String cultureCode;
public AddressDTO address;
public TimeZoneDTO timeZone;
public Boolean mailingListOptIn;
public Boolean requestAccountLinkInfo;
public String phone;
public Boolean diagnosticDataOptIn;
public String id;
public String name;
public String createdBy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*/
package org.openhab.binding.myq.internal.dto;

import java.util.List;

/**
* The {@link AccountInfoDTO} entity from the MyQ API
* The {@link AccountsDTO} entity from the MyQ API
*
* @author Dan Cunningham - Initial contribution
*/
public class AccountInfoDTO {

public String href;
public String id;
public class AccountsDTO {
public List<AccountDTO> accounts;
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class DeviceDTO {
public String deviceType;
public String name;
public String createdDate;
public String accountId;
public DeviceStateDTO state;
public String parentDevice;
public String parentDeviceId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
*/
package org.openhab.binding.myq.internal.dto;

import java.util.List;

/**
* The {@link DeviceStateDTO} entity from the MyQ API
*
Expand All @@ -23,34 +21,16 @@ public class DeviceStateDTO {

public Boolean gdoLockConnected;
public Boolean attachedWorkLightErrorPresent;
public String doorState;
public String learnStatus;
public Boolean hasCamera;
public String lampState;
public String open;
public String close;
public String batteryBackupState;
public String doorState;
public String lastUpdate;
public String passthroughInterval;
public String doorAjarInterval;
public String invalidCredentialWindow;
public String invalidShutoutPeriod;
public Boolean isUnattendedOpenAllowed;
public Boolean isUnattendedCloseAllowed;
public String auxRelayDelay;
public Boolean useAuxRelay;
public String auxRelayBehavior;
public Boolean rexFiresDoor;
public Boolean commandChannelReportStatus;
public Boolean controlFromBrowser;
public Boolean reportForced;
public Boolean reportAjar;
public Integer maxInvalidAttempts;
public Integer serviceCycleCount;
public Integer absoluteCycleCount;
public Boolean online;
public String lastStatus;
public String firmwareVersion;
public Boolean homekitCapable;
public Boolean homekitEnabled;
public String learn;
public Boolean learnMode;
public String updatedDate;
public List<String> physicalDevices = null;
public Boolean pendingBootloadAbandoned;
}

This file was deleted.

This file was deleted.

Loading