[go: up one dir, main page]

CN118859754A - Device control method, device, electronic device and storage medium - Google Patents

Device control method, device, electronic device and storage medium Download PDF

Info

Publication number
CN118859754A
CN118859754A CN202410884770.0A CN202410884770A CN118859754A CN 118859754 A CN118859754 A CN 118859754A CN 202410884770 A CN202410884770 A CN 202410884770A CN 118859754 A CN118859754 A CN 118859754A
Authority
CN
China
Prior art keywords
topic
target
subscription
target device
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410884770.0A
Other languages
Chinese (zh)
Inventor
刘洋
李绍斌
唐杰
王沅召
郭平飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Electric Appliances Inc of Zhuhai
Zhuhai Lianyun Technology Co Ltd
Original Assignee
Gree Electric Appliances Inc of Zhuhai
Zhuhai Lianyun Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Gree Electric Appliances Inc of Zhuhai, Zhuhai Lianyun Technology Co Ltd filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN202410884770.0A priority Critical patent/CN118859754A/en
Publication of CN118859754A publication Critical patent/CN118859754A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a control method and device of equipment, electronic equipment and a storage medium, and relates to the technical field of intelligent home, wherein the method comprises the following steps: responding to target equipment in a working scene to trigger subscription of a cancel topic, and acquiring a target topic of the cancel topic of the target equipment; executing subscription management and control operation for the target equipment according to the current topic type corresponding to the target topic, and generating management and control information for the target equipment; sending a management and control message to the target equipment, wherein the management and control message is used for indicating whether the target equipment is allowed or not to be allowed to cancel subscription to the target theme; and receiving an execution log aiming at the management and control message and sent by the target equipment, and performing type adjustment on the target topic according to the execution log to obtain a target topic type corresponding to the target topic, so that flexibility of topic subscription, system operation stability and information security are improved.

Description

设备的控制方法、装置、电子设备及存储介质Device control method, device, electronic device and storage medium

技术领域Technical Field

本发明涉及智能家居技术领域,特别是涉及一种设备的控制方法、一种设备的控制装置、一种电子设备以及一种计算机可读存储介质。The present invention relates to the field of smart home technology, and in particular to a device control method, a device control apparatus, an electronic device and a computer-readable storage medium.

背景技术Background Art

智能家居系统正逐渐成为现代生活的一部分,其通过集成先进的信息技术和物联网技术,将传统家居设备与互联网连接,实现自动化、智能化和便利化的家居管理。对于智能家居系统,其核心在于通过网络通信协议,实现设备间的数据交换和远程控制。在实际应用中,智能家居设备需要进行安全管理,以防止未经授权的订阅到敏感信息或者未经授权的控制指令发送。例如,设备可能需要订阅特定的主题以接收控制指令或状态更新,而不应订阅其他无关主题。服务器必须能够动态管理设备的订阅权限,确保设备只能订阅其所需的主题,从而避免安全风险和隐私泄露。Smart home systems are gradually becoming a part of modern life. They integrate advanced information technology and Internet of Things technology to connect traditional home appliances to the Internet to achieve automated, intelligent and convenient home management. For smart home systems, the core is to achieve data exchange and remote control between devices through network communication protocols. In practical applications, smart home devices need to be securely managed to prevent unauthorized subscription to sensitive information or unauthorized control instructions from being sent. For example, a device may need to subscribe to a specific topic to receive control instructions or status updates, but should not subscribe to other irrelevant topics. The server must be able to dynamically manage the subscription permissions of the device to ensure that the device can only subscribe to the topics it needs, thereby avoiding security risks and privacy leaks.

发明内容Summary of the invention

本发明实施例是提供一种设备的控制方法、装置、电子设备以及计算机可读存储介质,以解决或部分解决智能家居设备的控制过程中信息订阅存在灵活性差、系统稳定性差以及安全性不高的问题。The embodiments of the present invention provide a device control method, apparatus, electronic device and computer-readable storage medium to solve or partially solve the problems of poor flexibility, poor system stability and low security in information subscription during the control process of smart home devices.

本发明实施例公开了一种设备的控制方法,包括:An embodiment of the present invention discloses a method for controlling a device, including:

步骤1、响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题;Step 1: In response to a target device in a working scenario triggering cancellation of a subscription to a topic, obtaining a target topic that the target device cancels its subscription;

步骤2、根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息;Step 2: Execute a subscription control operation for the target device according to the current topic type corresponding to the target topic, and generate a control message for the target device;

步骤3、向所述目标设备发送管控消息,所述管控消息用于指示允许或不允许所述目标设备取消对所述目标主题的订阅;Step 3: Send a control message to the target device, where the control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic;

步骤4、接收所述目标设备发送的针对所述管控消息的执行日志,根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,返回所述步骤1。Step 4: Receive the execution log for the management and control message sent by the target device, adjust the type of the target topic according to the execution log, obtain the target topic type corresponding to the target topic, and return to step 1.

在一些可选的实施例中,所述根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息,包括:In some optional embodiments, performing a subscription control operation for the target device according to the current topic type corresponding to the target topic to generate a control message for the target device includes:

若所述目标主题当前为非关键性主题,则生成针对所述目标主题的订阅取消确认消息,向所述目标设备发送所述订阅取消确认消息,所述订阅取消确认消息用于指示所述目标设备对所述目标主题的取消订阅进行确认,所述非关键性主题为使用频率小于或等于预设阈值的主题;If the target topic is currently a non-critical topic, a subscription cancellation confirmation message for the target topic is generated, and the subscription cancellation confirmation message is sent to the target device, wherein the subscription cancellation confirmation message is used to instruct the target device to confirm the cancellation of the subscription to the target topic, and the non-critical topic is a topic whose usage frequency is less than or equal to a preset threshold;

接收所述目标设备发送的针对所述订阅取消确认消息的确认消息,取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息,所述订阅取消消息用于指示允许所述目标设备取消对所述目标主题的订阅。A confirmation message for the subscription cancellation confirmation message sent by the target device is received, the subscription of the target device to the target topic is canceled, and a subscription cancellation message for the confirmation message is generated, wherein the subscription cancellation message is used to indicate that the target device is allowed to cancel the subscription to the target topic.

在一些可选的实施例中,所述根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息,还包括:In some optional embodiments, performing a subscription control operation for the target device according to the current topic type corresponding to the target topic and generating a control message for the target device further includes:

若所述目标主题当前为关键性主题,则获取所述目标主题与所述工作场景之间的关联程度,所述关联程度用于表征禁止取消所述目标主题的订阅对所述目标设备的执行所产生的影响;If the target topic is currently a critical topic, obtaining a correlation degree between the target topic and the work scenario, the correlation degree being used to characterize the impact of prohibiting cancellation of subscription to the target topic on the execution of the target device;

若所述关联程度小于或等于预设条件阈值,则生成针对所述目标主题的禁止取消消息,向所述目标设备发送所述禁止取消消息,所述禁止取消消息用于不允许所述目标设备取消对所述目标主题的订阅。If the association degree is less than or equal to a preset condition threshold, a prohibition cancellation message for the target topic is generated and sent to the target device, where the prohibition cancellation message is used to not allow the target device to cancel its subscription to the target topic.

在一些可选的实施例中,所述根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息,还包括:In some optional embodiments, performing a subscription control operation for the target device according to the current topic type corresponding to the target topic and generating a control message for the target device further includes:

若所述关联程度大于预设条件阈值,则取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息;If the association degree is greater than a preset condition threshold, canceling the subscription of the target device to the target topic, and generating a subscription cancellation message for the confirmation message;

开通所述目标设备在所述工作场景下与其他设备进行通信的权限,并向所述目标设备发送所述订阅取消消息。The target device is enabled to communicate with other devices in the working scenario, and the subscription cancellation message is sent to the target device.

在一些可选的实施例中,所述获取所述目标主题与所述工作场景之间的关联程度,包括:In some optional embodiments, obtaining the degree of association between the target subject and the work scenario includes:

获取所述目标设备对应的设备操作日志、主题数据流量以及故障报告;Obtaining device operation logs, subject data flow, and fault reports corresponding to the target device;

采用所述设备操作日志、所述主题数据流量以及所述故障报告对所述目标主题与所述工作场景之间的关联性进行分析,获得所述目标主题与所述工作场景之间的关联程度。The device operation log, the subject data flow and the fault report are used to analyze the correlation between the target subject and the work scenario to obtain the correlation degree between the target subject and the work scenario.

在一些可选的实施例中,所述执行日志至少包括第一执行日志以及第二执行日志,所述第一执行日志为所述目标设备取消对所述目标主题的订阅后预设时长内执行设备操作生成的日志,所述第二执行日志为所述目标设备在取消对所述目标主题的订阅之前预设时长内执行设备操作生成的日志,所述根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,包括:In some optional embodiments, the execution log includes at least a first execution log and a second execution log, the first execution log is a log generated by the target device performing a device operation within a preset time period after the target device cancels the subscription to the target topic, and the second execution log is a log generated by the target device performing a device operation within a preset time period before the target device cancels the subscription to the target topic, and the type of the target topic is adjusted according to the execution log to obtain the target topic type corresponding to the target topic, including:

从所述第一执行日志中获取所述目标设备执行的第一设备操作,以及执行第一设备操作对应的第一成功率;Acquire, from the first execution log, a first device operation executed by the target device and a first success rate corresponding to executing the first device operation;

从所述第二执行日志中获取所述目标设备执行的第二设备操作,以及执行第二设备操作对应的第二成功率;Acquire, from the second execution log, a second device operation executed by the target device and a second success rate corresponding to executing the second device operation;

将所述第一设备操作与所述第二设备操作进行匹配、并将所述第一成功率与所述第二成功率进行匹配,获得所述第一执行日志与所述第二执行日志之间的相似度;Matching the first device operation with the second device operation and matching the first success rate with the second success rate to obtain a similarity between the first execution log and the second execution log;

若所述相似度小于或等于预设相似度阈值,则将所述目标主题由非关键性主题调整为关键性主题。If the similarity is less than or equal to a preset similarity threshold, the target topic is adjusted from a non-critical topic to a critical topic.

在一些可选的实施例中,所述响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题,包括:In some optional embodiments, in response to the target device in the working scenario triggering the cancellation of the subscription of the topic, obtaining the target topic that the target device cancels the subscription includes:

接收处于工作场景中的目标设备发送的取消订阅请求,或,响应于预设时长内未接收所述目标设备的上报消息,则获取所述目标设备取消订阅的目标主题。A subscription cancellation request sent by a target device in a working scenario is received, or, in response to not receiving a report message from the target device within a preset time period, a target topic for the target device to cancel its subscription is obtained.

本发明实施例还公开了一种设备的控制装置,包括:The embodiment of the present invention further discloses a control device for a device, comprising:

主题获取模块,用于响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题;A topic acquisition module, configured to, in response to a target device in a working scenario triggering cancellation of a topic subscription, acquire a target topic that the target device has unsubscribed from;

消息生成模块,用于根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息;A message generation module, used to perform a subscription control operation for the target device according to the current topic type corresponding to the target topic, and generate a control message for the target device;

消息发送模块,用于向所述目标设备发送管控消息,所述管控消息用于指示允许或不允许所述目标设备取消对所述目标主题的订阅;A message sending module, used for sending a control message to the target device, wherein the control message is used for indicating whether the target device is allowed or not to cancel the subscription to the target topic;

