| | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | //本地有逆变器列表,获取云端绑定逆变器失败,默认返回本地逆变器列表; |
| | | //向云端获取负载中心设备列表失败后,默认返回本地逆变器列表; |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(IntegrateCloudAndLocalData(homeId, null, false)); |
| | | } |
| | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | CloudInverterDeviceBean cloudInverterDeviceBean = list.get(i); |
| | | if (cloudInverterDeviceBean == null) { |
| | | if (cloudInverterDeviceBean.getDeviceType().equals(DeviceType.bms)) { |
| | | //未激活设备 |
| | | atomicInteger.set(atomicInteger.get() + 1); |
| | | //注意:这个逆变器只能本地控制(因为拿不到mqtt通讯秘钥以及GatewayID,无法远程控制) |
| | | //更新逆变器本地缓存信息 |
| | | refreshGatewayCacheData(false, cloudInverterDeviceBean, null, homeId); |
| | | //到最后一条,才处理回调 |
| | | if (atomicInteger.get() == list.size()) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(IntegrateCloudAndLocalData(homeId, list, false)); |
| | | } |
| | | } |
| | | HdlLogLogic.print("设备未激活(mac:" + cloudInverterDeviceBean.getOsn() + "))", true); |
| | | continue; |
| | | } else { |
| | | if (!cloudInverterDeviceBean.isActivate()) { |
| | | //未激活设备 |
| | | atomicInteger.set(atomicInteger.get() + 1); |
| | | //注意:这个逆变器只能本地控制(因为拿不到mqtt通讯秘钥以及GatewayID,无法远程控制) |
| | | //更新逆变器本地缓存信息 |
| | | refreshGatewayCacheData(false, cloudInverterDeviceBean, null, homeId); |
| | | //到最后一条,才处理回调 |
| | | if (atomicInteger.get() == list.size()) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(IntegrateCloudAndLocalData(homeId, list, false)); |
| | | } |
| | | } |
| | | HdlLogLogic.print("设备未激活(mac:" + cloudInverterDeviceBean.getOsn() + "))", true); |
| | | continue; |
| | | atomicInteger.set(atomicInteger.get() + 1); |
| | | continue; |
| | | } |
| | | if (!cloudInverterDeviceBean.getSpk().equals(HDL_BMS_SPK) && !cloudInverterDeviceBean.isActivate()) { |
| | | //未激活设备 |
| | | atomicInteger.set(atomicInteger.get() + 1); |
| | | //注意:这个逆变器只能本地控制(因为拿不到mqtt通讯秘钥以及GatewayID,无法远程控制) |
| | | //更新逆变器本地缓存信息 |
| | | refreshGatewayCacheData(false, cloudInverterDeviceBean, null, homeId); |
| | | //到最后一条,才处理回调 |
| | | if (atomicInteger.get() == list.size()) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(IntegrateCloudAndLocalData(homeId, list, false)); |
| | | } |
| | | } |
| | | HdlLogLogic.print("设备未激活(mac:" + cloudInverterDeviceBean.getOsn() + "))", true); |
| | | continue; |
| | | } |
| | | //获取远程设备通讯信息(拿到网关ID,mqtt通讯秘钥) |
| | | getDeviceRemoteInfo(homeId, cloudInverterDeviceBean.getSpk(), cloudInverterDeviceBean.getOsn(), new CloudCallBeak<DeviceRemoteInfo>() { |
| | |
| | | * |
| | | * @param deviceMac 设备mac |
| | | */ |
| | | public void checkInverterConnectedCloud(String homeId, String deviceMac, CloudCallBeak<CloudInverterDeviceBean> cloudCallBeak) { |
| | | this.getCloudInverterDeviceList(homeId, new CloudCallBeak<List<CloudInverterDeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(List<CloudInverterDeviceBean> list) { |
| | | CloudInverterDeviceBean cloudInverterDeviceBean = null; |
| | | if (list != null && list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).getOsn().equals(deviceMac)) { |
| | | cloudInverterDeviceBean = list.get(i); |
| | | break; |
| | | } |
| | | public void checkInverterConnectedCloud(String homeId, String deviceMac, String plantType, CloudCallBeak<CloudInverterDeviceBean> cloudCallBeak) { |
| | | if (plantType.equals(PowerStationType.BMS)) { |
| | | this.getCloudBmsDeviceList(homeId, new CloudCallBeak<List<CloudInverterDeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(List<CloudInverterDeviceBean> list) { |
| | | CloudInverterDeviceBean cloudInverterDeviceBean = null; |
| | | if (list != null && list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).getOsn().equals(deviceMac)) { |
| | | cloudInverterDeviceBean = list.get(i); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(cloudInverterDeviceBean); |
| | | } |
| | | } |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(cloudInverterDeviceBean); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } else { |
| | | this.getCloudInverterDeviceList(homeId, new CloudCallBeak<List<CloudInverterDeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(List<CloudInverterDeviceBean> list) { |
| | | CloudInverterDeviceBean cloudInverterDeviceBean = null; |
| | | if (list != null && list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (list.get(i).getOsn().equals(deviceMac)) { |
| | | cloudInverterDeviceBean = list.get(i); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(cloudInverterDeviceBean); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | gatewayBean.setDeviceOidId(cloudInverterDeviceBean.getDeviceOidId()); |
| | | gatewayBean.setFwVersion(cloudInverterDeviceBean.getFwVersion()); |
| | | } |
| | | gatewayBean.setBmsSource(cloudInverterDeviceBean.getBmsSource()); |
| | | //是否只支持远程发送命令 |
| | | gatewayBean.setSupportLocalSendCommands(!this.isBmsDevice(gatewayBean.getDevice_model())); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 是否是BMS设备(为什么使用设备类型查找,是因为有些BMS设备有可能支持TCP和远程,有些BMS设备只支持远程,因为有可能使用和逆变器一样的系统,而不是现在用单片机) |
| | | * |
| | | * @param model 设备类型 |
| | | * @return true表示是BMS设备,否则不是 |
| | | */ |
| | | private boolean isBmsDevice(String model) { |
| | | List<String> bmsModels = new ArrayList<>(); |
| | | bmsModels.add("ME-GLE-BW5K"); |
| | | if (bmsModels.contains("ME-GLE-BW5K")) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 获取网关支持spk列表 |