@eohjsc/react-native-smart-city 0.3.30 → 0.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -5
- package/src/Images/DevMode/close.png +0 -0
- package/src/Images/DevMode/close@2x.png +0 -0
- package/src/Images/DevMode/close@3x.png +0 -0
- package/src/Images/DevMode/plus.png +0 -0
- package/src/Images/DevMode/plus@2x.png +0 -0
- package/src/Images/DevMode/plus@3x.png +0 -0
- package/src/Images/DevMode/remove_circle.png +0 -0
- package/src/Images/DevMode/remove_circle@2x.png +0 -0
- package/src/Images/DevMode/remove_circle@3x.png +0 -0
- package/src/commons/Action/ItemQuickAction.js +20 -4
- package/src/commons/Action/__test__/ItemQuickAction.test.js +35 -11
- package/src/commons/ActionGroup/ColorPickerTemplate.js +36 -17
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +23 -15
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +5 -2
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +10 -4
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +4 -4
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +38 -45
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -6
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +8 -4
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +9 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +30 -12
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +51 -28
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +13 -7
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +9 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +16 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +10 -4
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +7 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +21 -7
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +50 -60
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +135 -133
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +7 -7
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +9 -5
- package/src/commons/ActionGroup/__test__/index.test.js +7 -5
- package/src/commons/ActionGroup/index.js +35 -10
- package/src/commons/ActionTemplate/OnOffButtonAction.js +14 -5
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +23 -2
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
- package/src/commons/ActionTemplate/index.js +1 -0
- package/src/commons/AlertAction/index.js +2 -2
- package/src/commons/Auth/AccountItem.js +9 -3
- package/src/commons/Auth/__test__/AccountItem.test.js +6 -3
- package/src/commons/Automate/ItemAutomate.js +22 -3
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +4 -5
- package/src/commons/Button/index.js +0 -2
- package/src/commons/ButtonPopup/index.js +3 -3
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +4 -2
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +6 -3
- package/src/commons/Dashboard/MyUnit/index.js +5 -3
- package/src/commons/DevMode/CardDevMode.js +42 -0
- package/src/commons/DevMode/EmptyComponent.js +18 -0
- package/src/commons/DevMode/Item.js +21 -0
- package/src/commons/DevMode/Styles/CardStyles.js +40 -0
- package/src/commons/DevMode/Styles/EmptyComponentStyles.js +15 -0
- package/src/commons/DevMode/Styles/ItemStyles.js +27 -0
- package/src/commons/DevMode/Styles/TextWithLabelStyles.js +36 -0
- package/src/commons/DevMode/TextWithLabel.js +30 -0
- package/src/commons/DevMode/index.js +5 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DeviceAlertStatus.js +3 -3
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +1 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +3 -2
- package/src/commons/Device/FlatListItems.js +2 -2
- package/src/commons/Device/ItemAddNew/index.js +7 -12
- package/src/commons/Device/ItemDevice.js +16 -11
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +1 -1
- package/src/commons/Device/SensorConnectedStatus.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +6 -3
- package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +8 -4
- package/src/commons/Device/__test__/FlatListItems.test.js +3 -2
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +4 -2
- package/src/commons/Explore/ActivityIndicator/index.js +5 -2
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +3 -3
- package/src/commons/Explore/SearchBox/index.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +4 -4
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +11 -8
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -2
- package/src/commons/FieldTemplate/PasscodeField/index.js +2 -2
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +12 -7
- package/src/commons/Form/TextInput.js +2 -2
- package/src/commons/Form/TextInputPassword.js +2 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +5 -3
- package/src/commons/GroupCheckBox/index.js +2 -2
- package/src/commons/Header/HeaderCustom.js +8 -2
- package/src/commons/HeaderAni/index.js +2 -3
- package/src/commons/MediaPlayerDetail/index.js +2 -2
- package/src/commons/MenuActionList/index.js +2 -2
- package/src/commons/MenuActionMore/index.js +5 -4
- package/src/commons/NavBar/index.js +2 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +12 -6
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +7 -3
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -2
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +11 -8
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +9 -5
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -3
- package/src/commons/Popover/index.js +2 -13
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -3
- package/src/commons/PreventAccess/index.js +3 -3
- package/src/commons/{Connecting → Processing}/__test__/Connecting.test.js +5 -4
- package/src/commons/Processing/index.js +93 -0
- package/src/commons/{Connecting → Processing}/styles.js +9 -1
- package/src/commons/SelectGateway/index.js +105 -0
- package/src/commons/SelectGateway/styles.js +55 -0
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +106 -0
- package/src/commons/SelectSubUnit/index.js +124 -0
- package/src/commons/SelectSubUnit/styles.js +55 -0
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +120 -0
- package/src/commons/SelectUnit/index.js +106 -0
- package/src/commons/SelectUnit/styles.js +54 -0
- package/src/commons/Sharing/WrapHeaderScrollable.js +6 -4
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +4 -4
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +25 -10
- package/src/commons/SubUnit/OneTap/index.js +9 -4
- package/src/commons/SubUnit/ShortDetail.js +11 -29
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +15 -10
- package/src/commons/SummaryItem/index.js +2 -2
- package/src/commons/Tabbar/__test__/index.test.js +97 -0
- package/src/commons/Unit/HeaderUnit/index.js +4 -5
- package/src/commons/Unit/SharedUnit.js +10 -8
- package/src/commons/Unit/__test__/HeaderUnit.test.js +13 -5
- package/src/commons/Unit/__test__/SharedUnit.test.js +30 -11
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +13 -8
- package/src/commons/UnitSummary/AirQuality/index.js +7 -3
- package/src/commons/UnitSummary/TotalPowerBox.js +2 -2
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -2
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +3 -2
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/commons/ViewButtonBottom/index.js +4 -4
- package/src/commons/WheelDateTimePicker/index.js +5 -3
- package/src/commons/WrapParallaxScrollView/index.js +2 -1
- package/src/configs/API.js +12 -14
- package/src/configs/AccessibilityLabel.js +611 -0
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +1 -604
- package/src/configs/Images.js +3 -0
- package/src/context/actionType.ts +19 -3
- package/src/context/mockStore.ts +18 -3
- package/src/context/reducer.ts +66 -9
- package/src/hoc/__test__/withRemoteControl.test.js +24 -0
- package/src/hoc/withRemoteControl.js +1 -0
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +55 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/useDevicesStatus.js +19 -15
- package/src/hooks/Common/{useGGHomeDeviceConnected.js → useHomeAssistantDeviceConnected.js} +3 -3
- package/src/hooks/Common/usePopover.js +6 -1
- package/src/hooks/IoT/__test__/{useGGHomeConnection.test.js → useHomeAssistantConnection.test.js} +18 -18
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +17 -12
- package/src/hooks/IoT/index.js +2 -2
- package/src/hooks/IoT/useHomeAssistantConnection.js +91 -0
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/__test__/useInitDeepLink.test.js +28 -0
- package/src/hooks/useReceiveNotifications.js +2 -4
- package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +21 -17
- package/src/iot/RemoteControl/LG.js +2 -1
- package/src/iot/RemoteControl/__test__/{GoogleHome.test.js → HomeAssistant.test.js} +30 -30
- package/src/navigations/AddDeviceStack.js +0 -14
- package/src/navigations/AddGatewayStack.js +51 -21
- package/src/navigations/Main.js +28 -4
- package/src/navigations/SmartIrStack.js +3 -3
- package/src/navigations/UnitStack.js +1 -1
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +5 -3
- package/src/screens/AQIGuide/index.js +5 -3
- package/src/screens/ActivityLog/FilterPopup.js +2 -2
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +3 -2
- package/src/screens/ActivityLog/index.js +3 -3
- package/src/screens/AddCommon/SelectSubUnit.js +44 -191
- package/src/screens/AddCommon/SelectUnit.js +51 -204
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +7 -50
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +28 -26
- package/src/screens/AddLocationMaps/__test__/index.test.js +13 -7
- package/src/screens/AddLocationMaps/index.js +3 -3
- package/src/screens/AddNewAction/Device/index.js +2 -2
- package/src/screens/AddNewAction/SelectAction.js +16 -7
- package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +2 -2
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +8 -3
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -7
- package/src/screens/AddNewAutoSmart/index.js +9 -12
- package/src/screens/AddNewDevice/ConnectingDevices.js +1 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +7 -4
- package/src/screens/AddNewDevice/index.js +4 -4
- package/src/screens/AddNewGateway/ConnectingDevice.js +40 -0
- package/src/screens/AddNewGateway/ConnectingModbusDevice.js +61 -0
- package/src/screens/AddNewGateway/ConnectingWifiDevice.js +70 -0
- package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +60 -0
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +21 -8
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +23 -4
- package/src/screens/AddNewGateway/RenameNewDevices.js +141 -0
- package/src/screens/AddNewGateway/RenameNewDevicesStyles.js +75 -0
- package/src/screens/AddNewGateway/ScanGatewayQR.js +57 -0
- package/src/screens/AddNewGateway/ScanModbusQR.js +53 -0
- package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +55 -0
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +31 -0
- package/src/screens/AddNewGateway/SelectDeviceType.js +52 -0
- package/src/screens/AddNewGateway/SelectDeviceUnit.js +29 -0
- package/src/screens/AddNewGateway/SelectModbusGateway.js +34 -0
- package/src/screens/AddNewGateway/SelectZigbeeGateway.js +34 -0
- package/src/screens/AddNewGateway/ShareWifiPassword.js +302 -0
- package/src/screens/AddNewGateway/ShareWifiPasswordStyles.js +44 -0
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -4
- package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +63 -0
- package/src/screens/AddNewGateway/__test__/{SelectGateway.test.js → ConnectingWifiDevice.test.js} +15 -10
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +62 -0
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +191 -0
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +75 -0
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +47 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +89 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +48 -0
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +294 -0
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +27 -0
- package/src/screens/AddNewGateway/index.js +4 -4
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +5 -4
- package/src/screens/AddNewOneTap/index.js +4 -4
- package/src/screens/Automate/__test__/index.test.js +2 -2
- package/src/screens/Automate/index.js +6 -2
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +3 -2
- package/src/screens/ConfirmUnitDeletion/index.js +3 -3
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +5 -5
- package/src/screens/Device/EditDevice/index.js +3 -3
- package/src/screens/Device/__test__/detail.test.js +38 -22
- package/src/screens/Device/components/DetailHistoryChart.js +7 -5
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +6 -6
- package/src/screens/Device/components/SensorDisplayItem.js +51 -26
- package/src/screens/Device/detail.js +31 -23
- package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
- package/src/screens/DeviceInfo/__test__/index.test.js +8 -4
- package/src/screens/DeviceInfo/index.js +10 -6
- package/src/screens/Drawer/index.js +30 -13
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +5 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +9 -5
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +7 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -3
- package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +3 -2
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +6 -3
- package/src/screens/EnterPassword/index.js +5 -3
- package/src/screens/GuestInfo/__test__/index.test.js +18 -12
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +2 -2
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +3 -3
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/RecurringDetail.js +4 -4
- package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -3
- package/src/screens/GuestInfo/index.js +1 -1
- package/src/screens/HanetCamera/Detail.js +10 -4
- package/src/screens/HanetCamera/ManageAccess.js +4 -4
- package/src/screens/HanetCamera/MemberInfo.js +1 -1
- package/src/screens/HanetCamera/__test__/Detail.test.js +5 -3
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +10 -4
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +4 -2
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +1 -1
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +4 -4
- package/src/screens/MoveToAnotherSubUnit/index.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +9 -6
- package/src/screens/PlayBackCamera/index.js +6 -6
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +10 -3
- package/src/screens/ScriptDetail/__test__/index.test.js +43 -38
- package/src/screens/ScriptDetail/index.js +26 -16
- package/src/screens/SelectUnit/__test__/index.test.js +4 -3
- package/src/screens/SelectUnit/index.js +3 -3
- package/src/screens/SetSchedule/index.js +1 -1
- package/src/screens/Sharing/Components/{SensorItem.js → DeviceItem.js} +16 -22
- package/src/screens/Sharing/Components/Styles/{SensorItemStyles.js → DeviceItemStyles.js} +0 -0
- package/src/screens/Sharing/Components/__test__/{SensorItem.test.js → DeviceItem.test.js} +10 -8
- package/src/screens/Sharing/Components/index.js +2 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +72 -72
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/Styles/SelectPermissionStyles.js +2 -2
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- package/src/screens/Sharing/__test__/SelectPermission.test.js +12 -12
- package/src/screens/Sharing/__test__/SelectUser.test.js +7 -4
- package/src/screens/SideMenuDetail/__test__/index.test.js +11 -7
- package/src/screens/SideMenuDetail/index.js +2 -2
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +4 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SmartIr.test.js +14 -6
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +4 -2
- package/src/screens/SmartIr/components/{SelectDeviceType.js → SelectIrDeviceType.js} +2 -2
- package/src/screens/SmartIr/index.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +7 -3
- package/src/screens/SubUnit/Detail.js +6 -6
- package/src/screens/SubUnit/EditSubUnit.js +10 -6
- package/src/screens/SubUnit/ManageSubUnit.js +2 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +6 -3
- package/src/screens/SubUnit/__test__/Detail.test.js +5 -3
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +9 -5
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +3 -2
- package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -4
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
- package/src/screens/TDSGuide/index.js +2 -2
- package/src/screens/Template/EditTemplate.js +152 -0
- package/src/screens/Template/GatewayList.js +51 -0
- package/src/screens/Template/Information.js +41 -0
- package/src/screens/Template/Styles/EditTemplateStyle.js +109 -0
- package/src/screens/Template/Styles/GatewayStyles.js +46 -0
- package/src/screens/Template/Styles/InformationStyles.js +16 -0
- package/src/screens/Template/Styles/detailStyles.js +35 -0
- package/src/screens/Template/Styles/indexStyles.js +2 -33
- package/src/screens/Template/__test__/EditTemplate.test.js +89 -0
- package/src/screens/Template/__test__/GatewayList.test.js +26 -0
- package/src/screens/Template/__test__/Information.test.js +16 -0
- package/src/screens/Template/__test__/detail.test.js +68 -0
- package/src/screens/Template/__test__/index.test.js +26 -1
- package/src/screens/Template/detail.js +154 -0
- package/src/screens/Template/index.js +38 -32
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -2
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/AddMenu.js +6 -20
- package/src/screens/Unit/ChooseLocation.js +1 -1
- package/src/screens/Unit/Detail.js +10 -10
- package/src/screens/Unit/ManageUnit.js +21 -15
- package/src/screens/Unit/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/SelectAddToFavorites.js +7 -8
- package/src/screens/Unit/SelectAddress.js +4 -4
- package/src/screens/Unit/SmartAccount.js +1 -1
- package/src/screens/Unit/SmartAccountItem.js +3 -3
- package/src/screens/Unit/Station/__test__/index.test.js +19 -3
- package/src/screens/Unit/Station/index.js +2 -2
- package/src/screens/Unit/Summaries.js +2 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +6 -6
- package/src/screens/Unit/__test__/Detail.test.js +90 -55
- package/src/screens/Unit/__test__/ManageUnit.test.js +40 -18
- package/src/screens/Unit/__test__/SelectAddress.test.js +15 -8
- package/src/screens/Unit/__test__/SmartAccount.test.js +42 -25
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +4 -3
- package/src/screens/Unit/components/AutomateScript/index.js +5 -2
- package/src/screens/Unit/components/ListMyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +9 -5
- package/src/screens/Unit/components/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyUnitDevice/index.js +8 -5
- package/src/screens/Unit/components/SharedUnit/index.js +12 -6
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +24 -9
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +25 -11
- package/src/screens/UnitSummary/__test__/index.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +5 -4
- package/src/screens/UnitSummary/components/RunningDevices/index.js +6 -3
- package/src/screens/UnitSummary/components/TotalPowerBox/index.js +2 -2
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +3 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/index.js +10 -8
- package/src/screens/WaterQualityGuide/__test__/index.test.js +17 -12
- package/src/screens/WaterQualityGuide/index.js +26 -10
- package/src/utils/Apis/axios.js +1 -0
- package/src/utils/I18n/translations/en.json +20 -10
- package/src/utils/I18n/translations/vi.json +17 -9
- package/src/utils/Route/index.js +22 -10
- package/src/utils/Utils.js +6 -7
- package/src/commons/Connecting/index.js +0 -67
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +0 -41
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +0 -163
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +0 -19
- package/src/commons/ConnectingProcess/index.js +0 -213
- package/src/commons/ConnectingProcess/styles.js +0 -69
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/iot/RemoteControl/index.js +0 -55
- package/src/screens/AddNewDevice/ConnectDevices.js +0 -184
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -131
- package/src/screens/AddNewGateway/ConnectedGateway.js +0 -139
- package/src/screens/AddNewGateway/ConnectingGateway.js +0 -137
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +0 -214
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +0 -319
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +0 -75
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +0 -130
- package/src/screens/AddNewGateway/SelectGateway.js +0 -133
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -207
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -71
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +0 -96
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -120
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +0 -115
- package/src/screens/ScanChipQR/hooks/index.js +0 -120
- package/src/screens/ScanChipQR/index.js +0 -29
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +0 -111
- package/src/screens/ScanSensorQR/hooks/index.js +0 -40
- package/src/screens/ScanSensorQR/index.js +0 -39
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useContext, useCallback } from 'react';
|
|
2
|
+
import { SCContext, useSCContextSelector } from '../../context';
|
|
3
|
+
import { Action } from '../../context/actionType';
|
|
4
|
+
import {
|
|
5
|
+
homeAssistantConnect,
|
|
6
|
+
homeAssistantDisconnect,
|
|
7
|
+
} from '../../iot/RemoteControl/HomeAssistant';
|
|
8
|
+
import { axiosPost } from '../../utils/Apis/axios';
|
|
9
|
+
import { API } from '../../configs';
|
|
10
|
+
|
|
11
|
+
const useHomeAssistantConnection = () => {
|
|
12
|
+
const { setAction } = useContext(SCContext);
|
|
13
|
+
const { connections } = useSCContextSelector(
|
|
14
|
+
(state) => state.iot.homeassistant
|
|
15
|
+
);
|
|
16
|
+
const { listDevice } = useSCContextSelector((state) => state);
|
|
17
|
+
|
|
18
|
+
const onEstablished = useCallback(
|
|
19
|
+
async (newConnections, options) => {
|
|
20
|
+
setAction(Action.SET_HOME_ASSISTANT_CONNECTIONS, newConnections);
|
|
21
|
+
|
|
22
|
+
const isConnected = options.some(
|
|
23
|
+
(option) => !!newConnections[option.chip_id]
|
|
24
|
+
);
|
|
25
|
+
let chipId = options[0].chip_id;
|
|
26
|
+
if (!isConnected) {
|
|
27
|
+
setAction(Action.LIST_DEVICE_TYPES, {
|
|
28
|
+
chipId: chipId,
|
|
29
|
+
sentEmail: true,
|
|
30
|
+
});
|
|
31
|
+
await axiosPost(API.HOME_ASSISTANT.CHECK_SEND_EMAIL(), {
|
|
32
|
+
chip_id: chipId,
|
|
33
|
+
is_connected: false,
|
|
34
|
+
});
|
|
35
|
+
} else if (isConnected && listDevice[chipId]?.sentEmail) {
|
|
36
|
+
setAction(Action.LIST_DEVICE_TYPES, {
|
|
37
|
+
chipId: chipId,
|
|
38
|
+
sentEmail: false,
|
|
39
|
+
});
|
|
40
|
+
await axiosPost(API.HOME_ASSISTANT.CHECK_SEND_EMAIL(), {
|
|
41
|
+
chip_id: chipId,
|
|
42
|
+
is_connected: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
[listDevice]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const onDisconnected = useCallback(async (option) => {
|
|
51
|
+
setAction(Action.CHANGE_HOME_ASSISTANT_CONN_STATE, { option, data: 0 });
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
const onReconnected = useCallback(async (option, connection) => {
|
|
56
|
+
setAction(Action.CHANGE_HOME_ASSISTANT_CONN_STATE, {
|
|
57
|
+
option,
|
|
58
|
+
data: connection,
|
|
59
|
+
});
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const connectHomeAssistant = useCallback(
|
|
64
|
+
async (options) => {
|
|
65
|
+
await homeAssistantConnect(
|
|
66
|
+
connections,
|
|
67
|
+
options,
|
|
68
|
+
onEstablished,
|
|
69
|
+
onDisconnected,
|
|
70
|
+
onReconnected
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
[connections, onEstablished, onDisconnected, onReconnected]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const disconnectHomeAssistant = useCallback(
|
|
77
|
+
async (options) => {
|
|
78
|
+
await homeAssistantDisconnect(connections, options);
|
|
79
|
+
setAction(Action.SET_HOME_ASSISTANT_CONNECTIONS, {});
|
|
80
|
+
},
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
[connections]
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
connectHomeAssistant,
|
|
87
|
+
disconnectHomeAssistant,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default useHomeAssistantConnection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { useSCContextSelector } from '../../context';
|
|
3
|
-
import {
|
|
3
|
+
import { sendCommandOverHomeAssistant } from '../../iot/RemoteControl/HomeAssistant';
|
|
4
4
|
import { sendCommandOverInternet } from '../../iot/RemoteControl/Internet';
|
|
5
5
|
import {
|
|
6
6
|
sendCommandOverBluetooth,
|
|
@@ -10,8 +10,8 @@ import { ToastBottomHelper } from '../../utils/Utils';
|
|
|
10
10
|
import { t } from 'i18n-js';
|
|
11
11
|
|
|
12
12
|
const useRemoteControl = () => {
|
|
13
|
-
const
|
|
14
|
-
(state) => state.iot.
|
|
13
|
+
const homeAssistantConnections = useSCContextSelector(
|
|
14
|
+
(state) => state.iot.homeassistant.connections
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
const sendRemoteCommand = useCallback(
|
|
@@ -58,8 +58,8 @@ const useRemoteControl = () => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
if (action.command_prefer_over_googlehome && !result) {
|
|
61
|
-
result = await
|
|
62
|
-
|
|
61
|
+
result = await sendCommandOverHomeAssistant(
|
|
62
|
+
homeAssistantConnections,
|
|
63
63
|
sensor,
|
|
64
64
|
action,
|
|
65
65
|
data
|
|
@@ -67,7 +67,7 @@ const useRemoteControl = () => {
|
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
69
69
|
},
|
|
70
|
-
[
|
|
70
|
+
[homeAssistantConnections]
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
return sendRemoteCommand;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
+
import { useInitDeepLink } from '../index';
|
|
4
|
+
import { SCProvider } from '../../context';
|
|
5
|
+
import { mockSCStore } from '../../context/mockStore';
|
|
6
|
+
import DeepLinking from 'react-native-deep-linking';
|
|
7
|
+
|
|
8
|
+
const mockedSetAction = jest.fn();
|
|
9
|
+
|
|
10
|
+
const wrapper = ({ children }) => <SCProvider>{children}</SCProvider>;
|
|
11
|
+
|
|
12
|
+
const mockUseContext = jest.fn().mockImplementation(() => ({
|
|
13
|
+
stateData: mockSCStore({}),
|
|
14
|
+
setAction: mockedSetAction,
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
React.useContext = mockUseContext;
|
|
18
|
+
|
|
19
|
+
jest.mock('react-native-deep-linking');
|
|
20
|
+
|
|
21
|
+
describe('Test useRemoteControl', () => {
|
|
22
|
+
it('test send remote command action null', async () => {
|
|
23
|
+
renderHook(() => useInitDeepLink(), {
|
|
24
|
+
wrapper,
|
|
25
|
+
});
|
|
26
|
+
expect(DeepLinking.addScheme).toBeCalled();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -8,10 +8,8 @@ const useReceiveNotifications = (callBack) => {
|
|
|
8
8
|
);
|
|
9
9
|
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
callBack && callBack();
|
|
14
|
-
}
|
|
11
|
+
notificationData && setDataNotification(notificationData);
|
|
12
|
+
notificationData && callBack && callBack();
|
|
15
13
|
}, [callBack, notificationData]);
|
|
16
14
|
|
|
17
15
|
return { dataNotification };
|
|
@@ -115,7 +115,7 @@ async function fetchConnectionEntities(connection) {
|
|
|
115
115
|
setConfigGlobalState('configValues', { ...configValues });
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
export const
|
|
118
|
+
export const homeAssistantConnect = async (
|
|
119
119
|
oldConnections,
|
|
120
120
|
options,
|
|
121
121
|
onEstablished,
|
|
@@ -163,13 +163,13 @@ export const googleHomeConnect = async (
|
|
|
163
163
|
|
|
164
164
|
connection.addEventListener('disconnected', async () => {
|
|
165
165
|
await onDisconnected(option);
|
|
166
|
-
ToastBottomHelper.error(t('
|
|
166
|
+
ToastBottomHelper.error(t('command_homeassistant_lost'));
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
connection.addEventListener('ready', async (conn, eventData) => {
|
|
170
170
|
await fetchConnectionEntities(conn);
|
|
171
171
|
await onReconnected(option, conn);
|
|
172
|
-
ToastBottomHelper.success(t('
|
|
172
|
+
ToastBottomHelper.success(t('command_homeassistant_ready'));
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
connections[option.chip_id] = connection;
|
|
@@ -182,7 +182,7 @@ export const googleHomeConnect = async (
|
|
|
182
182
|
return connections;
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
export const
|
|
185
|
+
export const homeAssistantDisconnect = async (connections, options) => {
|
|
186
186
|
for (let i = 0; i < options.length; i++) {
|
|
187
187
|
const option = options[i];
|
|
188
188
|
if (option.chip_id in connections) {
|
|
@@ -219,11 +219,11 @@ async function sendCommandSingleAction(connection, ghAction, data) {
|
|
|
219
219
|
await connection.sendMessagePromise(message);
|
|
220
220
|
return true;
|
|
221
221
|
} catch (err) {
|
|
222
|
-
ToastBottomHelper.error(t('
|
|
222
|
+
ToastBottomHelper.error(t('command_send_fail_homeassistant'));
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
export async function
|
|
226
|
+
export async function sendCommandOverHomeAssistant(
|
|
227
227
|
connections,
|
|
228
228
|
device,
|
|
229
229
|
action,
|
|
@@ -238,7 +238,7 @@ export async function sendCommandOverGoogleHome(
|
|
|
238
238
|
|
|
239
239
|
const connection = getDeviceConnection(connections, device);
|
|
240
240
|
if (!connection) {
|
|
241
|
-
ToastBottomHelper.error(t('
|
|
241
|
+
ToastBottomHelper.error(t('command_send_fail_homeassistant'));
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -260,15 +260,19 @@ export async function sendCommandOverGoogleHome(
|
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
263
|
+
const { success: createLog } = await axiosPost(API.DEVICE.ACTIVITY_LOG(), {
|
|
264
|
+
action_id: action.id,
|
|
265
|
+
message: `Trigger
|
|
266
|
+
${triggerSuccess ? 'success' : 'fail'}
|
|
267
|
+
by user action with home assistant`,
|
|
268
|
+
action_status: triggerSuccess,
|
|
269
|
+
});
|
|
270
|
+
if (createLog && triggerSuccess) {
|
|
271
|
+
ToastBottomHelper.success(t('command_send_success_homeassistant'));
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
if (createLog && !triggerSuccess) {
|
|
275
|
+
ToastBottomHelper.error(t('command_send_fail_homeassistant'));
|
|
276
|
+
return false;
|
|
272
277
|
}
|
|
273
|
-
return false;
|
|
274
278
|
}
|
|
@@ -110,7 +110,7 @@ export async function fetchDeviceStatusLG(endDevice) {
|
|
|
110
110
|
}, 1000);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
export const lgThinqConnect = async (options) => {
|
|
113
|
+
export const lgThinqConnect = async (options, onConnected) => {
|
|
114
114
|
for (let i = 0; i < options.length; i++) {
|
|
115
115
|
const option = options[i];
|
|
116
116
|
for (let j = 0; j < option.lg_devices.length; j++) {
|
|
@@ -136,6 +136,7 @@ export const lgThinqConnect = async (options) => {
|
|
|
136
136
|
await fetchDeviceStatusLG(endDevice);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
onConnected && onConnected();
|
|
139
140
|
};
|
|
140
141
|
|
|
141
142
|
export const sendCommandOverLGThinq = async (sensor, action, data) => {
|
|
@@ -2,10 +2,10 @@ import { createConnection, getStates } from 'home-assistant-js-websocket';
|
|
|
2
2
|
import Toast from 'react-native-toast-message';
|
|
3
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '../
|
|
5
|
+
homeAssistantConnect,
|
|
6
|
+
homeAssistantDisconnect,
|
|
7
|
+
sendCommandOverHomeAssistant,
|
|
8
|
+
} from '../HomeAssistant';
|
|
9
9
|
import { getConfigGlobalState, setConfigGlobalState } from '../../states';
|
|
10
10
|
import { API } from '../../../configs';
|
|
11
11
|
import { getTranslate } from '../../../utils/I18n';
|
|
@@ -34,7 +34,7 @@ const mockReconnected = jest.fn();
|
|
|
34
34
|
getStates.mockImplementation(() => []);
|
|
35
35
|
createConnection.mockImplementation(() => connection);
|
|
36
36
|
|
|
37
|
-
describe('Remote Control
|
|
37
|
+
describe('Remote Control Home Assistant', () => {
|
|
38
38
|
const options = [
|
|
39
39
|
{
|
|
40
40
|
auth: {},
|
|
@@ -92,7 +92,7 @@ describe('Remote Control Google Home', () => {
|
|
|
92
92
|
setConfigGlobalState('configValues', {});
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it('Connect to
|
|
95
|
+
it('Connect to Home Assistant basic will fetch entities', async () => {
|
|
96
96
|
getStates.mockImplementationOnce(() => [
|
|
97
97
|
{
|
|
98
98
|
entity_id: 'group.sensor',
|
|
@@ -111,7 +111,7 @@ describe('Remote Control Google Home', () => {
|
|
|
111
111
|
let configValues = getConfigGlobalState('configValues');
|
|
112
112
|
expect(configValues).toEqual({});
|
|
113
113
|
|
|
114
|
-
await
|
|
114
|
+
await homeAssistantConnect(
|
|
115
115
|
{},
|
|
116
116
|
options,
|
|
117
117
|
mockEstablished,
|
|
@@ -158,7 +158,7 @@ describe('Remote Control Google Home', () => {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
await
|
|
161
|
+
await homeAssistantConnect(
|
|
162
162
|
{},
|
|
163
163
|
options,
|
|
164
164
|
mockEstablished,
|
|
@@ -170,15 +170,15 @@ describe('Remote Control Google Home', () => {
|
|
|
170
170
|
expect(configValues).toEqual({ 1: { value: true } });
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
-
it('Connect to same
|
|
174
|
-
const connections = await
|
|
173
|
+
it('Connect to same Home Assistant will be skipped', async () => {
|
|
174
|
+
const connections = await homeAssistantConnect(
|
|
175
175
|
{},
|
|
176
176
|
options,
|
|
177
177
|
mockEstablished,
|
|
178
178
|
mockDisconnected,
|
|
179
179
|
mockReconnected
|
|
180
180
|
);
|
|
181
|
-
await
|
|
181
|
+
await homeAssistantConnect(
|
|
182
182
|
connections,
|
|
183
183
|
options,
|
|
184
184
|
mockEstablished,
|
|
@@ -195,7 +195,7 @@ describe('Remote Control Google Home', () => {
|
|
|
195
195
|
listener();
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
|
-
await
|
|
198
|
+
await homeAssistantConnect(
|
|
199
199
|
{},
|
|
200
200
|
options,
|
|
201
201
|
mockEstablished,
|
|
@@ -212,7 +212,7 @@ describe('Remote Control Google Home', () => {
|
|
|
212
212
|
listener();
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
|
-
await
|
|
215
|
+
await homeAssistantConnect(
|
|
216
216
|
{},
|
|
217
217
|
options,
|
|
218
218
|
mockEstablished,
|
|
@@ -222,27 +222,27 @@ describe('Remote Control Google Home', () => {
|
|
|
222
222
|
expect(Toast.show).toBeCalledWith({
|
|
223
223
|
type: 'error',
|
|
224
224
|
position: 'bottom',
|
|
225
|
-
text1: getTranslate('en', '
|
|
225
|
+
text1: getTranslate('en', 'command_homeassistant_lost'),
|
|
226
226
|
visibilityTime: 1000,
|
|
227
227
|
});
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
-
it('Send command over
|
|
230
|
+
it('Send command over Home Assistant will send message to chip', async () => {
|
|
231
231
|
mock.onPost(API.DEVICE.ACTIVITY_LOG()).reply(200);
|
|
232
|
-
const connections = await
|
|
232
|
+
const connections = await homeAssistantConnect(
|
|
233
233
|
{},
|
|
234
234
|
options,
|
|
235
235
|
mockEstablished,
|
|
236
236
|
mockDisconnected,
|
|
237
237
|
mockReconnected
|
|
238
238
|
);
|
|
239
|
-
await
|
|
239
|
+
await sendCommandOverHomeAssistant(connections, sensor, action);
|
|
240
240
|
expect(connection.sendMessagePromise).toBeCalledWith(
|
|
241
241
|
action.googlehome_actions[0].message
|
|
242
242
|
);
|
|
243
243
|
});
|
|
244
244
|
|
|
245
|
-
it('Send command over
|
|
245
|
+
it('Send command over Home Assistant will send message to chip with service_data and data', async () => {
|
|
246
246
|
action.googlehome_actions[0].message = {
|
|
247
247
|
type: 'call_service',
|
|
248
248
|
domain: 'climate',
|
|
@@ -254,21 +254,21 @@ describe('Remote Control Google Home', () => {
|
|
|
254
254
|
id: 20,
|
|
255
255
|
};
|
|
256
256
|
mock.onPost(API.DEVICE.ACTIVITY_LOG()).reply(200);
|
|
257
|
-
const connections = await
|
|
257
|
+
const connections = await homeAssistantConnect(
|
|
258
258
|
{},
|
|
259
259
|
options,
|
|
260
260
|
mockEstablished,
|
|
261
261
|
mockDisconnected,
|
|
262
262
|
mockReconnected
|
|
263
263
|
);
|
|
264
|
-
await
|
|
264
|
+
await sendCommandOverHomeAssistant(connections, sensor, action, 19);
|
|
265
265
|
action.googlehome_actions[0].message.service_data.temperature = 19;
|
|
266
266
|
expect(connection.sendMessagePromise).toBeCalledWith(
|
|
267
267
|
action.googlehome_actions[0].message
|
|
268
268
|
);
|
|
269
269
|
});
|
|
270
270
|
|
|
271
|
-
it('Send command over
|
|
271
|
+
it('Send command over Home Assistant action googlehome_action one to one', async () => {
|
|
272
272
|
action.googlehome_actions = null;
|
|
273
273
|
action.googlehome_action.message = {
|
|
274
274
|
type: 'call_service',
|
|
@@ -281,47 +281,47 @@ describe('Remote Control Google Home', () => {
|
|
|
281
281
|
id: 20,
|
|
282
282
|
};
|
|
283
283
|
mock.onPost(API.DEVICE.ACTIVITY_LOG()).reply(200);
|
|
284
|
-
const connections = await
|
|
284
|
+
const connections = await homeAssistantConnect(
|
|
285
285
|
{},
|
|
286
286
|
options,
|
|
287
287
|
mockEstablished,
|
|
288
288
|
mockDisconnected,
|
|
289
289
|
mockReconnected
|
|
290
290
|
);
|
|
291
|
-
await
|
|
291
|
+
await sendCommandOverHomeAssistant(connections, sensor, action, 19);
|
|
292
292
|
action.googlehome_action.message.service_data.temperature = 19;
|
|
293
293
|
expect(connection.sendMessagePromise).toBeCalledWith(
|
|
294
294
|
action.googlehome_action.message
|
|
295
295
|
);
|
|
296
296
|
});
|
|
297
297
|
|
|
298
|
-
it('Send command over
|
|
299
|
-
await
|
|
298
|
+
it('Send command over Home Assistant that not connected', async () => {
|
|
299
|
+
await homeAssistantConnect(
|
|
300
300
|
{},
|
|
301
301
|
options,
|
|
302
302
|
mockEstablished,
|
|
303
303
|
mockDisconnected,
|
|
304
304
|
mockReconnected
|
|
305
305
|
);
|
|
306
|
-
await
|
|
306
|
+
await sendCommandOverHomeAssistant({}, { chip_id: 2 }, action);
|
|
307
307
|
expect(connection.sendMessagePromise).not.toBeCalled();
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
-
it('Send command over
|
|
311
|
-
await
|
|
310
|
+
it('Send command over Home Assistant that not a Home Assistant', async () => {
|
|
311
|
+
await homeAssistantConnect(
|
|
312
312
|
{},
|
|
313
313
|
options,
|
|
314
314
|
mockEstablished,
|
|
315
315
|
mockDisconnected,
|
|
316
316
|
mockReconnected
|
|
317
317
|
);
|
|
318
|
-
await
|
|
318
|
+
await sendCommandOverHomeAssistant({}, sensor, {});
|
|
319
319
|
expect(connection.sendMessagePromise).not.toBeCalled();
|
|
320
320
|
});
|
|
321
321
|
|
|
322
322
|
it('Disconnect a not connected gateway', async () => {
|
|
323
323
|
connection.close.mockClear();
|
|
324
|
-
await
|
|
324
|
+
await homeAssistantDisconnect({}, options);
|
|
325
325
|
expect(connection.close).not.toBeCalled();
|
|
326
326
|
});
|
|
327
327
|
});
|
|
@@ -3,12 +3,8 @@ import React, { memo } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
5
5
|
import AddCommonSelectSubUnit from '../screens/AddCommon/SelectSubUnit';
|
|
6
|
-
import AddGatewaySelectGateway from '../screens/AddNewGateway/SelectGateway';
|
|
7
6
|
import AddNewDevice from '../screens/AddNewDevice';
|
|
8
|
-
import ConnectDevices from '../screens/AddNewDevice/ConnectDevices';
|
|
9
7
|
import ConnectingDevices from '../screens/AddNewDevice/ConnectingDevices';
|
|
10
|
-
import ConnectingProcess from '../commons/ConnectingProcess';
|
|
11
|
-
import ScanSensorQR from '../screens/ScanSensorQR';
|
|
12
8
|
import Route from '../utils/Route';
|
|
13
9
|
import { screenOptions } from './utils';
|
|
14
10
|
|
|
@@ -30,21 +26,11 @@ export const AddDeviceStack = memo(() => {
|
|
|
30
26
|
name={Route.AddCommonSelectSubUnit}
|
|
31
27
|
component={AddCommonSelectSubUnit}
|
|
32
28
|
/>
|
|
33
|
-
<Stack.Screen
|
|
34
|
-
name={Route.AddGatewaySelectGateway}
|
|
35
|
-
component={AddGatewaySelectGateway}
|
|
36
|
-
/>
|
|
37
|
-
<Stack.Screen
|
|
38
|
-
name={Route.ConnectingProcess}
|
|
39
|
-
component={ConnectingProcess}
|
|
40
|
-
/>
|
|
41
29
|
<Stack.Screen name={Route.AddNewDevice} component={AddNewDevice} />
|
|
42
|
-
<Stack.Screen name={Route.ScanSensorQR} component={ScanSensorQR} />
|
|
43
30
|
<Stack.Screen
|
|
44
31
|
name={Route.ConnectingDevices}
|
|
45
32
|
component={ConnectingDevices}
|
|
46
33
|
/>
|
|
47
|
-
<Stack.Screen name={Route.ConnectDevices} component={ConnectDevices} />
|
|
48
34
|
</Stack.Navigator>
|
|
49
35
|
);
|
|
50
36
|
});
|
|
@@ -2,16 +2,22 @@ import { createStackNavigator } from '@react-navigation/stack';
|
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import AddNewGateway from '../screens/AddNewGateway';
|
|
5
|
-
import ScanChipQR from '../screens/ScanChipQR';
|
|
6
5
|
import Route from '../utils/Route';
|
|
7
|
-
import ConnectedGateway from '../screens/AddNewGateway/ConnectedGateway';
|
|
8
|
-
import ConnectingGateway from '../screens/AddNewGateway/ConnectingGateway';
|
|
9
|
-
import SetupGatewayWifi from '../screens/AddNewGateway/SetupGatewayWifi';
|
|
10
|
-
import AddCommonSelectSubUnit from '../screens/AddCommon/SelectSubUnit';
|
|
11
6
|
import FirstWarning from '../screens/AddNewGateway/PlugAndPlay/FirstWarning';
|
|
12
|
-
import ConnectWifiWarning from '../screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning';
|
|
13
|
-
import GatewayWifiList from '../screens/AddNewGateway/PlugAndPlay/GatewayWifiList';
|
|
14
7
|
import { screenOptions } from './utils';
|
|
8
|
+
import SelectDeviceSubUnit from '../screens/AddNewGateway/SelectDeviceSubUnit';
|
|
9
|
+
import SelectDeviceType from '../screens/AddNewGateway/SelectDeviceType';
|
|
10
|
+
import SelectModbusGateway from '../screens/AddNewGateway/SelectModbusGateway';
|
|
11
|
+
import SelectZigbeeGateway from '../screens/AddNewGateway/SelectZigbeeGateway';
|
|
12
|
+
import ConnectingZigbeeDevice from '../screens/AddNewGateway/ConnectingZigbeeDevice';
|
|
13
|
+
import SelectDeviceUnit from '../screens/AddNewGateway/SelectDeviceUnit';
|
|
14
|
+
import ScanModbusQR from '../screens/AddNewGateway/ScanModbusQR';
|
|
15
|
+
import ConnectingModbusDevice from '../screens/AddNewGateway/ConnectingModbusDevice';
|
|
16
|
+
import ScanWifiDeviceQR from '../screens/AddNewGateway/ScanWifiDeviceQR';
|
|
17
|
+
import ConnectingWifiDevice from '../screens/AddNewGateway/ConnectingWifiDevice';
|
|
18
|
+
import ShareWifiPassword from '../screens/AddNewGateway/ShareWifiPassword';
|
|
19
|
+
import ScanGatewayQR from '../screens/AddNewGateway/ScanGatewayQR';
|
|
20
|
+
import RenameNewDevices from '../screens/AddNewGateway/RenameNewDevices';
|
|
15
21
|
|
|
16
22
|
const Stack = createStackNavigator();
|
|
17
23
|
|
|
@@ -23,30 +29,54 @@ export const AddGatewayStack = memo(() => {
|
|
|
23
29
|
headerShown: false,
|
|
24
30
|
}}
|
|
25
31
|
>
|
|
32
|
+
<Stack.Screen name={Route.FirstWarning} component={FirstWarning} />
|
|
33
|
+
<Stack.Screen name={Route.AddNewGateway} component={AddNewGateway} />
|
|
26
34
|
<Stack.Screen
|
|
27
|
-
name={Route.
|
|
28
|
-
component={
|
|
35
|
+
name={Route.SelectDeviceUnit}
|
|
36
|
+
component={SelectDeviceUnit}
|
|
29
37
|
/>
|
|
30
|
-
<Stack.Screen name={Route.AddNewGateway} component={AddNewGateway} />
|
|
31
38
|
<Stack.Screen
|
|
32
|
-
name={Route.
|
|
33
|
-
component={
|
|
39
|
+
name={Route.SelectDeviceSubUnit}
|
|
40
|
+
component={SelectDeviceSubUnit}
|
|
34
41
|
/>
|
|
35
|
-
<Stack.Screen name={Route.ScanChipQR} component={ScanChipQR} />
|
|
36
42
|
<Stack.Screen
|
|
37
|
-
name={Route.
|
|
38
|
-
component={
|
|
43
|
+
name={Route.SelectDeviceType}
|
|
44
|
+
component={SelectDeviceType}
|
|
39
45
|
/>
|
|
40
46
|
<Stack.Screen
|
|
41
|
-
name={Route.
|
|
42
|
-
component={
|
|
47
|
+
name={Route.SelectModbusGateway}
|
|
48
|
+
component={SelectModbusGateway}
|
|
49
|
+
/>
|
|
50
|
+
<Stack.Screen
|
|
51
|
+
name={Route.SelectZigbeeGateway}
|
|
52
|
+
component={SelectZigbeeGateway}
|
|
53
|
+
/>
|
|
54
|
+
<Stack.Screen
|
|
55
|
+
name={Route.ConnectingZigbeeDevice}
|
|
56
|
+
component={ConnectingZigbeeDevice}
|
|
57
|
+
/>
|
|
58
|
+
<Stack.Screen name={Route.ScanModbusQR} component={ScanModbusQR} />
|
|
59
|
+
<Stack.Screen
|
|
60
|
+
name={Route.ConnectingModbusDevice}
|
|
61
|
+
component={ConnectingModbusDevice}
|
|
62
|
+
/>
|
|
63
|
+
<Stack.Screen
|
|
64
|
+
name={Route.ScanWifiDeviceQR}
|
|
65
|
+
component={ScanWifiDeviceQR}
|
|
66
|
+
/>
|
|
67
|
+
<Stack.Screen name={Route.ScanGatewayQR} component={ScanGatewayQR} />
|
|
68
|
+
<Stack.Screen
|
|
69
|
+
name={Route.ShareWifiPassword}
|
|
70
|
+
component={ShareWifiPassword}
|
|
71
|
+
/>
|
|
72
|
+
<Stack.Screen
|
|
73
|
+
name={Route.ConnectingWifiDevice}
|
|
74
|
+
component={ConnectingWifiDevice}
|
|
43
75
|
/>
|
|
44
|
-
<Stack.Screen name={Route.FirstWarning} component={FirstWarning} />
|
|
45
76
|
<Stack.Screen
|
|
46
|
-
name={Route.
|
|
47
|
-
component={
|
|
77
|
+
name={Route.RenameNewDevices}
|
|
78
|
+
component={RenameNewDevices}
|
|
48
79
|
/>
|
|
49
|
-
<Stack.Screen name={Route.GatewayWifiList} component={GatewayWifiList} />
|
|
50
80
|
</Stack.Navigator>
|
|
51
81
|
);
|
|
52
82
|
});
|