主题调整模块,用于接收所述目标设备发送的针对所述管控消息的执行日志,根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,返回所述响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题。A topic adjustment module is used to receive the execution log for the management and control message sent by the target device, adjust the type of the target topic according to the execution log, obtain the target topic type corresponding to the target topic, return the subscription cancellation triggered by the target device in the working scenario, and obtain the target topic that the target device cancels its subscription.

在一些可选的实施例中,所述消息生成模块具体用于:In some optional embodiments, the message generation module is specifically used to:

若所述目标主题当前为非关键性主题,则生成针对所述目标主题的订阅取消确认消息,向所述目标设备发送所述订阅取消确认消息,所述订阅取消确认消息用于指示所述目标设备对所述目标主题的取消订阅进行确认,所述非关键性主题为使用频率小于或等于预设阈值的主题;If the target topic is currently a non-critical topic, a subscription cancellation confirmation message for the target topic is generated, and the subscription cancellation confirmation message is sent to the target device, wherein the subscription cancellation confirmation message is used to instruct the target device to confirm the cancellation of the subscription to the target topic, and the non-critical topic is a topic whose usage frequency is less than or equal to a preset threshold;

接收所述目标设备发送的针对所述订阅取消确认消息的确认消息,取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息,所述订阅取消消息用于指示允许所述目标设备取消对所述目标主题的订阅。A confirmation message for the subscription cancellation confirmation message sent by the target device is received, the subscription of the target device to the target topic is canceled, and a subscription cancellation message for the confirmation message is generated, wherein the subscription cancellation message is used to indicate that the target device is allowed to cancel the subscription to the target topic.

在一些可选的实施例中,所述消息生成模块具体还用于:In some optional embodiments, the message generation module is further configured to:

若所述目标主题当前为关键性主题,则获取所述目标主题与所述工作场景之间的关联程度,所述关联程度用于表征禁止取消所述目标主题的订阅对所述目标设备的执行所产生的影响;If the target topic is currently a critical topic, obtaining a correlation degree between the target topic and the work scenario, the correlation degree being used to characterize the impact of prohibiting cancellation of subscription to the target topic on the execution of the target device;

若所述关联程度小于或等于预设条件阈值,则生成针对所述目标主题的禁止取消消息,向所述目标设备发送所述禁止取消消息,所述禁止取消消息用于不允许所述目标设备取消对所述目标主题的订阅。If the association degree is less than or equal to a preset condition threshold, a prohibition cancellation message for the target topic is generated and sent to the target device, where the prohibition cancellation message is used to not allow the target device to cancel its subscription to the target topic.

在一些可选的实施例中,所述消息生成模块具体还用于:In some optional embodiments, the message generation module is further configured to:

若所述关联程度大于预设条件阈值,则取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息;If the association degree is greater than a preset condition threshold, canceling the subscription of the target device to the target topic, and generating a subscription cancellation message for the confirmation message;

开通所述目标设备在所述工作场景下与其他设备进行通信的权限,并向所述目标设备发送所述订阅取消消息。The target device is enabled to communicate with other devices in the working scenario, and the subscription cancellation message is sent to the target device.

在一些可选的实施例中,所述消息生成模块具体还用于:In some optional embodiments, the message generation module is further configured to:

获取所述目标设备对应的设备操作日志、主题数据流量以及故障报告;Obtaining device operation logs, subject data flow, and fault reports corresponding to the target device;

采用所述设备操作日志、所述主题数据流量以及所述故障报告对所述目标主题与所述工作场景之间的关联性进行分析,获得所述目标主题与所述工作场景之间的关联程度。The device operation log, the subject data flow and the fault report are used to analyze the correlation between the target subject and the work scenario to obtain the correlation degree between the target subject and the work scenario.

在一些可选的实施例中,所述执行日志至少包括第一执行日志以及第二执行日志,所述第一执行日志为所述目标设备取消对所述目标主题的订阅后预设时长内执行设备操作生成的日志,所述第二执行日志为所述目标设备在取消对所述目标主题的订阅之前预设时长内执行设备操作生成的日志,所述主题调整模块具体用于:In some optional embodiments, the execution log includes at least a first execution log and a second execution log, the first execution log is a log generated by executing a device operation within a preset time after the target device cancels its subscription to the target topic, and the second execution log is a log generated by executing a device operation within a preset time before the target device cancels its subscription to the target topic, and the topic adjustment module is specifically used to:

从所述第一执行日志中获取所述目标设备执行的第一设备操作,以及执行第一设备操作对应的第一成功率;Acquire, from the first execution log, a first device operation executed by the target device and a first success rate corresponding to executing the first device operation;

从所述第二执行日志中获取所述目标设备执行的第二设备操作,以及执行第二设备操作对应的第二成功率;Acquire, from the second execution log, a second device operation executed by the target device and a second success rate corresponding to executing the second device operation;

将所述第一设备操作与所述第二设备操作进行匹配、并将所述第一成功率与所述第二成功率进行匹配,获得所述第一执行日志与所述第二执行日志之间的相似度;Matching the first device operation with the second device operation and matching the first success rate with the second success rate to obtain a similarity between the first execution log and the second execution log;

若所述相似度小于或等于预设相似度阈值,则将所述目标主题由非关键性主题调整为关键性主题。If the similarity is less than or equal to a preset similarity threshold, the target topic is adjusted from a non-critical topic to a critical topic.

在一些可选的实施例中,所述主题获取模块具体用于:In some optional embodiments, the theme acquisition module is specifically used to:

接收处于工作场景中的目标设备发送的取消订阅请求,或,响应于预设时长内未接收所述目标设备的上报消息,则获取所述目标设备取消订阅的目标主题。A subscription cancellation request sent by a target device in a working scenario is received, or, in response to not receiving a report message from the target device within a preset time period, a target topic for the target device to cancel its subscription is obtained.

本发明实施例还公开了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,所述处理器、所述通信接口以及所述存储器通过所述通信总线完成相互间的通信;The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

所述存储器,用于存放计算机程序;The memory is used to store computer programs;

所述处理器,用于执行存储器上所存放的程序时,实现如本发明实施例所述的方法。The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.

本发明实施例还公开了一种计算机可读存储介质,其上存储有指令,当由一个或多个处理器执行时,使得所述处理器执行如本发明实施例所述的方法。The embodiment of the present invention further discloses a computer-readable storage medium on which instructions are stored. When executed by one or more processors, the processors are enabled to execute the method described in the embodiment of the present invention.

本发明实施例包括以下优点:The embodiments of the present invention include the following advantages:

在本发明实施例中,可以通过服务器对设备订阅权限进行统一的管理,通过响应于处于工作场景中的目标设备触发取消主题的订阅,获取目标设备取消订阅的目标主题,接着可以根据目标主题对应的当前主题类型执行针对目标设备的订阅管控操作,生成针对目标设备的管控消息,然后向目标设备发送管控消息,管控消息用于指示允许或不允许目标设备取消对目标主题的订阅,并接收目标设备发送的针对管控消息的执行日志,根据执行日志对目标主题进行类型调整,获得目标主题对应的目标主题类型,从而服务器通过动态管理设备的订阅权限,保证了安全性,并且当服务器指示不允许取消订阅时,使得目标设备可以基于目标主题继续运行,保证了设备运行的稳定性,当服务器指示允许取消订阅时,能够有效地减少无关的主题订阅,优化了资源的利用,以及通过获取执行日志动态调整主题类型,优化了设备运行,实现了持续性的优化,有利于更加针对性地对设备进行管理控制。In an embodiment of the present invention, the device subscription authority can be uniformly managed by the server, and the target device in the working scenario triggers the cancellation of the subscription of the topic, and obtains the target topic that the target device cancels the subscription. Then, the subscription management and control operation for the target device can be performed according to the current topic type corresponding to the target topic, and a management and control message for the target device is generated. Then, the management and control message is sent to the target device, and the management and control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic, and the execution log for the management and control message sent by the target device is received. The type of the target topic is adjusted according to the execution log, and the target topic type corresponding to the target topic is obtained. In this way, the server ensures security by dynamically managing the subscription authority of the device, and when the server indicates that the cancellation of the subscription is not allowed, the target device can continue to operate based on the target topic, thereby ensuring the stability of the device operation. When the server indicates that the cancellation of the subscription is allowed, it can effectively reduce irrelevant topic subscriptions, optimize resource utilization, and dynamically adjust the topic type by obtaining the execution log, optimize the device operation, and achieve continuous optimization, which is conducive to more targeted management and control of the device.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本发明实施例中提供的一种设备的控制方法的步骤流程图;FIG1 is a flow chart of a method for controlling a device provided in an embodiment of the present invention;

图2是本发明实施例中提供的设备控制的流程示意图;FIG2 is a schematic diagram of a flow chart of device control provided in an embodiment of the present invention;

图3是本发明实施例中提供的一种设备的控制装置的结构框图;3 is a structural block diagram of a control device of a device provided in an embodiment of the present invention;

图4是本发明实施例中提供的一种电子设备的框图。FIG. 4 is a block diagram of an electronic device provided in an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明作进一步详细的说明。In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

作为一种示例,在实际应用中,智能家居设备需要进行安全管理,以防止未经授权的订阅到敏感信息或者未经授权的控制指令发送。例如,设备可能需要订阅特定的主题以接收控制指令或状态更新,而不应订阅其他无关主题。服务器必须能够动态管理设备的订阅权限,确保设备只能订阅其所需的主题,从而避免安全风险和隐私泄露。As an example, in practical applications, smart home devices need to be securely managed to prevent unauthorized subscriptions to sensitive information or unauthorized control instructions. For example, a device may need to subscribe to a specific topic to receive control instructions or status updates, but should not subscribe to other unrelated topics. The server must be able to dynamically manage the subscription permissions of the device to ensure that the device can only subscribe to the topics it needs, thereby avoiding security risks and privacy leaks.

对此,在本发明中,可以通过服务器对设备订阅权限进行统一的管理,通过响应于处于工作场景中的目标设备触发取消主题的订阅,获取目标设备取消订阅的目标主题,接着可以根据目标主题对应的当前主题类型执行针对目标设备的订阅管控操作,生成针对目标设备的管控消息,然后向目标设备发送管控消息,管控消息用于指示允许或不允许目标设备取消对目标主题的订阅,并接收目标设备发送的针对管控消息的执行日志,根据执行日志对目标主题进行类型调整,获得目标主题对应的目标主题类型,从而服务器通过动态管理设备的订阅权限,保证了安全性,并且当服务器指示不允许取消订阅时,使得目标设备可以基于目标主题继续运行,保证了设备运行的稳定性,当服务器指示允许取消订阅时,能够有效地减少无关的主题订阅,优化了资源的利用,以及通过获取执行日志动态调整主题类型,优化了设备运行,实现了持续性的优化,有利于更加针对性地对设备进行管理控制。In this regard, in the present invention, the device subscription rights can be uniformly managed by the server, and the subscription cancellation of the topic can be triggered in response to the target device in the working scenario, and the target topic that the target device cancels the subscription is obtained. Then, the subscription management and control operation for the target device can be performed according to the current topic type corresponding to the target topic, and a management and control message for the target device is generated. Then, the management and control message is sent to the target device, and the management and control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic, and the execution log for the management and control message sent by the target device is received. The type of the target topic is adjusted according to the execution log, and the target topic type corresponding to the target topic is obtained. In this way, the server ensures security by dynamically managing the subscription rights of the device, and when the server indicates that the subscription cancellation is not allowed, the target device can continue to operate based on the target topic, ensuring the stability of the device operation. When the server indicates that the subscription cancellation is allowed, it can effectively reduce irrelevant topic subscriptions, optimize resource utilization, and dynamically adjust the topic type by obtaining the execution log, optimize the device operation, and achieve continuous optimization, which is conducive to more targeted management and control of the device.

