def get_status(pairedDeviceId, language=AppInfo.DEFAULT_API_LANGUAGE):
     return SharedMethod.call(kbxMethodAppId=SharedMethod.get_system_id(),
                              kbxMethodName="get_status",
                              kbxModuleName="device_manager.horn_controller",
                              pyapi=SharedMethod.get_pyapi(),
                              pairedDeviceId=pairedDeviceId,
                              **{AppInfo.REQUEST_KEY_LANGUAGE:language})
 def get_status(pairedDeviceId, language=AppInfo.DEFAULT_API_LANGUAGE):
     return SharedMethod.call(
         kbxMethodAppId=SharedMethod.get_system_id(),
         kbxMethodName="get_status",
         kbxModuleName="device_manager.horn_controller",
         pyapi=SharedMethod.get_pyapi(),
         pairedDeviceId=pairedDeviceId,
         **{AppInfo.REQUEST_KEY_LANGUAGE: language})
 def set_off(pairedDeviceId, language=AppInfo.DEFAULT_API_LANGUAGE):
     '''
     Turn off switch.
     pairedDeviceId:Number :- Paired Device ID return from DeviceManagerService.get_paired_device_list
     transitionTime:Number :- Optional. the duration of the transition from the light's current state to the new state.
     '''
     return SharedMethod.call(kbxMethodAppId=SharedMethod.get_system_id(),
                              kbxMethodName="set_off",
                              kbxModuleName="device_manager.horn_controller",
                              pyapi=SharedMethod.get_pyapi(),
                              pairedDeviceId=pairedDeviceId,
                              **{AppInfo.REQUEST_KEY_LANGUAGE:language})
 def set_off(pairedDeviceId, language=AppInfo.DEFAULT_API_LANGUAGE):
     '''
     Turn off switch.
     pairedDeviceId:Number :- Paired Device ID return from DeviceManagerService.get_paired_device_list
     transitionTime:Number :- Optional. the duration of the transition from the light's current state to the new state.
     '''
     return SharedMethod.call(
         kbxMethodAppId=SharedMethod.get_system_id(),
         kbxMethodName="set_off",
         kbxModuleName="device_manager.horn_controller",
         pyapi=SharedMethod.get_pyapi(),
         pairedDeviceId=pairedDeviceId,
         **{AppInfo.REQUEST_KEY_LANGUAGE: language})
Exemple #5
0
    def __get_group_ids(self):
        try:
            if AppConstants.GROUP_ID_UNKNOWN_LOCATION is None:
                systemId = SharedMethod.get_system_id()
                results = SharedMethod.list_shared_method_groups(kbxGroupAppId=[systemId],
                                                                 kbxGroupParentId=AppConstants.GROUP_ID_AUTOMATION)
    
                #groups = {group.get("kbxGroupName", "_"):group.get("kbxGroupId") for group in results["groupList"]}
                for group in results["groupList"]:
                    if group.get("otherLocation") == True:
                        AppConstants.GROUP_ID_UNKNOWN_LOCATION = group.get("kbxGroupId")
                        break
                    
            return AppConstants.GROUP_ID_UNKNOWN_LOCATION

        except Exception as e:
            raise e
Exemple #6
0
    def __get_default_group_ids(self):
        try:
            systemId = SharedMethod.get_system_id()

            results = SharedMethod.list_shared_method_groups(kbxGroupAppId=[systemId],
                                                             kbxGroupName=["automation_app", "notification", "service"])

            groups = {group.get("kbxGroupName", "_"):group.get("kbxGroupId") for group in results["groupList"]}

            AppConstants.GROUP_ID_AUTOMATION = groups["automation_app"]
            AppConstants.GROUP_ID_NOTIFICATION = groups["notification"]
            AppConstants.GROUP_ID_SERVICE = groups["service"]

        except Exception as e:
            Logger.log_error("AutomationApp on_system_connected retrying __get_default_group_ids, ex:", e)
            traceback.print_exc()
            raise e
Exemple #7
0
    def __get_default_group_ids(self):
        try:
            systemId = SharedMethod.get_system_id()

            results = SharedMethod.list_shared_method_groups(
                kbxGroupAppId=[systemId],
                kbxGroupName=["automation_app", "notification", "service"])

            groups = {
                group.get("kbxGroupName", "_"): group.get("kbxGroupId")
                for group in results["groupList"]
            }

            AppConstants.GROUP_ID_AUTOMATION = groups["automation_app"]
            AppConstants.GROUP_ID_NOTIFICATION = groups["notification"]
            AppConstants.GROUP_ID_SERVICE = groups["service"]

        except Exception as e:
            Logger.log_error(
                "AutomationApp on_system_connected retrying __get_default_group_ids, ex:",
                e)
            traceback.print_exc()
            raise e