IoT Device Control with Message Queues for Faster Scene Triggering
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The large amount of status data from IoT devices leads to a longer time to determine whether a scene is triggered and lowers the server's concurrency performance.
Innovation Solution
A method involving acquiring attribute state data from IoT devices, sending it to a message queue when a trigger condition is met, using consumer threads to identify associated scenes and device shadows, and generating action execution instructions to control the IoT devices based on matching device shadows.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If all status data from IoT devices is processed by the server to determine scene triggering, then the scene triggering accuracy is improved, but the server's concurrency performance deteriorates and processing time increases
Solution Approach 1:
The patent divides the server into multiple consumer threads that process status data in parallel. Each consumer thread independently processes portions of the status data to determine scene triggering, thereby segmenting the monolithic processing task into manageable units that can be executed concurrently, improving both throughput and responsiveness while maintaining accurate scene triggering determination
Solution Approach 2:
The patent introduces a temporal dimension by implementing asynchronous processing with message queues. Status data is queued and processed in the background rather than blocking the main execution flow, allowing the system to handle大量 status data without impacting real-time response requirements, thus resolving the contradiction between comprehensive data processing and performance
2Measurement precision
If all status data from IoT devices is processed to ensure accurate scene triggering, then the triggering accuracy is improved, but the processing time increases
Solution Approach 1:
The patent performs preliminary filtering and categorization of status data before full processing. Consumer threads prioritize and pre-process critical status changes that are more likely to trigger scenes, while deferring or aggregating less critical data. This preliminary action reduces the overall processing time while maintaining accurate scene triggering by focusing computational resources on the most relevant data first
Data Source
Figure 1~2
Figure 3
Figure 4
AI summary
Disclosed in the present application are a device control method and apparatus, and an electronic device and a computer storage medium. In the present application, attribute state data is first stored in a preset message queue, and the attribute state data is then consumed from the preset message queue by means of a plurality of consumer threads, such that when the amount of attribute state data is relatively large, consumer threads cannot be created without limit so as to avoid server crashes, and peak shaving and valley filling are performed on state attribute data by means of the preset message queue, thereby improving the concurrency performance of a server.