参照图1,示出了本发明实施例中提供的一种设备的控制方法的步骤流程图,具体可以包括如下步骤:1, a flow chart of a method for controlling a device provided in an embodiment of the present invention is shown, which may specifically include the following steps:

步骤1、响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题;Step 1: In response to a target device in a working scenario triggering cancellation of a subscription to a topic, obtaining a target topic that the target device cancels its subscription;

在本发明实施例中,在智能家居设备的控制过程中,服务器可以通过MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)与智能家居设备进行通信,以实现设备之间的数据传输、远程控制、安全管理、事件通知与管理等。In an embodiment of the present invention, during the control process of smart home devices, the server can communicate with the smart home devices through MQTT (Message Queuing Telemetry Transport) to achieve data transmission, remote control, security management, event notification and management, etc. between devices.

例如,在数据传输的过程中,可以用于传输传感器数据,智能家居设备通过MQTT发布传感器数据,如温度、湿度、光照等,以主题的形式进行标识和发布。服务器可以订阅这些主题以实时获取环境数据,用于监控和控制,也可以用于传输智能家居设备的状态反馈数据,设备可以定期发布状态更新到指定主题,例如设备在线状态、电量状态等,使服务器能够实时了解设备的运行情况等。For example, in the process of data transmission, it can be used to transmit sensor data. Smart home devices publish sensor data such as temperature, humidity, and light through MQTT, which are identified and published in the form of topics. Servers can subscribe to these topics to obtain environmental data in real time for monitoring and control. They can also be used to transmit status feedback data of smart home devices. Devices can regularly publish status updates to specified topics, such as device online status, power status, etc., so that the server can understand the operation of the device in real time.

在远程控制的过程中,可以用于传输控制指令,服务器通过MQTT向设备发送控制指令,例如开关灯、调节温度等操作。设备订阅相应的控制主题,以接收并执行服务器发送的指令,实现远程控制功能。In the process of remote control, it can be used to transmit control instructions. The server sends control instructions to the device through MQTT, such as turning on and off lights, adjusting temperature, etc. The device subscribes to the corresponding control topic to receive and execute the instructions sent by the server to realize the remote control function.

在安全性管理的过程中,服务器可以对智能家居设备的订阅权限进行控制,为防止未经授权的访问和操作,服务器需要管理设备的订阅权限。这涉及动态调整设备能够订阅的主题列表,确保设备只能订阅到其所需的信息,同时避免敏感信息的泄露和安全风险。In the process of security management, the server can control the subscription permissions of smart home devices. To prevent unauthorized access and operation, the server needs to manage the subscription permissions of the devices. This involves dynamically adjusting the list of topics that the device can subscribe to, ensuring that the device can only subscribe to the information it needs, while avoiding the leakage of sensitive information and security risks.

在事件通知与管理的过程中,智能家居设备可以向特定主题发布事件通知,如报警、错误信息等,以便服务器能及时响应和处理相关事件。In the process of event notification and management, smart home devices can publish event notifications, such as alarms, error messages, etc., to specific topics so that the server can respond and handle related events in a timely manner.

在上述过程中,智能家居设备与服务器之间通过MQTT协议进行通信,且服务器能够对智能家居设备请求的MQTT主题进行监控,智能家居设备能够应答服务器的必须字段上报请求,从而通过有效地MQTT协议应用和技术实现,智能家居设备能够实现有效的数据交换和远程控制,同时可以保障安全性和用户隐私,适应不断发展的物联网环境和需求。In the above process, the smart home device and the server communicate through the MQTT protocol, and the server can monitor the MQTT topic requested by the smart home device, and the smart home device can respond to the server's required field reporting request. Therefore, through effective MQTT protocol application and technical implementation, the smart home device can achieve effective data exchange and remote control, while ensuring security and user privacy, and adapting to the ever-evolving Internet of Things environment and needs.

需要说明的是,对于必须上报字段可以由不同厂家对智能家居设备进行设置,例如,以空调设备为例,可以假设其必须上报的关键字有:联网状态、子设备信息等;当服务器下发指令时,空调需要上报设备主要状态(温度、模式、风速等控制结果)等,本发明对此不作限制。It should be noted that the fields that must be reported can be set by different manufacturers for smart home devices. For example, taking air-conditioning equipment as an example, it can be assumed that the keywords that must be reported are: network status, sub-device information, etc.; when the server issues an instruction, the air-conditioning needs to report the main status of the equipment (temperature, mode, wind speed and other control results), etc. The present invention does not limit this.

在一些可行的实现方式中,在智能家居设备运行的过程中,随着设备硬件或软件的迭代更新,或者服务器版本的迭代增加,可能会出现智能家居设备未能及时满足与新版本服务器的MQTT正常信息交流,对此,在本发明实施例中,以服务器优先级更高对智能家居设备所需订阅的MQTT主题进行管控为例进行示例性说明,通过服务器对智能家居设备的管控,避免智能家居设备取消对应的关键字导致设备操作不当或上报出错的情况。可选地,对于MQTT主题,其可以包括传感器数据传输、控制指令传输、状态反馈、事件通知以及固件升级等,本发明对此不作限制。In some feasible implementations, during the operation of smart home devices, with the iterative update of device hardware or software, or the iterative increase of server versions, it may happen that smart home devices fail to meet the normal MQTT information exchange with the new version of the server in a timely manner. In this regard, in an embodiment of the present invention, an example is given of an example of a server with a higher priority to manage and control the MQTT topics that smart home devices need to subscribe to. Through the server's management and control of smart home devices, it is avoided that the smart home devices cancel the corresponding keywords, resulting in improper device operation or reporting errors. Optionally, the MQTT topic may include sensor data transmission, control instruction transmission, status feedback, event notification, and firmware upgrade, etc., which are not limited by the present invention.

在具体实现中,对于相应的目标智能家居设备(下述为目标设备),当其处于相应的工作场景时,若服务器检测到目标设备触发了取消主题的订阅,可以获取目标设备取消订阅的目标主题,以便服务器在对目标设备进行鉴权后,执行相应的处理。其中,工作场景可以为智能家具环境或条件,例如,离家模式、睡眠模式、工作模式等,在相应的工作场景下,智能家居设备需要执行特定的任务以及订阅相应的MQTT主题,如监控家中的温度、控制灯光等,本发明对此不作限制。In a specific implementation, for a corresponding target smart home device (hereinafter referred to as a target device), when it is in a corresponding working scenario, if the server detects that the target device triggers the cancellation of the subscription of the topic, the target topic that the target device cancels the subscription can be obtained, so that the server can perform corresponding processing after authenticating the target device. Among them, the working scenario can be a smart furniture environment or condition, such as away mode, sleep mode, working mode, etc. In the corresponding working scenario, the smart home device needs to perform specific tasks and subscribe to the corresponding MQTT topic, such as monitoring the temperature at home, controlling the lights, etc., and the present invention does not limit this.

需要说明的是,对于目标设备所触发取消主题的订阅,其可能是由于设备的程序故障引起的,而对于服务器而言,可以视为目标设备主动发起取消订阅主题。在一些示例中,服务器可以接收处于工作场景中的目标设备发送的取消订阅请求,或,响应于预设时长内未接收目标设备的上报消息,则获取目标设备取消订阅的目标主题。其中,服务器可以获取与目标设备之间的设备心跳时间,如果在n个设备心跳时间内未收到了目标设备发送的上报信息,则可以判定目标设备没有订阅主题,通过心跳检测可以有效地避免设备A取消了所有主题的情况。具体的,若为目标设备主动发起的取消订阅请求,则服务器可以获取与该取消订阅请求对应的目标主题;若为服务器检测到目标设备预设时长内未上报信息,则可以判定为目标设备取消了所有主题的订阅,从而通过主动与被动的方式对目标设备取消订阅的主题进行确定,有效地对目标设备的主题订阅情况进行检测,有助于及时发现目标设备的状态变化,同时服务器通过实时监控和自动判定的机制,也有利于服务器更有效地管理资源。It should be noted that the cancellation of the subscription of the topic triggered by the target device may be caused by a program failure of the device, and for the server, it can be regarded as the target device actively initiating the cancellation of the subscription topic. In some examples, the server can receive a cancellation request sent by a target device in a working scenario, or, in response to not receiving a report message from the target device within a preset time, obtain the target topic that the target device cancels the subscription. Among them, the server can obtain the device heartbeat time between the target device and the target device. If the report information sent by the target device is not received within n device heartbeat times, it can be determined that the target device has not subscribed to the topic. The heartbeat detection can effectively avoid the situation where device A cancels all topics. Specifically, if the target device actively initiates the cancellation request, the server can obtain the target topic corresponding to the cancellation request; if the server detects that the target device has not reported information within the preset time, it can be determined that the target device has canceled the subscription of all topics, thereby determining the topic that the target device has canceled the subscription in an active and passive manner, effectively detecting the topic subscription of the target device, and helping to timely discover the state change of the target device. At the same time, the server is also conducive to more effective management of resources through real-time monitoring and automatic determination mechanisms.

步骤2、根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息;Step 2: Execute a subscription control operation for the target device according to the current topic type corresponding to the target topic, and generate a control message for the target device;

对于服务器,其可以根据MQTT主题的类型,创建对应的白名单,并通过该白名单在目标设备触发取消主题订阅的情况下,判断是否允许目标设备取消相应主题的订阅,并执行针对目标设备的订阅管控操作,以及生成针对目标设备的管控消息,以便目标设备根据管控消息执行对应的操作,如取消主题订阅,保持主题订阅,信息上报等。其中,管控消息可以用于指示允许或不允许目标设备取消对目标主题的订阅,管控消息可以为取消订阅消息或禁止取消消息等。For the server, it can create a corresponding whitelist according to the type of MQTT topic, and through the whitelist, when the target device triggers the cancellation of the topic subscription, determine whether to allow the target device to cancel the subscription of the corresponding topic, and perform the subscription control operation for the target device, and generate a control message for the target device, so that the target device can perform corresponding operations according to the control message, such as canceling the topic subscription, maintaining the topic subscription, reporting information, etc. Among them, the control message can be used to indicate whether the target device is allowed or not to cancel the subscription to the target topic, and the control message can be a subscription cancellation message or a cancellation prohibition message, etc.

需要说明的是,对于MQTT主题,服务器可以根据工作场景对不同的MQTT主题的类型进行划分,以得到与各个工作场景对应的白名单,例如,在工作场景A中,其所涉及的MQTT主题包括主题①、主题②、主题③等,则可以获取各个主题在工作场景A中的使用频率,可以将使用频率小于或等于预设阈值的MQTT主题作为非关键性主题,将使用频率大于预设阈值的MQTT主题作为关键性主题,将主题①、主题②、主题③等划分为非关键性主题和关键性主题,包括将主题①与主题②可以划分为非关键性主题,主题③可以划分为关键性主题,从而通过在服务器上配置对应白名单,对MQTT主题进行统一地管理,在保证各个设备稳定运行的同时,还可以降低设备由于缺少相应信息而出现执行失败、不当操作等概率。It should be noted that, for MQTT topics, the server can divide the types of different MQTT topics according to the work scenarios to obtain a whitelist corresponding to each work scenario. For example, in work scenario A, the MQTT topics involved include topic ①, topic ②, topic ③, etc., then the usage frequency of each topic in work scenario A can be obtained, and the MQTT topics with a usage frequency less than or equal to the preset threshold can be regarded as non-critical topics, and the MQTT topics with a usage frequency greater than the preset threshold can be regarded as critical topics. Topics ①, topic ②, topic ③, etc. can be divided into non-critical topics and critical topics, including topic ① and topic ② can be classified as non-critical topics, and topic ③ can be classified as a critical topic. Therefore, by configuring the corresponding whitelist on the server, the MQTT topics can be managed uniformly, which can ensure the stable operation of each device while reducing the probability of execution failure, improper operation, etc. of the device due to lack of corresponding information.

在一些示例中,假设工作场景A:家庭安全监控,在该场景中,智能家居系统主要负责监控家庭的安全状况,包括门窗传感器、烟雾报警器、摄像头等设备。其中,对于MQTT主题划分,可以包括:In some examples, assume work scenario A: home security monitoring. In this scenario, the smart home system is mainly responsible for monitoring the security status of the home, including door and window sensors, smoke alarms, cameras and other devices. Among them, the MQTT topic division can include:

主题①:home/security/door(门窗传感器状态);Topic ①: home/security/door (door and window sensor status);

主题②:home/security/smoke(烟雾报警器状态);Topic ②: home/security/smoke (smoke alarm status);

主题③:home/security/camera(摄像头实时视频流)。Topic ③: home/security/camera (real-time video stream from camera).

则服务器可以获取各个主题对应的使用频率分析:主题①和主题②的使用频率较高,因为门窗传感器和烟雾报警器需要实时上报状态;主题③的使用频率相对较低,因为摄像头实时视频流通常只在需要时才开启。The server can then obtain the usage frequency analysis corresponding to each topic: the usage frequency of topics ① and ② is higher because door and window sensors and smoke alarms need to report their status in real time; the usage frequency of topic ③ is relatively low because the real-time video stream of the camera is usually only turned on when needed.

基于上述使用频率,可以对各个MQTT主题进行划分:Based on the above usage frequency, each MQTT topic can be divided into:

非关键性主题:主题①和主题②。这些主题虽然使用频率高,但丢失一些数据不会对家庭安全造成重大影响。Non-critical topics: Topic ① and Topic ②. Although these topics are frequently used, losing some data will not have a significant impact on home security.

关键性主题:主题③。摄像头实时视频流是关键性数据,因为它直接关系到家庭安全的实时监控。Key topic: Topic ③. The real-time video stream of the camera is key data because it is directly related to the real-time monitoring of home security.

在另一些示例中,假设工作场景B:家庭能源管理,在该场景中,智能家居系统主要负责管理家庭的能源使用,包括智能插座、智能灯具、温度控制器等设备。其中,对于MQTT主题划分,可以包括:In other examples, assume work scenario B: home energy management, in which the smart home system is mainly responsible for managing the energy use of the home, including smart sockets, smart lamps, temperature controllers and other devices. Among them, the MQTT topic division can include:

主题①:home/energy/plug(智能插座状态);Topic ①: home/energy/plug (smart socket status);

主题②:home/energy/light(智能灯具状态);Topic ②: home/energy/light (smart lighting status);

主题③:home/energy/thermostat(温度控制器状态)。Topic ③: home/energy/thermostat (temperature controller status).

则服务器可以获取各个主题对应的使用频率分析:主题①和主题②的使用频率较高,因为智能插座和智能灯具需要实时控制和监控;主题③的使用频率相对较低,因为温度控制器通常在特定时间段内进行调节。The server can then obtain the usage frequency analysis corresponding to each topic: the usage frequency of topics ① and ② is higher because smart sockets and smart lamps require real-time control and monitoring; the usage frequency of topic ③ is relatively low because the temperature controller is usually adjusted within a specific time period.

基于上述使用频率,可以对各个MQTT主题进行划分:Based on the above usage frequency, each MQTT topic can be divided into:

非关键性主题:主题①和主题②。这些主题虽然使用频率高,但丢失一些数据不会对能源管理造成重大影响。Non-critical topics: Topic ① and Topic ②. Although these topics are frequently used, the loss of some data will not have a significant impact on energy management.

关键性主题:主题③。温度控制器的状态是关键性数据,因为它直接关系到家庭的舒适度和能源消耗。Key topic: Topic ③. The status of the thermostat is key data because it is directly related to the comfort and energy consumption of the home.

通过这种划分,智能家居系统可以更有效地管理MQTT主题,确保关键性数据的实时性和可靠性,同时优化非关键性主题的资源分配,提高系统的整体性能和稳定性。Through this division, the smart home system can manage MQTT topics more effectively, ensuring the real-time and reliability of critical data, while optimizing resource allocation for non-critical topics and improving the overall performance and stability of the system.

在一些可行的实现方式中,服务器在确定了目标设备取消订阅的目标主题后,可以根据该目标主题对应的主题类型,判断是否允许目标设备取消订阅,若所述目标主题当前为非关键性主题,则生成针对所述目标主题的订阅取消确认消息,向所述目标设备发送所述订阅取消确认消息,所述订阅取消确认消息用于指示所述目标设备对所述目标主题的取消订阅进行确认,接着可以接收所述目标设备发送的针对所述订阅取消确认消息的确认消息,取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息,所述订阅取消消息用于指示允许所述目标设备取消对所述目标主题的订阅。In some feasible implementations, after determining the target topic for unsubscribing the target device, the server can determine whether to allow the target device to unsubscribe based on the topic type corresponding to the target topic; if the target topic is currently a non-critical topic, a subscription cancellation confirmation message for the target topic is generated, and the subscription cancellation confirmation message is sent to the target device, where the subscription cancellation confirmation message is used to instruct the target device to confirm the unsubscription of the target topic; then a confirmation message for the subscription cancellation confirmation message sent by the target device can be received, the target device's subscription to the target topic can be canceled, and a subscription cancellation message for the confirmation message is generated, where the subscription cancellation message is used to indicate that the target device is allowed to cancel its subscription to the target topic.

若目标主题当前为关键性主题,则获取目标主题与工作场景之间的关联程度,然后服务器可以通过该关联程度判断禁止取消目标主题的订阅对目标设备的执行所产生的影响,若关联程度小于或等于预设条件阈值,则生成针对目标主题的禁止取消消息,向目标设备发送禁止取消消息,禁止取消消息用于不允许目标设备取消对目标主题的订阅;若关联程度大于预设条件阈值,则取消目标设备对目标主题的订阅,并生成针对确认消息的订阅取消消息,然后开通目标设备在工作场景下与其他设备进行通信的权限,并向目标设备发送订阅取消消息,通过开通目标设备与其他设备的共享订阅方式,保证目标设备可以正常运行与上报。If the target topic is currently a critical topic, the degree of association between the target topic and the work scenario is obtained, and then the server can judge the impact of prohibiting the cancellation of the subscription to the target topic on the execution of the target device through the degree of association. If the degree of association is less than or equal to the preset condition threshold, a prohibition cancellation message for the target topic is generated, and the prohibition cancellation message is sent to the target device. The prohibition cancellation message is used to not allow the target device to cancel the subscription to the target topic; if the degree of association is greater than the preset condition threshold, the subscription of the target device to the target topic is canceled, and a subscription cancellation message is generated for the confirmation message. Then, the target device is enabled to communicate with other devices in the work scenario, and a subscription cancellation message is sent to the target device. By enabling the target device to share subscriptions with other devices, the target device is guaranteed to operate normally and report.

需要说明的是,对于允许目标设备取消订阅的目标主题,服务器可以先向目标设备发送对应的订阅取消确认消息,以便通过进一步的确认操作,判断目标设备是否取消订阅,降低误操作的可能性,同时可以确保目标设备能够及时了解订阅状态的变化;而在禁止目标设备取消订阅的过程中,服务器可以先评估取消目标主题的订阅对目标设备的设备执行是否有影响,灵活的适应性机制可以使得系统能够在不同的工作场景调整设备间的订阅状态,保证设备运行的稳定性和可靠性,例如,假设设备使用的协议是V1,服务器在一段时间后更新了协议V2,V2版本对V1版本的上报主题的级别进行了一些修改,即在V1版本是不需要但是V2版本是必须字段,则不允许设备取消订阅。It should be noted that, for target topics that allow target devices to cancel subscriptions, the server can first send a corresponding subscription cancellation confirmation message to the target device, so as to determine whether the target device cancels the subscription through further confirmation operations, reduce the possibility of misoperation, and ensure that the target device can timely understand the changes in subscription status; while in the process of prohibiting the target device from canceling the subscription, the server can first evaluate whether the cancellation of the subscription to the target topic has an impact on the device execution of the target device. The flexible adaptive mechanism enables the system to adjust the subscription status between devices in different working scenarios to ensure the stability and reliability of device operation. For example, assuming that the device uses protocol V1, the server updates the protocol V2 after a period of time. The V2 version makes some modifications to the level of the reported topic of the V1 version, that is, it is not required in the V1 version but it is a required field in the V2 version, then the device is not allowed to cancel the subscription.

可选地,对于主题与工作场景之间的关联性,服务器可以通过获取目标设备对应的设备操作日志、主题数据流量以及故障报告,然后采用设备操作日志、主题数据流量以及故障报告对目标主题与工作场景之间的关联性进行分析,获得目标主题与工作场景之间的关联程度,从而通过评估目标主题与工作场景之间的关联程度,以决定是否允许取消订阅,确保了关键性数据的稳定性和可靠性,防止因误操作或系统故障导致的关键数据丢失。Optionally, for the correlation between the subject and the work scenario, the server can obtain the device operation log, subject data traffic and fault report corresponding to the target device, and then use the device operation log, subject data traffic and fault report to analyze the correlation between the target subject and the work scenario to obtain the degree of correlation between the target subject and the work scenario, and thus decide whether to allow cancellation of the subscription by evaluating the degree of correlation between the target subject and the work scenario, thereby ensuring the stability and reliability of critical data and preventing the loss of critical data due to misoperation or system failure.

在一些示例中,服务器可以先进行设备操作日志收集,通过在目标设备上部署日志记录模块,记录设备的操作行为,包括订阅、发布、取消订阅等操作,目标设备可以定期将设备操作日志上传到服务器,存储在日志数据库中。并且,可以在MQTT代理服务器上部署流量监控模块,实时监控各个主题的数据流量,包括发布和订阅的数据量,以及将主题数据流量记录在流量数据库中,包括时间戳、主题名称、数据量等信息。此外,还可以在系统中部署故障检测模块,实时监控系统运行状态,检测故障事件,以及将故障报告记录在故障数据库中,包括故障时间、故障类型、受影响主题等信息。In some examples, the server can first collect device operation logs, and deploy a logging module on the target device to record the device's operation behavior, including subscription, publishing, and unsubscription operations. The target device can regularly upload the device operation log to the server and store it in the log database. In addition, a traffic monitoring module can be deployed on the MQTT proxy server to monitor the data traffic of each topic in real time, including the amount of data published and subscribed, and record the topic data traffic in the traffic database, including timestamps, topic names, data volumes, and other information. In addition, a fault detection module can also be deployed in the system to monitor the system's operating status in real time, detect fault events, and record fault reports in the fault database, including fault time, fault type, affected topics, and other information.

在获取了相应的数据后,服务器可以先对收集到的设备操作日志、主题数据流量和故障报告进行预处理,清洗和格式化数据,接着采用关联性分析算法,如相关系数、互信息等,计算目标主题与工作场景之间的关联程度,以及分析设备操作日志,统计目标主题在不同工作场景下的操作频率和操作类型;分析主题数据流量,统计目标主题在不同工作场景下的数据量和数据变化趋势;分析故障报告,统计目标主题在不同工作场景下的故障发生频率和故障类型。在分析得到相应的处理结果后,服务器可以进一步根据关联性分析算法的结果,计算目标主题与工作场景之间的关联程度,以便进一步通过设定关联程度的阈值,然后根据阈值判断目标主题与工作场景之间的关联性是否达到预设条件。After obtaining the corresponding data, the server can first pre-process the collected device operation logs, subject data traffic and fault reports, clean and format the data, and then use correlation analysis algorithms, such as correlation coefficients, mutual information, etc., to calculate the degree of correlation between the target subject and the work scene, and analyze the device operation logs to count the operation frequency and operation type of the target subject in different work scenes; analyze the subject data traffic to count the data volume and data change trend of the target subject in different work scenes; analyze the fault report to count the fault frequency and fault type of the target subject in different work scenes. After the analysis obtains the corresponding processing results, the server can further calculate the degree of correlation between the target subject and the work scene based on the results of the correlation analysis algorithm, so as to further set the threshold of the correlation degree, and then judge whether the correlation between the target subject and the work scene meets the preset conditions based on the threshold.

步骤3、向所述目标设备发送管控消息,所述管控消息用于指示允许或不允许所述目标设备取消对所述目标主题的订阅;Step 3: Send a control message to the target device, where the control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic;

当服务器根据主题类型确定目标设备是否可以取消对目标主题的订阅后,可以生成相应的管控消息,并向目标设备发送管控消息,以便通过该管控消息指示允许或不允许目标设备取消对目标主题的订阅,若管控消息为取消订阅消息,则目标主题可以取消对目标主题的订阅;若管控消息为禁止取消消息,则目标设备需要保持对目标主题的订阅,从而服务器通过动态管理设备的订阅权限,保证了安全性,并且当服务器指示不允许取消订阅时,使得目标设备可以基于目标主题继续运行,保证了设备运行的稳定性,当服务器指示允许取消订阅时,能够有效地减少无关的主题订阅,优化了资源的利用。After the server determines whether the target device can cancel its subscription to the target topic according to the topic type, it can generate a corresponding control message and send the control message to the target device, so as to indicate through the control message whether the target device is allowed or not to cancel its subscription to the target topic. If the control message is a cancellation message, the target device can cancel its subscription to the target topic; if the control message is a prohibition cancellation message, the target device needs to maintain its subscription to the target topic. Thus, the server ensures security by dynamically managing the subscription permissions of the device. When the server indicates that cancellation of subscription is not allowed, the target device can continue to operate based on the target topic, thereby ensuring the stability of the device operation. When the server indicates that cancellation of subscription is allowed, it can effectively reduce irrelevant topic subscriptions and optimize resource utilization.

步骤4、接收所述目标设备发送的针对所述管控消息的执行日志,根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,返回所述步骤1。Step 4: Receive the execution log for the management and control message sent by the target device, adjust the type of the target topic according to the execution log, obtain the target topic type corresponding to the target topic, and return to step 1.

对于目标设备,其在根据管控消息执行了对应的操作后,还可以持续根据设备操作采集相应的日志数据,获得对应的执行日志,然后可以将执行日志上报至服务器,以便服务器根据执行日志调整MQTT主题对应的主题类型,如可以根据执行日志对目标主题进行类型调整,获得目标主题对应的目标主题类型,从而,通过获取执行日志动态调整主题类型,优化了设备运行,实现了持续性的优化,有利于更加针对性地对设备进行管理控制。For the target device, after it performs the corresponding operation according to the management and control message, it can also continue to collect corresponding log data according to the device operation to obtain the corresponding execution log, and then report the execution log to the server so that the server can adjust the topic type corresponding to the MQTT topic according to the execution log. For example, the type of the target topic can be adjusted according to the execution log to obtain the target topic type corresponding to the target topic. Thus, by obtaining the execution log and dynamically adjusting the topic type, the device operation is optimized, and continuous optimization is achieved, which is conducive to more targeted management and control of the device.

在一些可行的实现方式中,执行日志至少包括第一执行日志以及第二执行日志,第一执行日志为目标设备取消对目标主题的订阅后预设时长内执行设备操作生成的日志,第二执行日志为目标设备在取消对目标主题的订阅之前预设时长内执行设备操作生成的日志,则服务器在接收到相应的执行日志后,可以先从第一执行日志中获取目标设备执行的第一设备操作,以及执行第一设备操作对应的第一成功率,以及从第二执行日志中获取目标设备执行的第二设备操作,以及执行第二设备操作对应的第二成功率,然后将第一设备操作与第二设备操作进行匹配、并将第一成功率与第二成功率进行匹配,获得第一执行日志与第二执行日志之间的相似度,再根据相似度判断是否调整MQTT主题的主题类型,若相似度小于或等于预设相似度阈值,表征取消订阅相应MQTT主题后,对目标设备的设备运行产生了影响,则将目标主题由非关键性主题调整为关键性主题;若相似度大于预设相似度阈值,则可以保持目标主题的主题类型不变。In some feasible implementations, the execution log includes at least a first execution log and a second execution log, the first execution log being a log generated by executing a device operation within a preset time period after the target device cancels its subscription to the target topic, and the second execution log being a log generated by executing a device operation within a preset time period before the target device cancels its subscription to the target topic. After receiving the corresponding execution log, the server may first obtain the first device operation executed by the target device and the first success rate corresponding to the execution of the first device operation from the first execution log, and obtain the second device operation executed by the target device and the second success rate corresponding to the execution of the second device operation from the second execution log, and then match the first device operation with the second device operation and the first success rate with the second success rate to obtain the similarity between the first execution log and the second execution log, and then determine whether to adjust the topic type of the MQTT topic based on the similarity. If the similarity is less than or equal to the preset similarity threshold, it indicates that the cancellation of the subscription to the corresponding MQTT topic has an impact on the device operation of the target device, and the target topic is adjusted from a non-critical topic to a critical topic; if the similarity is greater than the preset similarity threshold, the topic type of the target topic may be kept unchanged.

相应地,假设目标主题当前为关键性主题,且服务器禁止目标设备取消订阅该目标主题,则基于上述过程对目标设备禁止取消订阅前后的设备运行状态进行检测后,若相似度小于或等于预设相似度阈值,表征禁止取消订阅对设备运行产生了影响,则可以将目标主题由关键性主题调整为非关键性主题;同理,若相似度大于预设相似度阈值,表征禁止取消订阅对目标设备的运行影响减小,可以保持目标主题的主题类型,从而通过获取执行日志动态调整主题类型,优化了设备运行,实现了持续性的优化,有利于更加针对性地对设备进行管理控制。Accordingly, assuming that the target topic is currently a critical topic, and the server prohibits the target device from unsubscribing from the target topic, then based on the above process, after detecting the device operating status before and after the target device is prohibited from unsubscribing, if the similarity is less than or equal to the preset similarity threshold, indicating that prohibiting unsubscribing has an impact on the device operation, the target topic can be adjusted from a critical topic to a non-critical topic; similarly, if the similarity is greater than the preset similarity threshold, indicating that the impact of prohibiting unsubscribing on the operation of the target device is reduced, the topic type of the target topic can be maintained, thereby dynamically adjusting the topic type by obtaining the execution log, optimizing the device operation, achieving continuous optimization, and facilitating more targeted management and control of the device.

在一种示例中,假设智能家居系统中有一个目标设备(如智能灯具),其订阅了一个目标主题(如home/lighting/living_room)。服务器可以通过分析执行日志来判断取消订阅该主题后对设备运行的影响,并据此调整主题类型。具体过程可以包括:In one example, suppose there is a target device (such as a smart lamp) in a smart home system, which subscribes to a target topic (such as home/lighting/living_room). The server can determine the impact of unsubscribing from the topic on the device operation by analyzing the execution log, and adjust the topic type accordingly. The specific process may include:

1、执行日志分析1. Perform log analysis

第一执行日志:目标设备取消对目标主题的订阅后预设时长内执行设备操作生成的日志。例如,目标设备在取消订阅home/lighting/living_room主题后,执行了以下操作:操作A:调整客厅灯光亮度;操作B:调整客厅灯光颜色。执行成功率:操作A的成功率为80%;操作B的成功率为75%。First execution log: The log generated by the device operation performed within the preset time after the target device unsubscribes from the target topic. For example, after the target device unsubscribes from the home/lighting/living_room topic, it performs the following operations: Operation A: Adjust the brightness of the living room light; Operation B: Adjust the color of the living room light. Execution success rate: The success rate of operation A is 80%; the success rate of operation B is 75%.

第二执行日志:目标设备在取消对目标主题的订阅之前预设时长内执行设备操作生成的日志。例如,目标设备在取消订阅home/lighting/living_room主题前,执行了以下操作:操作A:调整客厅灯光亮度;操作B:调整客厅灯光颜色。执行成功率:操作A的成功率为95%;操作B的成功率为90%。Second execution log: The log generated by the target device performing device operations within the preset time before unsubscribing from the target topic. For example, before unsubscribing from the home/lighting/living_room topic, the target device performed the following operations: Operation A: Adjust the brightness of the living room light; Operation B: Adjust the color of the living room light. Execution success rate: The success rate of operation A is 95%; the success rate of operation B is 90%.

2、相似度计算与匹配2. Similarity calculation and matching

服务器可以先进行设备操作匹配:第一执行日志中的操作A与第二执行日志中的操作A匹配,第一执行日志中的操作B与第二执行日志中的操作B匹配。然后进行成功率匹配:第一执行日志中操作A的成功率(80%)与第二执行日志中操作A的成功率(95%)匹配,第一执行日志中操作B的成功率(75%)与第二执行日志中操作B的成功率(90%)匹配。再进行相似度的计算:计算操作A和操作B的成功率变化,得出相似度。例如,相似度计算公式可以为:The server can first match the device operations: Operation A in the first execution log matches Operation A in the second execution log, and Operation B in the first execution log matches Operation B in the second execution log. Then, the success rate is matched: The success rate of Operation A in the first execution log (80%) matches the success rate of Operation A in the second execution log (95%), and the success rate of Operation B in the first execution log (75%) matches the success rate of Operation B in the second execution log (90%). Then, the similarity is calculated: the changes in the success rates of Operation A and Operation B are calculated to obtain the similarity. For example, the similarity calculation formula can be:

相似度=∑(第一成功率-第二成功率)/操作数量Similarity = ∑(first success rate - second success rate)/number of operations

3、主题类型调整3. Theme type adjustment

假设计算结果为相似度为15%,则服务器可以进一步基于计算得到的相似度对主题类型调整,具体的,若相似度小于或等于预设相似度阈值(例如10%),则表征取消订阅相应MQTT主题后,对目标设备的设备运行产生了影响;若相似度大于预设相似度阈值,则可以保持目标主题的主题类型不变。Assuming that the calculated result is a similarity of 15%, the server can further adjust the topic type based on the calculated similarity. Specifically, if the similarity is less than or equal to a preset similarity threshold (for example, 10%), it indicates that the device operation of the target device is affected after the cancellation of the subscription to the corresponding MQTT topic; if the similarity is greater than the preset similarity threshold, the topic type of the target topic can be kept unchanged.

在本例中,相似度为15%,大于预设相似度阈值(10%),因此保持目标主题home/lighting/living_room的主题类型不变(非关键性主题)。In this example, the similarity is 15%, which is greater than the preset similarity threshold (10%), so the topic type of the target topic home/lighting/living_room is kept unchanged (non-critical topic).

通过上述分析和调整,智能家居系统可以动态地根据设备操作日志的相似度来调整MQTT主题的主题类型,确保系统的稳定性和用户体验。这种动态调整机制提高了系统的灵活性和适应性,使得系统能够更好地应对各种实际运行情况。Through the above analysis and adjustment, the smart home system can dynamically adjust the topic type of the MQTT topic according to the similarity of the device operation log to ensure the stability of the system and user experience. This dynamic adjustment mechanism improves the flexibility and adaptability of the system, allowing the system to better cope with various actual operating conditions.

需要说明的是,本发明实施例包括但不限于上述示例,可以理解的是,本领域技术人员在本发明实施例的思想指导下,还可以根据实际需求进行设置,本发明对此不作限制。It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.

在本发明实施例中,可以通过服务器对设备订阅权限进行统一的管理,通过响应于处于工作场景中的目标设备触发取消主题的订阅,获取目标设备取消订阅的目标主题,接着可以根据目标主题对应的当前主题类型执行针对目标设备的订阅管控操作,生成针对目标设备的管控消息,然后向目标设备发送管控消息,管控消息用于指示允许或不允许目标设备取消对目标主题的订阅,并接收目标设备发送的针对管控消息的执行日志,根据执行日志对目标主题进行类型调整,获得目标主题对应的目标主题类型,从而服务器通过动态管理设备的订阅权限,保证了安全性,并且当服务器指示不允许取消订阅时,使得目标设备可以基于目标主题继续运行,保证了设备运行的稳定性,当服务器指示允许取消订阅时,能够有效地减少无关的主题订阅,优化了资源的利用,以及通过获取执行日志动态调整主题类型,优化了设备运行,实现了持续性的优化,有利于更加针对性地对设备进行管理控制。In an embodiment of the present invention, the device subscription authority can be uniformly managed by the server, and the target device in the working scenario triggers the cancellation of the subscription of the topic, and obtains the target topic that the target device cancels the subscription. Then, the subscription management and control operation for the target device can be performed according to the current topic type corresponding to the target topic, and a management and control message for the target device is generated. Then, the management and control message is sent to the target device, and the management and control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic, and the execution log for the management and control message sent by the target device is received. The type of the target topic is adjusted according to the execution log, and the target topic type corresponding to the target topic is obtained. In this way, the server ensures security by dynamically managing the subscription authority of the device, and when the server indicates that the cancellation of the subscription is not allowed, the target device can continue to operate based on the target topic, thereby ensuring the stability of the device operation. When the server indicates that the cancellation of the subscription is allowed, it can effectively reduce irrelevant topic subscriptions, optimize resource utilization, and dynamically adjust the topic type by obtaining the execution log, optimize the device operation, and achieve continuous optimization, which is conducive to more targeted management and control of the device.

为了使本领域技术人员更好地理解本发明实施例中的技术方案,下面通过相应的例子进行示例性说明:In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are used for exemplary description:

参照图2,示出了本发明实施例中提供的设备控制的流程示意图,其中,服务器与设备之间互相订阅MQTT主题,且服务器能够对设备请求的MQTT主题进行监控,设备能够应答服务器的必须字段上报请求。2 , a schematic diagram of the process of device control provided in an embodiment of the present invention is shown, wherein the server and the device subscribe to MQTT topics with each other, and the server can monitor the MQTT topics requested by the device, and the device can respond to the server's required field reporting request.

当服务器监测到目标场景执行的过程中,设备A无法正常上报或无法订阅目标MQTT主题b(下述为主题b),可能是由于设备A出现程序故障引起,而以服务器的角度而言,可以假定是设备A主动取消订阅主题b,则在服务器对设备A进行主题b的鉴权后,可以进行相应的处理:When the server detects that device A cannot report normally or cannot subscribe to the target MQTT topic b (hereinafter referred to as topic b) during the execution of the target scenario, it may be caused by a program failure in device A. From the perspective of the server, it can be assumed that device A actively unsubscribes from topic b. After the server authenticates device A for topic b, it can perform corresponding processing:

①服务器控制设备A不能主动取消订阅;① The server controls device A and cannot actively cancel the subscription;

②防止设备主动取消订阅。②Prevent devices from actively canceling subscriptions.

对于①,当服务器检测到取消订阅请求(包括设备A无法正常上报或无法订阅主题b等情况)时,可以检查该取消订阅请求对应的主题b是否为关键性主题,并基于检查结果判断是否允许该取消订阅操作。具体的,若主题b为关键性主题,则服务器可以进步判断禁止取消订阅该主题b是否对设备A的执行产生影响,若不会产生影响,则不允许设备A取消订阅主题b;若禁止取消订阅主题b会对设备A的运行产生影响,则服务器可以取消设备A对主题b的订阅,同时开放设备A的共享订阅方式,允许设备A对同一场景下其他设备获取对应主题消息的权限,保证设备可以正常运行与上报。For ①, when the server detects a request to cancel subscription (including situations where device A cannot report normally or cannot subscribe to topic b, etc.), it can check whether the topic b corresponding to the request to cancel subscription is a critical topic, and determine whether to allow the unsubscription operation based on the check result. Specifically, if topic b is a critical topic, the server can further determine whether prohibiting the unsubscription of topic b will affect the execution of device A. If it will not affect, device A will not be allowed to unsubscribe from topic b; if prohibiting the unsubscription of topic b will affect the operation of device A, the server can cancel device A's subscription to topic b, and at the same time open the shared subscription method of device A, allowing device A to obtain the corresponding topic message permissions for other devices in the same scenario, to ensure that the device can operate and report normally.

对于②,在服务器中,可以为不同的设备或客户端设置不同的权限级别,通过查看该设备或客户端是否具有订阅或取消订阅操作的权限,然后基于查询结果,若对应的主题为关键性主题,则不允许设备主动取消订阅;若对应的主题为非关键性主题,且设备或客户端具有取消订阅操作的权限,则服务器可以发送取消订阅警告,提醒设备该主题的重要性,并要求设备确认是否取消订阅,当收到设备取消订阅该主题的ACK(Acknowledgment,确认接收)后,由服务器确认该ACK有效,则允许该设备取消订阅这一主题,同时服务器可以对取消订阅该主题的前后一段时间内场景执行成功率及设备操作等日志信息进行记录对比,若影响小于某一阈值,则对该设备的该主题标记为“非关键性”主题,以便基于前述示例中服务器控制设备不能主动取消订阅的判断过程。For ②, in the server, different permission levels can be set for different devices or clients. By checking whether the device or client has the permission to subscribe or unsubscribe, based on the query result, if the corresponding topic is a critical topic, the device is not allowed to actively unsubscribe; if the corresponding topic is a non-critical topic and the device or client has the permission to unsubscribe, the server can send an unsubscribe warning to remind the device of the importance of the topic and ask the device to confirm whether to unsubscribe. After receiving the ACK (Acknowledgment) of the device unsubscribing from the topic, the server confirms that the ACK is valid, and allows the device to unsubscribe from the topic. At the same time, the server can record and compare the log information such as the scene execution success rate and device operation in the period before and after unsubscribing from the topic. If the impact is less than a certain threshold, the topic of the device is marked as a "non-critical" topic, so as to judge that the server control device cannot actively unsubscribe based on the above example.

通过上述过程,服务器通过动态管理设备的订阅权限,保证了安全性,并且当服务器指示不允许取消订阅时,使得目标设备可以基于目标主题继续运行,保证了设备运行的稳定性,当服务器指示允许取消订阅时,能够有效地减少无关的主题订阅,优化了资源的利用,以及通过获取执行日志动态调整主题类型,优化了设备运行,实现了持续性的优化,有利于更加针对性地对设备进行管理控制。Through the above process, the server ensures security by dynamically managing the subscription permissions of the device, and when the server indicates that cancellation of subscription is not allowed, the target device can continue to operate based on the target topic, ensuring the stability of device operation. When the server indicates that cancellation of subscription is allowed, it can effectively reduce irrelevant topic subscriptions and optimize resource utilization. It can also dynamically adjust the topic type by obtaining the execution log, optimize device operation, and achieve continuous optimization, which is conducive to more targeted management and control of the device.

需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

参照图3,示出了本发明实施例中提供的一种设备的控制装置的结构框图,具体可以包括如下模块:3, a structural block diagram of a control device of a device provided in an embodiment of the present invention is shown, which may specifically include the following modules:

主题获取模块301,用于响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题;The topic acquisition module 301 is used to acquire the target topic that the target device unsubscribes from in response to the target device in the working scenario triggering the cancellation of the topic subscription;

消息生成模块302,用于根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息;A message generating module 302, configured to perform a subscription control operation on the target device according to a current topic type corresponding to the target topic, and generate a control message for the target device;

消息发送模块303,用于向所述目标设备发送管控消息,所述管控消息用于指示允许或不允许所述目标设备取消对所述目标主题的订阅;A message sending module 303 is used to send a control message to the target device, where the control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic;

主题调整模块304,用于接收所述目标设备发送的针对所述管控消息的执行日志,根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,返回所述响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题。The topic adjustment module 304 is used to receive the execution log for the management and control message sent by the target device, adjust the type of the target topic according to the execution log, obtain the target topic type corresponding to the target topic, return the subscription cancellation triggered by the target device in the working scenario, and obtain the target topic that the target device cancels its subscription.

在一些可选的实施例中,所述消息生成模块302具体用于:In some optional embodiments, the message generating module 302 is specifically used for:

若所述目标主题当前为非关键性主题,则生成针对所述目标主题的订阅取消确认消息,向所述目标设备发送所述订阅取消确认消息,所述订阅取消确认消息用于指示所述目标设备对所述目标主题的取消订阅进行确认,所述非关键性主题为使用频率小于或等于预设阈值的主题;If the target topic is currently a non-critical topic, a subscription cancellation confirmation message for the target topic is generated, and the subscription cancellation confirmation message is sent to the target device, wherein the subscription cancellation confirmation message is used to instruct the target device to confirm the cancellation of the subscription to the target topic, and the non-critical topic is a topic whose usage frequency is less than or equal to a preset threshold;

接收所述目标设备发送的针对所述订阅取消确认消息的确认消息,取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息,所述订阅取消消息用于指示允许所述目标设备取消对所述目标主题的订阅。A confirmation message for the subscription cancellation confirmation message sent by the target device is received, the subscription of the target device to the target topic is canceled, and a subscription cancellation message for the confirmation message is generated, wherein the subscription cancellation message is used to indicate that the target device is allowed to cancel the subscription to the target topic.

在一些可选的实施例中,所述消息生成模块302具体还用于:In some optional embodiments, the message generating module 302 is further configured to:

若所述目标主题当前为关键性主题,则获取所述目标主题与所述工作场景之间的关联程度,所述关联程度用于表征禁止取消所述目标主题的订阅对所述目标设备的执行所产生的影响;If the target topic is currently a critical topic, obtaining a correlation degree between the target topic and the work scenario, the correlation degree being used to characterize the impact of prohibiting cancellation of subscription to the target topic on the execution of the target device;

若所述关联程度小于或等于预设条件阈值,则生成针对所述目标主题的禁止取消消息,向所述目标设备发送所述禁止取消消息,所述禁止取消消息用于不允许所述目标设备取消对所述目标主题的订阅。If the association degree is less than or equal to a preset condition threshold, a prohibition cancellation message for the target topic is generated and sent to the target device, where the prohibition cancellation message is used to not allow the target device to cancel its subscription to the target topic.

在一些可选的实施例中,所述消息生成模块302具体还用于:In some optional embodiments, the message generating module 302 is further configured to:

若所述关联程度大于预设条件阈值,则取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息;If the association degree is greater than a preset condition threshold, canceling the subscription of the target device to the target topic, and generating a subscription cancellation message for the confirmation message;

开通所述目标设备在所述工作场景下与其他设备进行通信的权限,并向所述目标设备发送所述订阅取消消息。The target device is enabled to communicate with other devices in the working scenario, and the subscription cancellation message is sent to the target device.

在一些可选的实施例中,所述消息生成模块302具体还用于:In some optional embodiments, the message generating module 302 is further configured to:

获取所述目标设备对应的设备操作日志、主题数据流量以及故障报告;Obtaining device operation logs, subject data flow, and fault reports corresponding to the target device;

采用所述设备操作日志、所述主题数据流量以及所述故障报告对所述目标主题与所述工作场景之间的关联性进行分析,获得所述目标主题与所述工作场景之间的关联程度。The device operation log, the subject data flow and the fault report are used to analyze the correlation between the target subject and the work scenario to obtain the correlation degree between the target subject and the work scenario.

在一些可选的实施例中,所述执行日志至少包括第一执行日志以及第二执行日志,所述第一执行日志为所述目标设备取消对所述目标主题的订阅后预设时长内执行设备操作生成的日志,所述第二执行日志为所述目标设备在取消对所述目标主题的订阅之前预设时长内执行设备操作生成的日志,所述主题调整模块304具体用于:In some optional embodiments, the execution log includes at least a first execution log and a second execution log, the first execution log is a log generated by executing a device operation within a preset time after the target device cancels the subscription to the target topic, and the second execution log is a log generated by executing a device operation within a preset time before the target device cancels the subscription to the target topic. The topic adjustment module 304 is specifically used to:

从所述第一执行日志中获取所述目标设备执行的第一设备操作,以及执行第一设备操作对应的第一成功率;Acquire, from the first execution log, a first device operation executed by the target device and a first success rate corresponding to executing the first device operation;

从所述第二执行日志中获取所述目标设备执行的第二设备操作,以及执行第二设备操作对应的第二成功率;Acquire, from the second execution log, a second device operation executed by the target device and a second success rate corresponding to executing the second device operation;

将所述第一设备操作与所述第二设备操作进行匹配、并将所述第一成功率与所述第二成功率进行匹配,获得所述第一执行日志与所述第二执行日志之间的相似度;Matching the first device operation with the second device operation and matching the first success rate with the second success rate to obtain a similarity between the first execution log and the second execution log;

若所述相似度小于或等于预设相似度阈值,则将所述目标主题由非关键性主题调整为关键性主题。If the similarity is less than or equal to a preset similarity threshold, the target topic is adjusted from a non-critical topic to a critical topic.

在一些可选的实施例中,所述主题获取模块301具体用于:In some optional embodiments, the theme acquisition module 301 is specifically used for:

接收处于工作场景中的目标设备发送的取消订阅请求,或,响应于预设时长内未接收所述目标设备的上报消息,则获取所述目标设备取消订阅的目标主题。A subscription cancellation request sent by a target device in a working scenario is received, or, in response to not receiving a report message from the target device within a preset time period, a target topic for the target device to cancel its subscription is obtained.

对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

另外,本发明实施例还提供了一种电子设备,包括:处理器,存储器,存储在存储器上并可在处理器上运行的计算机程序,该计算机程序被处理器执行时实现上述设备的控制方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the control method embodiment of the above-mentioned device are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

本发明实施例还提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述设备的控制方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。其中,所述的计算机可读存储介质,如只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等。The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the control method embodiment of the above-mentioned device is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

图4为实现本发明各个实施例的一种电子设备的硬件结构示意图。FIG. 4 is a schematic diagram of the hardware structure of an electronic device implementing various embodiments of the present invention.

该电子设备400包括但不限于:射频单元401、网络模块402、音频输出单元403、输入单元404、传感器405、显示单元406、用户输入单元407、接口单元408、存储器409、处理器410、以及电源411等部件。本领域技术人员可以理解,本发明实施例中所涉及的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。在本发明实施例中,电子设备包括但不限于手机、平板电脑、笔记本电脑、掌上电脑、车载终端、可穿戴设备、以及计步器等。The electronic device 400 includes but is not limited to: a radio frequency unit 401, a network module 402, an audio output unit 403, an input unit 404, a sensor 405, a display unit 406, a user input unit 407, an interface unit 408, a memory 409, a processor 410, and a power supply 411. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.

应理解的是,本发明实施例中,射频单元401可用于收发信息或通话过程中,信号的接收和发送,具体的,将来自基站的下行数据接收后,给处理器410处理;另外,将上行的数据发送给基站。通常,射频单元401包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器、双工器等。此外,射频单元401还可以通过无线通信系统与网络和其他设备通信。It should be understood that in the embodiment of the present invention, the radio frequency unit 401 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 410 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 401 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 401 can also communicate with the network and other devices through a wireless communication system.

电子设备通过网络模块402为用户提供了无线的宽带互联网访问,如帮助用户收发电子邮件、浏览网页和访问流式媒体等。The electronic device provides users with wireless broadband Internet access through the network module 402, such as helping users to send and receive emails, browse web pages, and access streaming media.

音频输出单元403可以将射频单元401或网络模块402接收的或者在存储器409中存储的音频数据转换成音频信号并且输出为声音。而且,音频输出单元403还可以提供与电子设备400执行的特定功能相关的音频输出(例如,呼叫信号接收声音、消息接收声音等等)。音频输出单元403包括扬声器、蜂鸣器以及受话器等。The audio output unit 403 can convert the audio data received by the RF unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output it as sound. Moreover, the audio output unit 403 can also provide audio output related to a specific function performed by the electronic device 400 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, etc.

输入单元404用于接收音频或视频信号。输入单元404可以包括图形处理器(Graphics Processing Unit,GPU)4041和麦克风4042,图形处理器4041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。处理后的图像帧可以显示在显示单元406上。经图形处理器4041处理后的图像帧可以存储在存储器409(或其它存储介质)中或者经由射频单元401或网络模块402进行发送。麦克风4042可以接收声音,并且能够将这样的声音处理为音频数据。处理后的音频数据可以在电话通话模式的情况下转换为可经由射频单元401发送到移动通信基站的格式输出。The input unit 404 is used to receive audio or video signals. The input unit 404 may include a graphics processor (GPU) 4041 and a microphone 4042, and the graphics processor 4041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 406. The image frame processed by the graphics processor 4041 can be stored in the memory 409 (or other storage medium) or sent via the radio frequency unit 401 or the network module 402. The microphone 4042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 401 in the case of a telephone call mode.

电子设备400还包括至少一种传感器405,比如光传感器、运动传感器以及其他传感器。具体地,光传感器包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板4061的亮度,接近传感器可在电子设备400移动到耳边时,关闭显示面板4061和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别电子设备姿态(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;传感器405还可以包括指纹传感器、压力传感器、虹膜传感器、分子传感器、陀螺仪、气压计、湿度计、温度计、红外线传感器等,在此不再赘述。The electronic device 400 also includes at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 4061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 4061 and/or the backlight when the electronic device 400 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 405 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.

显示单元406用于显示由用户输入的信息或提供给用户的信息。显示单元406可包括显示面板4061,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板4061。The display unit 406 is used to display information input by the user or information provided to the user. The display unit 406 may include a display panel 4061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

用户输入单元407可用于接收输入的数字或字符信息,以及产生与电子设备的用户设置以及功能控制有关的键信号输入。具体地,用户输入单元407包括触控面板4071以及其他输入设备4072。触控面板4071,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板4071上或在触控面板4071附近的操作)。触控面板4071可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器410,接收处理器410发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板4071。除了触控面板4071,用户输入单元407还可以包括其他输入设备4072。具体地,其他输入设备4072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。The user input unit 407 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. The touch panel 4071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 4071 or near the touch panel 4071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 4071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 410, receives the command sent by the processor 410 and executes it. In addition, the touch panel 4071 can be implemented using various types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 4071, the user input unit 407 may also include other input devices 4072. Specifically, other input devices 4072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.

进一步的,触控面板4071可覆盖在显示面板4061上,当触控面板4071检测到在其上或附近的触摸操作后,传送给处理器410以确定触摸事件的类型,随后处理器410根据触摸事件的类型在显示面板4061上提供相应的视觉输出。可以理解的是,在一种实施例中,触控面板4071与显示面板4061是作为两个独立的部件来实现电子设备的输入和输出功能,但是在某些实施例中,可以将触控面板4071与显示面板4061集成而实现电子设备的输入和输出功能,具体此处不做限定。Further, the touch panel 4071 may be covered on the display panel 4061. When the touch panel 4071 detects a touch operation on or near it, it is transmitted to the processor 410 to determine the type of the touch event, and then the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. It can be understood that in one embodiment, the touch panel 4071 and the display panel 4061 are used as two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 4071 and the display panel 4061 can be integrated to implement the input and output functions of the electronic device, which is not limited here.

接口单元408为外部装置与电子设备400连接的接口。例如,外部装置可以包括有线或无线头戴式耳机端口、外部电源(或电池充电器)端口、有线或无线数据端口、存储卡端口、用于连接具有识别模块的装置的端口、音频输入/输出(I/O)端口、视频I/O端口、耳机端口等等。接口单元408可以用于接收来自外部装置的输入(例如,数据信息、电力等等)并且将接收到的输入传输到电子设备400内的一个或多个元件或者可以用于在电子设备400和外部装置之间传输数据。The interface unit 408 is an interface for connecting an external device to the electronic device 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input/output (I/O) port, a video I/O port, a headphone port, etc. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 400 or may be used to transmit data between the electronic device 400 and an external device.

存储器409可用于存储软件程序以及各种数据。存储器409可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器409可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 409 can be used to store software programs and various data. The memory 409 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 409 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

处理器410是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器409内的软件程序和/或模块,以及调用存储在存储器409内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。处理器410可包括一个或多个处理单元;优选的,处理器410可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器410中。The processor 410 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 409, and calling data stored in the memory 409, so as to monitor the electronic device as a whole. The processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 410.

电子设备400还可以包括给各个部件供电的电源411(比如电池),优选的,电源411可以通过电源管理系统与处理器410逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The electronic device 400 may also include a power supply 411 (such as a battery) for supplying power to each component. Preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.

另外,电子设备400包括一些未示出的功能模块,在此不再赘述。In addition, the electronic device 400 includes some functional modules not shown, which will not be described in detail here.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

上面结合附图对本发明的实施例进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本发明的保护之内。The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

本领域普通技术人员可以意识到,结合本发明实施例中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (10)

1.一种设备的控制方法,其特征在于,包括:1. A method for controlling a device, comprising: 步骤1、响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题;Step 1: In response to a target device in a working scenario triggering cancellation of a subscription to a topic, obtaining a target topic that the target device cancels its subscription; 步骤2、根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息;Step 2: Execute a subscription control operation for the target device according to the current topic type corresponding to the target topic, and generate a control message for the target device; 步骤3、向所述目标设备发送管控消息,所述管控消息用于指示允许或不允许所述目标设备取消对所述目标主题的订阅;Step 3: Send a control message to the target device, where the control message is used to indicate whether the target device is allowed or not to cancel the subscription to the target topic; 步骤4、接收所述目标设备发送的针对所述管控消息的执行日志,根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,返回所述步骤1。Step 4: Receive the execution log for the management and control message sent by the target device, adjust the type of the target topic according to the execution log, obtain the target topic type corresponding to the target topic, and return to step 1. 2.根据权利要求1所述的方法,其特征在于,所述根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息,包括:2. The method according to claim 1, characterized in that the step of performing a subscription control operation for the target device according to the current topic type corresponding to the target topic and generating a control message for the target device comprises: 若所述目标主题当前为非关键性主题,则生成针对所述目标主题的订阅取消确认消息,向所述目标设备发送所述订阅取消确认消息,所述订阅取消确认消息用于指示所述目标设备对所述目标主题的取消订阅进行确认,所述非关键性主题为使用频率小于或等于预设阈值的主题;If the target topic is currently a non-critical topic, a subscription cancellation confirmation message for the target topic is generated, and the subscription cancellation confirmation message is sent to the target device, wherein the subscription cancellation confirmation message is used to instruct the target device to confirm the cancellation of the subscription to the target topic, and the non-critical topic is a topic whose usage frequency is less than or equal to a preset threshold; 接收所述目标设备发送的针对所述订阅取消确认消息的确认消息,取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息,所述订阅取消消息用于指示允许所述目标设备取消对所述目标主题的订阅。A confirmation message for the subscription cancellation confirmation message sent by the target device is received, the subscription of the target device to the target topic is canceled, and a subscription cancellation message for the confirmation message is generated, wherein the subscription cancellation message is used to indicate that the target device is allowed to cancel the subscription to the target topic. 3.根据权利要求1或2所述的方法,其特征在于,所述根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息,还包括:3. The method according to claim 1 or 2, characterized in that the step of performing a subscription control operation for the target device according to the current topic type corresponding to the target topic and generating a control message for the target device further comprises: 若所述目标主题当前为关键性主题,则获取所述目标主题与所述工作场景之间的关联程度,所述关联程度用于表征禁止取消所述目标主题的订阅对所述目标设备的执行所产生的影响;If the target topic is currently a critical topic, obtaining a correlation degree between the target topic and the work scenario, the correlation degree being used to characterize the impact of prohibiting cancellation of subscription to the target topic on the execution of the target device; 若所述关联程度小于或等于预设条件阈值,则生成针对所述目标主题的禁止取消消息,向所述目标设备发送所述禁止取消消息,所述禁止取消消息用于不允许所述目标设备取消对所述目标主题的订阅。If the association degree is less than or equal to a preset condition threshold, a prohibition cancellation message for the target topic is generated and sent to the target device, where the prohibition cancellation message is used to not allow the target device to cancel its subscription to the target topic. 4.根据权利要求3所述的方法,其特征在于,所述根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息,还包括:4. The method according to claim 3, characterized in that the step of performing a subscription control operation for the target device according to the current topic type corresponding to the target topic and generating a control message for the target device further comprises: 若所述关联程度大于预设条件阈值,则取消所述目标设备对所述目标主题的订阅,并生成针对所述确认消息的订阅取消消息;If the association degree is greater than a preset condition threshold, canceling the subscription of the target device to the target topic, and generating a subscription cancellation message for the confirmation message; 开通所述目标设备在所述工作场景下与其他设备进行通信的权限,并向所述目标设备发送所述订阅取消消息。The target device is enabled to communicate with other devices in the working scenario, and the subscription cancellation message is sent to the target device. 5.根据权利要求3所述的方法,其特征在于,所述获取所述目标主题与所述工作场景之间的关联程度,包括:5. The method according to claim 3, wherein obtaining the degree of association between the target subject and the work scenario comprises: 获取所述目标设备对应的设备操作日志、主题数据流量以及故障报告;Obtaining device operation logs, subject data flow, and fault reports corresponding to the target device; 采用所述设备操作日志、所述主题数据流量以及所述故障报告对所述目标主题与所述工作场景之间的关联性进行分析,获得所述目标主题与所述工作场景之间的关联程度。The device operation log, the subject data flow and the fault report are used to analyze the correlation between the target subject and the work scenario to obtain the correlation degree between the target subject and the work scenario. 6.根据权利要求1所述的方法,其特征在于,所述执行日志至少包括第一执行日志以及第二执行日志,所述第一执行日志为所述目标设备取消对所述目标主题的订阅后预设时长内执行设备操作生成的日志,所述第二执行日志为所述目标设备在取消对所述目标主题的订阅之前预设时长内执行设备操作生成的日志,所述根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,包括:6. The method according to claim 1, characterized in that the execution log includes at least a first execution log and a second execution log, the first execution log is a log generated by the target device performing a device operation within a preset time period after the target device cancels the subscription to the target topic, and the second execution log is a log generated by the target device performing a device operation within a preset time period before the target device cancels the subscription to the target topic, and the type of the target topic is adjusted according to the execution log to obtain the target topic type corresponding to the target topic, comprising: 从所述第一执行日志中获取所述目标设备执行的第一设备操作,以及执行第一设备操作对应的第一成功率;Acquire, from the first execution log, a first device operation executed by the target device and a first success rate corresponding to executing the first device operation; 从所述第二执行日志中获取所述目标设备执行的第二设备操作,以及执行第二设备操作对应的第二成功率;Acquire, from the second execution log, a second device operation executed by the target device and a second success rate corresponding to executing the second device operation; 将所述第一设备操作与所述第二设备操作进行匹配、并将所述第一成功率与所述第二成功率进行匹配,获得所述第一执行日志与所述第二执行日志之间的相似度;Matching the first device operation with the second device operation and matching the first success rate with the second success rate to obtain a similarity between the first execution log and the second execution log; 若所述相似度小于或等于预设相似度阈值,则将所述目标主题由非关键性主题调整为关键性主题。If the similarity is less than or equal to a preset similarity threshold, the target topic is adjusted from a non-critical topic to a critical topic. 7.根据权利要求1所述的方法,其特征在于,所述响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题,包括:7. The method according to claim 1, characterized in that in response to the target device in the working scenario triggering the cancellation of the subscription of the topic, obtaining the target topic that the target device cancels the subscription comprises: 接收处于工作场景中的目标设备发送的取消订阅请求,或,响应于预设时长内未接收所述目标设备的上报消息,则获取所述目标设备取消订阅的目标主题。A subscription cancellation request sent by a target device in a working scenario is received, or, in response to not receiving a report message from the target device within a preset time period, a target topic for the target device to cancel its subscription is obtained. 8.一种设备的控制装置,其特征在于,包括:8. A control device for an equipment, characterized by comprising: 主题获取模块,用于响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题;A topic acquisition module, configured to, in response to a target device in a working scenario triggering cancellation of a topic subscription, acquire a target topic that the target device has unsubscribed from; 消息生成模块,用于根据所述目标主题对应的当前主题类型执行针对所述目标设备的订阅管控操作,生成针对所述目标设备的管控消息;A message generation module, used to perform a subscription control operation for the target device according to the current topic type corresponding to the target topic, and generate a control message for the target device; 消息发送模块,用于向所述目标设备发送管控消息,所述管控消息用于指示允许或不允许所述目标设备取消对所述目标主题的订阅;A message sending module, used for sending a control message to the target device, wherein the control message is used for indicating whether the target device is allowed or not to cancel the subscription to the target topic; 主题调整模块,用于接收所述目标设备发送的针对所述管控消息的执行日志,根据所述执行日志对所述目标主题进行类型调整,获得所述目标主题对应的目标主题类型,返回所述响应于处于工作场景中的目标设备触发取消主题的订阅,获取所述目标设备取消订阅的目标主题。A topic adjustment module is used to receive the execution log for the management and control message sent by the target device, adjust the type of the target topic according to the execution log, obtain the target topic type corresponding to the target topic, return the subscription cancellation triggered by the target device in the working scenario, and obtain the target topic that the target device cancels its subscription. 9.一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,所述处理器、所述通信接口以及所述存储器通过所述通信总线完成相互间的通信;9. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; 所述存储器,用于存放计算机程序;The memory is used to store computer programs; 所述处理器,用于执行存储器上所存放的程序时,实现如权利要求1-7任一项所述的方法。The processor is used to implement the method according to any one of claims 1 to 7 when executing the program stored in the memory. 10.一种计算机可读存储介质,其上存储有指令,当由一个或多个处理器执行所述指令时,使得所述处理器执行如权利要求1-7任一项所述的方法。10. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 7.
CN202410884770.0A 2024-07-03 2024-07-03 Device control method, device, electronic device and storage medium Pending CN118859754A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410884770.0A CN118859754A (en) 2024-07-03 2024-07-03 Device control method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410884770.0A CN118859754A (en) 2024-07-03 2024-07-03 Device control method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN118859754A true CN118859754A (en) 2024-10-29

Family

ID=93169084

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410884770.0A Pending CN118859754A (en) 2024-07-03 2024-07-03 Device control method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN118859754A (en)

Similar Documents

Publication Publication Date Title
AU2021269359B2 (en) Display method and apparatus
US11131976B2 (en) Device control system, method and apparatus, and gateways
CN107976911B (en) Equipment control method, device and system
CN110311811A (en) Configuration method, device, system, Cloud Server and storage medium
CN110488692B (en) Device control method, device, system, electronic device and storage medium
CN110335386B (en) Identity authentication method, device, terminal and storage medium
CN107450952B (en) Application control method and device, storage medium and electronic equipment
CN113609107A (en) Database management method and device, electronic equipment and storage medium
CN104506923A (en) Multimedia processing device, server and method
CN117411655A (en) Equipment decryption control method and device, electronic equipment and storage medium
CN111981632A (en) Information notification method and device and air conditioning system
CN114327332A (en) Internet of things equipment setting method and device, electronic equipment and storage medium
CN113108425B (en) A kind of air conditioning control method and control terminal
CN118859754A (en) Device control method, device, electronic device and storage medium
WO2022068564A1 (en) Device abnormality monitoring method and device
CN113891296B (en) Wireless network detection device and method for detecting non-predetermined electronic device
CN110677329A (en) Intelligent household control and monitoring system
CN117478716B (en) Communication method and device of equipment, electronic equipment and storage medium
CN117031973A (en) Household appliance control method, device, equipment and storage medium
CN111123791A (en) Temperature control method of household appliance and related product
CN119536048A (en) Device parameter processing method, device, electronic device and storage medium
CN115378803B (en) Log management method, device, blockchain node and storage medium
CN118605199A (en) Remote control method, device, electronic device and storage medium for smart home
CN119155663A (en) Communication mode switching method, device, medium and equipment based on Bluetooth connection
CN118860091A (en) Server operation control method, device, electronic device and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination