Illumination and context based iot device control method and apparatus
Patent Information
- Application Number
- CN202610727367.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-25
- Publication Date
- 2026-09-29
AI Technical Summary
缺乏将修正控制值封装下发设备驱动模块后通过位置传感器采集实际状态值与目标状态执行偏差比对、偏差超限时生成补偿指令驱动受控设备执行二次调节、并将实际状态值与环境光照强度数据及情景模式标识写入用户习惯记录表的完整闭环控制与习惯数据沉淀机制,影响物联网设备执行精度保障与面向个性化控制优化的数据积累能力
[0017]由上述技术方案可知,本申请提供一种基于光照和情景的物联网设备控制方法及装置,通过光照强度数据、时段标识与情景选择指令的时间戳对齐构建时间同步数据组,结合情景指令有效性判断驱动双路径自适应修正控制值计算,并通过位置传感器偏差比对与二次补偿调节完成闭环控制后将实际状态数据写入用户习惯记录表,有效解决了传统技术在多源感知数据时间同步融合、情景与环境双路径自适应控制值计算以及设备状态闭环校验与用户习惯数据积累等方面的不足,为室内物联网设备的情景感知自适应控制与个性化管理优化提供了技术保障。
Smart Images

Figure CN122837264A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, specifically to a method and apparatus for controlling Internet of Things (IoT) devices based on illumination and scene. Background Technology
[0002] Existing IoT device control methods have significant shortcomings. Traditional systems perform poorly in the synchronous acquisition and management of multi-source sensing data and user commands. They typically rely on single sensor data or offline preset rules to drive device control, lacking the ability to fuse multi-source data. This involves collecting ambient light intensity data and time period identifiers from a light sensor at a preset sampling period, synchronously receiving user scenario selection commands from the customer control interaction terminal, and aligning the data according to the collection timestamp to obtain a time-synchronized data set. This results in a discrepancy between the environmental sensing data and user intent data upon which device control decisions depend in the time dimension, making it difficult to provide a high-quality, time-aligned input foundation for subsequent multi-factor joint control calculations.
[0003] Furthermore, existing technologies suffer from bottlenecks in determining the validity of scenario commands and calculating dual-path adaptive control values. Most systems lack flexible control logic that allows for split-path processing after determining the validity of scenario selection commands. They fail to achieve dual-path adaptive calculation capabilities: when a valid command exists, they retrieve device control reference values from the scenario parameter table and perform multi-factor weighted calculations based on ambient light intensity data and time period identifiers to obtain corrected control values; when no valid command exists, they perform interval matching between ambient light intensity data and preset light threshold intervals and read device control baseline values from a baseline value mapping table based on interval identifiers and time period identifiers as corrected control values. This results in insufficient responsiveness and adaptability of indoor IoT device control to user intentions and passive environmental changes, affecting the flexibility and scenario applicability of control strategies.
[0004] Existing systems have technical shortcomings in closed-loop verification of device status, secondary compensation adjustment, and accumulation of user habit data. They lack a complete closed-loop control and habit data accumulation mechanism that encapsulates and distributes corrective control values to the device driver module, compares the deviation between the actual and target status values collected by position sensors, generates compensation commands to drive the controlled device to perform secondary adjustments when the deviation exceeds limits, and writes the actual status values, ambient light intensity data, and scene mode identifiers into a user habit record table. This affects the accuracy of IoT device execution and the ability to accumulate data for personalized control optimization. Solving these problems is crucial for improving the environmental adaptability and personalized user experience management capabilities of indoor IoT device control systems. Summary of the Invention
[0005] To address the problems in existing technologies, this application provides a method and apparatus for controlling IoT devices based on illumination and context. This method and apparatus can effectively solve the shortcomings of traditional technologies in areas such as time synchronization fusion of multi-source sensing data, calculation of adaptive control values for dual paths of context and environment, closed-loop verification of device status, and accumulation of user habit data. This provides technical support for context-aware adaptive control and personalized management optimization of indoor IoT devices.
[0006] To solve at least one of the above problems, this application provides the following technical solution: In a first aspect, this application provides a method for controlling Internet of Things (IoT) devices based on illumination and scene, comprising: Ambient light intensity data is collected by light sensors deployed in the indoor space at a preset sampling period, and time period identifiers are collected simultaneously. The scene selection command sent by the user is received through the guest control interactive terminal. The ambient light intensity data, the time period identifiers and the scene selection command are aligned with the collection timestamp to obtain a time synchronization data group. The system reads the scenario selection instruction from the time synchronization data group and determines whether there is a valid instruction. If there is a valid instruction, it retrieves the device control reference value for the corresponding scenario mode from the scenario parameter table. The system performs a multi-factor weighted operation on the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm to obtain a corrected control value. If there is no valid instruction, the system performs interval matching on the ambient light intensity data and the preset light threshold interval to obtain the interval identifier. Based on the interval identifier and the time period identifier, the system reads the device control reference value from the reference value mapping table as the corrected control value. The corrected control value is encapsulated into a control command and sent to the device driver module. The device driver module drives the controlled device to adjust to the target state corresponding to the corrected control value. The actual state value of the controlled device is collected by the position sensor and compared with the deviation of the target state. If the deviation exceeds the preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, the ambient light intensity data and the scene mode identifier are written into the user habit record table.
[0007] Furthermore, it also includes: using a light sensor deployed in an indoor space near a window and in an unobstructed location to perform analog-to-digital conversion on the ambient light to obtain ambient light intensity data according to a preset sampling period; reading the current time from the system clock and performing interval assignment determination according to a preset time period division rule to obtain a time period identifier; and binding the ambient light intensity data with the time period identifier to form a light acquisition record. The system receives the user's scene selection command through the interactive interface of the guest control terminal and extracts the scene mode field from the command to obtain the scene mode identifier. The scene mode identifier is then aligned with the ambient light intensity data and time segment identifier in the light acquisition record according to the acquisition timestamp to obtain a time synchronization data group.
[0008] Furthermore, it also includes: extracting the corresponding acquisition timestamp from the ambient light intensity data output by the light sensor as the light timestamp, extracting the corresponding generation timestamp from the time period identifier generated by the system clock as the time period timestamp, extracting the corresponding reception timestamp from the scene selection instruction received by the customer control interaction terminal as the instruction timestamp, and performing matching of the light timestamp, the time period timestamp and the instruction timestamp according to a preset time tolerance window to obtain a time alignment index; The ambient light intensity data, the time period identifier, and the scene selection instruction are associated and bound together according to the time alignment index to form a data record tuple. The data record tuple is then encapsulated with a unified timestamp to obtain a time synchronization data group.
[0009] Furthermore, it also includes: reading the scenario selection instruction from the time synchronization data group and performing non-empty verification and format compliance judgment on the instruction content to obtain the instruction validity mark; if the instruction validity mark is valid, extracting the scenario mode field from the scenario selection instruction and retrieving the corresponding record from the scenario parameter table based on the scenario mode field to obtain the device control reference value and scenario adaptation illumination value. Ambient light intensity data and time period identifiers are read from the time synchronization data group. The ambient light intensity data and the scene-adapted light value are compared to obtain the light deviation. The corresponding time period weighting coefficient is read from the time period weight table according to the time period identifier. The light deviation and the time period weighting coefficient are multiplied to obtain the weighted deviation. The device control reference value and the weighted deviation are superimposed to obtain the corrected control value.
[0010] Furthermore, it also includes: if the instruction validity mark is invalid, then read the ambient light intensity data from the time synchronization data group, and perform a numerical comparison between the ambient light intensity data and the boundary values of each interval in the preset light threshold interval to determine the interval to which it belongs and obtain the interval identifier. Read the time period identifier from the time synchronization data group, combine the interval identifier and the time period identifier to form a joint index key, retrieve the corresponding record from the reference value mapping table according to the joint index key to obtain the device control reference value, and use the device control reference value as the correction control value.
[0011] Furthermore, it also includes: reading the correction control value and assembling the correction control value with the device address identifier and the instruction type field according to the preset instruction message format to obtain an instruction data frame; performing serialization encoding on the instruction data frame to form a control instruction and sending it to the device driver module through the communication interface; The device driver module receives the control command and decodes it to obtain the corrected control value and the device address identifier. Based on the device address identifier, it locates the controlled device and converts the corrected control value into a drive signal. The drive signal drives the actuator of the controlled device to operate, so that the controlled device is adjusted to the target state corresponding to the corrected control value.
[0012] Furthermore, it also includes: collecting the current position data of the controlled device through a position sensor installed on the controlled device and converting it into an actual state value; performing a difference calculation between the actual state value and the target state to obtain a state deviation amount; performing a numerical comparison between the state deviation amount and the boundary value of a preset allowable range to obtain a deviation judgment result; if the deviation judgment result is out of limit, calculating a compensation amount based on the state deviation amount and encapsulating it into a compensation instruction; and sending the compensation instruction to the device driver module to drive the controlled device to perform a secondary adjustment. Read ambient light intensity data and scene mode identifier from the time synchronization data group, assemble the actual state value, ambient light intensity data and scene mode identifier into a habit data record according to the preset record format, and write the habit data record into the user habit record table.
[0013] Secondly, this application provides an Internet of Things (IoT) device control device based on illumination and scene, comprising: The environmental acquisition module is used to collect ambient light intensity data and synchronously collect time period identifiers by using light sensors deployed in the indoor space at a preset sampling period. It receives scene selection instructions sent by users through the guest control interactive terminal and aligns the ambient light intensity data, the time period identifiers and the scene selection instructions according to the collection timestamp to obtain a time synchronization data group. The intelligent analysis module is used to read scenario selection instructions from the time synchronization data group and determine whether there is valid instruction content. If there is valid instruction content, it retrieves the device control reference value of the corresponding scenario mode from the scenario parameter table, performs multi-factor weighted operation on the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm to obtain the corrected control value. If there is no valid instruction content, it performs interval matching on the ambient light intensity data and the preset light threshold interval to obtain the interval identifier, and reads the device control benchmark value from the benchmark value mapping table as the corrected control value based on the interval identifier and the time period identifier. The device control module is used to encapsulate the corrected control value into a control command and send it to the device driver module. The device driver module drives the controlled device to adjust to the target state corresponding to the corrected control value. The actual state value of the controlled device is collected by the position sensor and compared with the deviation of the target state. If the deviation exceeds the preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, the ambient light intensity data and the scene mode identifier are written into the user habit record table.
[0014] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the aforementioned IoT device control method based on illumination and scene.
[0015] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the aforementioned light and scene-based Internet of Things device control method.
[0016] Fifthly, this application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned light and scene-based Internet of Things device control method.
[0017] As can be seen from the above technical solution, this application provides a method and apparatus for controlling IoT devices based on illumination and scene. It constructs a time synchronization data group by aligning illumination intensity data, time period identifiers, and scene selection command timestamps. Combined with the validity judgment of scene commands, it drives the calculation of dual-path adaptive correction control values. After completing closed-loop control through position sensor deviation comparison and secondary compensation adjustment, the actual state data is written into the user habit record table. This effectively solves the shortcomings of traditional technologies in multi-source sensing data time synchronization fusion, scene and environment dual-path adaptive control value calculation, device status closed-loop verification, and user habit data accumulation. It provides technical support for scene-aware adaptive control and personalized management optimization of indoor IoT devices. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the IoT device control method based on illumination and scene in an embodiment of this application. Figure 2 This is a structural diagram of the IoT device control device based on illumination and scene in the embodiments of this application. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] The acquisition, storage, use, and processing of data in this application comply with relevant laws and regulations.
[0022] In view of the problems existing in the prior art, this application provides an IoT device control method and apparatus based on illumination and scene. It constructs a time synchronization data group by aligning the illumination intensity data, time period identifier and scene selection command timestamp, and drives the calculation of dual-path adaptive correction control value by combining the validity judgment of scene command. After completing the closed-loop control through position sensor deviation comparison and secondary compensation adjustment, the actual state data is written into the user habit record table. This effectively solves the shortcomings of traditional technologies in multi-source sensing data time synchronization fusion, scene and environment dual-path adaptive control value calculation, device status closed-loop verification and user habit data accumulation, etc., and provides technical support for scene perception adaptive control and personalized management optimization of indoor IoT devices.
[0023] To effectively address the shortcomings of traditional technologies in areas such as time-synchronous fusion of multi-source sensing data, calculation of adaptive control values via dual-path scenarios and environments, closed-loop verification of device status, and accumulation of user habit data, and to provide technical support for scenario-aware adaptive control and personalized management optimization of indoor IoT devices, this application provides an embodiment of an IoT device control method based on illumination and scenario, see [link to embodiment]. Figure 1 The IoT device control method based on illumination and scene specifically includes the following: Step S101: Collect ambient light intensity data and time period identifiers at a preset sampling period using light sensors deployed in the indoor space. Receive scene selection instructions sent by users through the guest control interactive terminal. Align the ambient light intensity data, the time period identifiers, and the scene selection instructions according to the collection timestamps to obtain a time synchronization data group. This embodiment uses a light sensor deployed in an indoor space to collect ambient light intensity data. The light sensor is installed near a window in an unobstructed location, and performs photoelectric conversion on the incident light at a preset sampling period, outputting digitized ambient light intensity data via an analog-to-digital converter. The preset sampling period is configured according to the response requirements of changes in indoor lighting, ensuring real-time data transmission while avoiding the computational burden caused by excessively frequent sampling.
[0024] Simultaneously with the generation of the ambient light intensity data, this embodiment reads the current time from the system clock and performs a time period assignment determination. Based on a preset time period division rule, the continuous time axis is divided into several discrete time periods. The current time is compared with the start and end boundaries of each time period to determine its corresponding interval, and the corresponding time period identifier is output. The time period identifier is used to mark the time segment in which the current acquisition moment occurs, providing an index for the time period weighting calculation in the subsequent adjustment algorithm. The ambient light intensity data is bound to the time period identifier to form a light acquisition record. This light acquisition record serves as an intermediate product of this step and is used in subsequent time alignment processing.
[0025] After the illumination data is collected, this embodiment receives a scene selection command from the user via a customer control interactive terminal. The customer control interactive terminal includes a touch control panel, a mobile application, and a voice control device. Users can select a preset scene mode or manually input device control parameters through these interactive interfaces. When a user triggers a scene selection operation, the interactive acquisition unit captures the operation and extracts the scene mode field from the command, generating a scene selection command carrying a scene mode identifier. The scene selection command includes a receiving timestamp to record the precise time the command arrived.
[0026] Accordingly, this embodiment performs alignment processing on the illumination acquisition records and the scene selection instructions according to the acquisition timestamps. Illumination timestamps are extracted from the illumination acquisition records, and instruction timestamps are extracted from the scene selection instructions. These two timestamps are then matched with the generated timestamps corresponding to the time period identifiers according to a preset time tolerance window. When the difference between each timestamp falls within the tolerance window range, it is determined to be related data within the same acquisition period, and a time alignment index is generated.
[0027] Based on the time alignment index, this embodiment associates and binds the ambient light intensity data, the time period identifier, and the scene selection instruction. The three types of data are assembled into data record tuples according to their alignment relationship and encapsulated with a unified timestamp to form a time-synchronized data group. This time-synchronized data group carries the illumination state, time period attributes, and user intent at the same moment in a structured form, ensuring the temporal consistency of the input data used in subsequent step S102 when performing mode determination and control value calculation. The time-synchronized data group is written into the data buffer as the output of this step, allowing step S102 to read the scene selection instruction and perform validity judgment and corrective control value calculation.
[0028] Step S102: Read the scenario selection instruction from the time synchronization data group and determine whether there is a valid instruction. If there is a valid instruction, retrieve the device control reference value of the corresponding scenario mode from the scenario parameter table. Perform a multi-factor weighted operation on the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm to obtain the corrected control value. If there is no valid instruction, perform interval matching on the ambient light intensity data and the preset light threshold interval to obtain the interval identifier. Based on the interval identifier and the time period identifier, read the device control reference value from the reference value mapping table as the corrected control value. This embodiment reads the scenario selection instruction from the time synchronization data group output in step S101 and performs a validity check on it. The validity check includes two steps: non-empty verification and format compliance judgment. First, it checks whether the content field of the scenario selection instruction is empty, and then verifies whether the instruction format conforms to the preset message structure specification. After the above verification, an instruction validity flag is generated. The instruction validity flag has the value of valid or invalid, which is used to control the branching direction of subsequent processing flows.
[0029] If the instruction is marked as valid, this embodiment extracts the scenario mode field from the scenario selection instruction and retrieves the corresponding record from the scenario parameter table based on this field. The scenario parameter table uses the scenario mode identifier as the index key and stores the device control reference value and scenario-adapted illumination value corresponding to each scenario mode. After performing table entry matching based on the extracted scenario mode field, the device control reference value and scenario-adapted illumination value corresponding to that scenario mode are read. The device control reference value represents the desired state of the controlled device under that scenario mode, and the scenario-adapted illumination value represents the ideal illumination intensity level adapted to that scenario mode.
[0030] After the device control reference value and the scene-adapted illumination value are obtained, this embodiment reads the ambient light intensity data and time period identifier from the time synchronization data group to perform a multi-factor weighted calculation. The ambient light intensity data and the scene-adapted illumination value are then compared to obtain the illumination deviation, which reflects the degree of deviation between the current actual illumination and the ideal scene illumination. Based on the time period identifier, the corresponding time period weighting coefficient is read from the time period weight table. This time period weighting coefficient is preset based on the differences in light sensitivity across different time periods.
[0031] Accordingly, this embodiment calculates the weighted deviation by inputting the illumination deviation and the time-period weighting coefficient into the adjustment algorithm. Specifically, the corrected control value equals the sum of the device control reference value and the weighted deviation, where the weighted deviation is obtained by multiplying the illumination deviation by the time-period weighting coefficient and then by the adjustment sensitivity coefficient. The adjustment sensitivity coefficient is configured differently according to the scenario mode type to control the influence of the illumination deviation on the final control value. After the above calculation, a corrected control value is obtained, which integrates the combined effects of three factors: user scenario intent, real-time illumination status, and time-period characteristics.
[0032] If the instruction validity flag is invalid, this embodiment enters the adaptive lighting adjustment branch. Ambient light intensity data is read from the time-synchronized data group and compared numerically with the boundary values of each interval in the preset lighting threshold interval. The preset lighting threshold interval is divided into a low-light interval, a moderate-light interval, and a strong-light interval, with the boundary thresholds of each interval preset based on the indoor space orientation and seasonal characteristics. Based on the comparison results, the interval to which the ambient light intensity data belongs is determined, and the interval identifier is output.
[0033] Based on the interval identifier, this embodiment reads the device control reference value from the reference value mapping table in conjunction with the time period identifier. The interval identifier and the time period identifier are combined to form a joint index key, and the corresponding record in the reference value mapping table is retrieved based on this joint index key. The reference value mapping table establishes a correspondence between the device control reference values under the combined conditions of illumination intervals and time periods. The device control reference value read after retrieval is directly used as the corrected control value. The corrected control value is the output of this step, which is then encapsulated into a control command in subsequent step S103 and sent to the device driver module to perform controlled device state adjustment.
[0034] Step S103: The corrected control value is encapsulated into a control command and sent to the device driver module. The device driver module drives the controlled device to adjust to the target state corresponding to the corrected control value. The actual state value of the controlled device is collected by the position sensor and compared with the deviation of the target state. If the deviation exceeds the preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, the ambient light intensity data and the scene mode identifier are written into the user habit record table.
[0035] This embodiment reads the corrected control value output in step S102 and performs control command encapsulation according to a preset command message format. The device address identifier corresponding to the controlled device is read from the device configuration table. The corrected control value, the device address identifier, and the command type field are assembled to obtain a command data frame. The command data frame is serialized and encoded to convert it into a transmittable byte stream. A frame length identifier and a protocol version identifier are written to the header of the byte stream to form a complete control command.
[0036] After the control command is generated, this embodiment sends it to the device driver module via a communication interface. The device driver module receives the control command and performs decoding processing, extracting the corrected control value and device address identifier from the command data frame. Based on the device address identifier, it locates the driver interface of the controlled device in the device registry and converts the corrected control value into a drive signal. The pulse width and voltage amplitude of the drive signal are mapped and calculated based on the corrected control value to precisely control the operating amplitude of the actuator of the controlled device.
[0037] Accordingly, the device drive module outputs the drive signal to the actuator of the controlled device to drive state adjustment. The actuator of the controlled device performs mechanical movement according to the control parameters of the drive signal, adjusting the controlled device from the current state to the target state corresponding to the correction control value. The target state is represented by the numerical form of the correction control value, indicating the position or opening percentage that the controlled device should achieve, serving as a benchmark for subsequent deviation comparison.
[0038] During the state adjustment process of the controlled device, this embodiment collects actual state data through a position sensor installed on the controlled device. The position sensor converts the mechanical position of the controlled device into an electrical signal and outputs a digitized actual state value after analog-to-digital conversion. The difference between the actual state value and the target state is calculated to obtain a state deviation, which reflects the degree of deviation between the actual position reached by the controlled device and the desired position.
[0039] Based on the stated state deviation, this embodiment compares it with the boundary value of a preset allowable range to determine whether secondary adjustment is needed. If the absolute value of the state deviation exceeds the upper boundary of the preset allowable range, the deviation is determined to be excessive, and a compensation adjustment process is initiated. A compensation amount is calculated based on the value and direction of the state deviation, and this compensation amount is encapsulated according to a control command message format to form a compensation command. The compensation command is sent to the device driver module, which then drives the controlled device to perform secondary adjustment to eliminate residual deviation.
[0040] After the controlled device completes its state adjustment, this embodiment writes relevant data into a user habit record table to support adaptive updates of subsequent adjustment strategies. Ambient light intensity data and scene mode identifiers are read from the time synchronization data group. The actual state value, ambient light intensity data, and scene mode identifier are assembled into a habit data record according to a preset record format. The habit data record is appended with a current timestamp and written into the user habit record table. The historical data accumulated in the user habit record table can be read by the system in subsequent adaptive light adjustment branches and used to correct the device control baseline value, achieving personalized adjustment based on user operating preferences.
[0041] As described above, the IoT device control method based on illumination and scenario provided in this application can construct a time-synchronized data group by aligning illumination intensity data, time period identifiers, and the timestamps of scenario selection instructions. Combined with the validity judgment of scenario instructions, it drives the calculation of dual-path adaptive correction control values. After completing closed-loop control through position sensor deviation comparison and secondary compensation adjustment, the actual state data is written into the user habit record table. This effectively solves the shortcomings of traditional technologies in multi-source sensing data time synchronization fusion, scenario and environment dual-path adaptive control value calculation, device status closed-loop verification, and user habit data accumulation. It provides technical support for scenario-aware adaptive control and personalized management optimization of indoor IoT devices.
[0042] In one embodiment of the IoT device control method based on illumination and scene in this application, it may further include the following: Step S201: Ambient light intensity data is obtained by analog-to-digital conversion of ambient light using a light sensor deployed in an unobstructed location near a window in an indoor space according to a preset sampling period. The current time is read from the system clock and the interval assignment is determined according to a preset time period division rule to obtain a time period identifier. The ambient light intensity data is bound to the time period identifier to form a light acquisition record. Step S202: Receive the scene selection command input by the user through the interactive interface of the guest control terminal and extract the scene mode field in the command to obtain the scene mode identifier. Align the scene mode identifier with the ambient light intensity data and time segment identifier in the light acquisition record according to the acquisition timestamp to obtain the time synchronization data group.
[0043] This embodiment uses a light sensor deployed in an unobstructed location near a window in an indoor space to collect ambient light data. The light sensor's photosensitive element receives incident light and generates a current signal proportional to the light intensity. This signal is then conditioned by a built-in amplifier circuit and input to an analog-to-digital converter (ADC). The ADC quantizes and encodes the analog signal according to a preset sampling period, outputting digitized ambient light intensity data. The preset sampling period must be configured to balance the dynamic response requirements of light changes with the balanced utilization of system computing resources.
[0044] Simultaneously with the output of the ambient light intensity data, this embodiment reads the current time from the system clock to perform time period classification. The system clock provides real-time time information accurate to the second. This embodiment divides the entire day's timeline into several continuous but non-overlapping time period intervals according to a preset time period division rule. The current time is compared sequentially with the start and end boundaries of each time period interval to determine the specific interval into which the current time falls and outputs the corresponding time period identifier. For example, if the preset time period division rule defines nighttime and daytime as independent time periods, then if the current time falls within the nighttime range, a nighttime time period identifier is output; if it falls within the daytime range, a daytime time period identifier is output.
[0045] Accordingly, this embodiment binds the ambient light intensity data with the time period identifier. A collection timestamp is appended to the ambient light intensity data to mark its precise generation time, and a mapping is established between the time period identifier and the ambient light intensity data at the same time. After binding, a light collection record is formed. This light collection record carries both light value information and time period attribute information in a structured data format, serving as an intermediate product of this step for subsequent step S202 to perform time alignment processing.
[0046] After the illumination data is collected, this embodiment receives the scene selection command input by the user through the interactive interface of the guest control terminal. The guest control terminal supports multiple interaction methods such as touch operation, voice input, and mobile applications, allowing users to select preset scene modes according to their needs. When the user completes the scene selection operation, the interactive interface captures the operation event and generates a scene selection command, which includes a scene mode field corresponding to the user's selected scene mode. This embodiment extracts the scene mode field from the scene selection command and parses it to obtain a scene mode identifier, which is used to uniquely identify the scene mode type selected by the user.
[0047] Based on the scenario mode identifier and the illumination acquisition record, this embodiment performs data alignment processing according to the acquisition timestamp. The acquisition timestamp corresponding to the ambient light intensity data is extracted from the illumination acquisition record, and the reception timestamp is extracted from the scenario selection instruction. The two are matched and determined according to a preset time tolerance window. When the difference between the two timestamps falls within the tolerance window range, they are determined to be related data within the same acquisition period. The scenario mode identifier is associated and bound with the ambient light intensity data and time segment identifier in the illumination acquisition record, and encapsulated with a unified timestamp to form a time-synchronized data group. This time-synchronized data group serves as the output of this step, for subsequent step S301 to read the scenario selection instruction and perform validity judgment and correction control value calculation.
[0048] In one embodiment of the IoT device control method based on illumination and scene in this application, it may further include the following: Step S301: Extract the corresponding acquisition timestamp from the ambient light intensity data output by the light sensor as the light timestamp, extract the corresponding generation timestamp from the time period identifier generated by the system clock as the time period timestamp, extract the corresponding reception timestamp from the scene selection instruction received by the customer control interaction terminal as the instruction timestamp, and perform matching of the light timestamp, the time period timestamp and the instruction timestamp according to the preset time tolerance window to obtain the time alignment index. Step S302: Based on the time alignment index, associate and bind the ambient light intensity data, the time period identifier, and the scene selection instruction to form a data record tuple, and encapsulate the data record tuple with a unified timestamp to obtain a time synchronization data group.
[0049] This embodiment extracts the corresponding acquisition timestamp from the ambient light intensity data output by the light sensor. After each analog-to-digital conversion, the light sensor appends the system time of the conversion to the output data to form a timestamp. This embodiment reads this timestamp and uses it as the light timestamp. The light timestamp accurately records the generation time of the ambient light intensity data, providing a reference for subsequent time alignment calculations.
[0050] After the illumination timestamp is extracted, this embodiment extracts the corresponding generation timestamp from the time period identifier generated by the system clock. The time period identifier synchronously records the current time of the system clock as a time marker during generation. This embodiment reads this time marker and uses it as the time period timestamp. The time period timestamp marks the precise moment when the time period attribution determination is executed, and is used for synchronization verification with timestamps from other data sources.
[0051] Accordingly, this embodiment extracts the corresponding reception timestamp from the scenario selection command received from the customer control interactive terminal. When the interactive interface of the customer control interactive terminal captures the scenario selection command input by the user, the system adds a timestamp of the reception time to the command. This embodiment reads the timestamp and uses it as the command timestamp, which records the precise time when the scenario selection command arrived at the system. If the user does not perform a scenario selection operation within the current collection period, the command timestamp is set to null to indicate that there is no valid command input.
[0052] After the illumination timestamp, the time period timestamp, and the instruction timestamp are extracted, this embodiment performs a matching operation on the three according to a preset time tolerance window. The preset time tolerance window defines the maximum allowable time deviation range, used to determine whether the timestamps from different data sources belong to the same acquisition period. Using the illumination timestamp as the reference timestamp, the time deviation of the time period timestamp and the instruction timestamp relative to the reference timestamp is calculated. If each time deviation falls within the boundary range of the preset time tolerance window, it is determined that the three types of data have temporal consistency and a time alignment index is generated. The time alignment index uses the reference timestamp as the key value to record the data association relationship of this successful match, serving as an intermediate product of this step for subsequent step S302 to call when performing association binding.
[0053] Based on the time alignment index output in step S301, this embodiment associates and binds the ambient light intensity data, the time period identifier, and the scene selection instruction. According to the data association relationships recorded in the time alignment index, corresponding data items are read from each data source and a mapping connection is established. The ambient light intensity data, the time period identifier, and the scene selection instruction are assembled into a data record tuple, which carries multi-source heterogeneous data within the same acquisition period in a structured form.
[0054] After the data record tuple is formed, this embodiment encapsulates it using a unified timestamp. The base timestamp in the time alignment index is selected as the unified timestamp, and this timestamp is written into the time identifier field of the data record tuple. After encapsulation, a time-synchronized data group is formed, ensuring strict consistency of all data items within it across the time dimension. This time-synchronized data group is written as the output of this step into the data buffer, for subsequent step S401 to read the scenario selection instruction and perform validity judgment and correction control value calculation.
[0055] In one embodiment of the IoT device control method based on illumination and scene in this application, it may further include the following: Step S401: Read the scenario selection instruction from the time synchronization data group and perform non-empty verification and format compliance judgment on the instruction content to obtain the instruction validity mark. If the instruction validity mark is valid, extract the scenario mode field in the scenario selection instruction and retrieve the corresponding record from the scenario parameter table according to the scenario mode field to obtain the device control reference value and scenario adaptation illumination value. Step S402: Read ambient light intensity data and time period identifier from the time synchronization data group; perform a difference operation on the ambient light intensity data and the scene-adapted light value to obtain the light deviation; read the corresponding time period weighting coefficient from the time period weight table according to the time period identifier; perform a product operation on the light deviation and the time period weighting coefficient to obtain the weighted deviation; and perform a superposition operation on the device control reference value and the weighted deviation to obtain the corrected control value.
[0056] In this embodiment, the scenario selection instruction is read from the time synchronization data group output in step S302 above to perform a validity determination. First, a non-empty check is performed on the content field of the scenario selection instruction to check whether there is valid data to fill in the instruction content. If the content field is empty or only contains placeholders, it is determined to be an invalid instruction. If the content field contains valid data, the format compliance determination is then performed, comparing the message structure of the instruction with the preset instruction format template field by field to verify whether each necessary field is complete and whether the data type meets the specification requirements.
[0057] After both the non-empty verification and format compliance determination are completed, this embodiment generates an instruction validity flag based on the determination results. If both the non-empty verification and the format compliance determination pass, the instruction validity flag is set to valid. If either verification step fails, the instruction validity flag is set to invalid. The instruction validity flag serves as the basis for branch control in subsequent processing flows, determining whether the system enters the scene mode adjustment branch or the illumination adaptive adjustment branch.
[0058] If the instruction validity flag is valid, this embodiment extracts the scenario mode field from the scenario selection instruction. The scenario mode field is located at a specified offset position in the instruction message. This embodiment reads the data content at this position according to preset field parsing rules and performs decoding processing. After decoding, a scenario mode identifier is obtained, which uniquely identifies the scenario mode type selected by the user in encoded form.
[0059] Accordingly, this embodiment retrieves the corresponding record from the scenario parameter table based on the scenario mode identifier. The scenario parameter table uses the scenario mode identifier as the primary key to establish an index structure, and each record stores the device control reference value and scenario-adapted illumination value corresponding to that scenario mode. The scenario mode identifier is used as the search key to perform a table query, and after locating the matching record, the device control reference value and scenario-adapted illumination value are read from it. The device control reference value represents the expected state benchmark of the controlled device under that scenario mode, and the scenario-adapted illumination value represents the ideal ambient light level adapted to that scenario mode. Both serve as intermediate products of this step for subsequent weighted calculations in step S402.
[0060] After outputting the device control reference value and scene-adapted illumination value in step S401, this embodiment reads the ambient light intensity data and time period identifier from the time synchronization data group. The ambient light intensity data reflects the actual illumination level of the current indoor space, and the time period identifier marks the time segment in which the current acquisition time is located. A difference operation is performed between the ambient light intensity data and the scene-adapted illumination value, subtracting the scene-adapted illumination value from the ambient light intensity data to obtain the illumination deviation. The positive or negative sign of the illumination deviation indicates the direction of deviation of the current illumination from the ideal scene illumination, and its absolute value indicates the degree of deviation.
[0061] Based on the time period identifier, this embodiment reads the corresponding time period weighting coefficient from the time period weighting table. The time period weighting table establishes a mapping relationship between time period identifiers and time period weighting coefficients, configuring differentiated weighting coefficients for different time periods based on their differences in light sensitivity. After performing a table entry retrieval based on the time period identifier, the corresponding time period weighting coefficient is read. This time period weighting coefficient is used to adjust the influence weight of the light deviation on the final control value.
[0062] After obtaining both the illumination deviation and the time-period weighting coefficient, this embodiment performs a weighted deviation calculation and a correction control value superposition operation. The illumination deviation and the time-period weighting coefficient are multiplied to obtain the weighted deviation, which combines the combined effects of illumination deviation degree and time-period sensitivity. The device control reference value and the weighted deviation are superimposed to obtain the correction control value, which is a dynamic correction of illumination and time-period factors superimposed on the scenario mode baseline. The correction control value serves as the output of this step, which is then encapsulated into a control command in subsequent step S501 and sent to the device driver module to perform controlled device state adjustment.
[0063] In one embodiment of the IoT device control method based on illumination and scene in this application, it may further include the following: Step S501: If the instruction validity mark is invalid, read the ambient light intensity data from the time synchronization data group, and perform a numerical comparison between the ambient light intensity data and the boundary values of each interval in the preset light threshold interval to determine the interval to which it belongs and obtain the interval identifier. Step S502: Read the time period identifier from the time synchronization data group, combine the interval identifier and the time period identifier to form a joint index key, retrieve the corresponding record from the reference value mapping table according to the joint index key to obtain the device control reference value, and use the device control reference value as the correction control value.
[0064] In this embodiment, the system enters the adaptive lighting adjustment branch when the validity flag of the command generated in step S401 is invalid. An invalid command validity flag indicates that the user has not sent a valid scene selection command within the current acquisition period, and the system needs to autonomously decide the control parameters of the controlled device based on the ambient lighting conditions. In this embodiment, ambient light intensity data is read from the time-synchronized data group as the core input for adaptive adjustment; this ambient light intensity data carries information about the actual lighting level of the current indoor space.
[0065] After the ambient light intensity data is read, this embodiment compares it with the boundary values of each interval in the preset light threshold interval. The preset light threshold interval divides the continuous light intensity value range into several discrete intervals, each interval being defined as a weak light interval, a moderate light interval, and a strong light interval according to the light intensity level. Each interval is defined by its lower boundary value and upper boundary value. In this embodiment, the ambient light intensity data is compared with the boundary values of each interval in turn.
[0066] Accordingly, this embodiment determines the interval to which the ambient light intensity data belongs based on the comparison results. When the ambient light intensity data is greater than or equal to the lower boundary value of an interval and less than the upper boundary value of that interval, it is determined that the data falls within that interval. After the interval assignment determination, an interval identifier is output, which uniquely identifies the light level interval to which the current light intensity belongs in a coded form. The interval identifier serves as an intermediate product of this step and is used in subsequent step S502 when performing a joint index retrieval.
[0067] After outputting the interval identifier in step S501, this embodiment reads the time period identifier from the time synchronization data group. The time period identifier marks the time segment in which the current acquisition time is located, and together with the interval identifier, constitutes a two-dimensional condition for benchmark value retrieval. The interval identifier and the time period identifier are concatenated and combined according to a preset field order to form a composite index key. The composite index key carries both the illumination interval attribute and the time period attribute in a composite encoding form.
[0068] Based on the composite index key, this embodiment retrieves the corresponding record from the baseline value mapping table. The baseline value mapping table uses the composite index key as the primary key to establish an index structure, and each record stores the device control baseline value under a specific combination of illumination interval and time period. The composite index key is used as the search key to perform a table query, and after locating the matching record, the device control baseline value is read from it. The device control baseline value represents the default expected state of the controlled device under the current illumination interval and current time period.
[0069] After the device control reference value is read, this embodiment outputs it as a corrected control value. Since the illumination adaptive adjustment branch does not need to perform scene mode-related weighted correction calculations, the device control reference value is directly used as the final corrected control value. The corrected control value, as the output of this step, is used by the subsequent step S601 to encapsulate it into a control command and send it to the device driver module to perform controlled device state adjustment.
[0070] In one embodiment of the IoT device control method based on illumination and scene in this application, it may further include the following: Step S601: Read the correction control value and assemble the correction control value with the device address identifier and instruction type field according to the preset instruction message format to obtain an instruction data frame. Perform serialization encoding on the instruction data frame to form a control instruction and send it to the device driver module through the communication interface. Step S602: The device driver module receives the control command and performs decoding to obtain the corrected control value and device address identifier. Based on the device address identifier, it locates the controlled device and converts the corrected control value into a drive signal. The drive signal drives the actuator of the controlled device to operate, so that the controlled device is adjusted to the target state corresponding to the corrected control value.
[0071] This embodiment reads the corrected control value output in step S402 or step S502 to execute control instruction encapsulation. The corrected control value, depending on the branching path of the processing flow, originates from the weighted calculation result of the scene mode adjustment branch or the baseline value retrieval result of the illumination adaptive adjustment branch. The device address identifier corresponding to the currently controlled device is read from the device configuration table; this device address identifier uniquely identifies the communication address of the controlled device in the system.
[0072] After the modified control value and the device address identifier are obtained, this embodiment performs field assembly according to a preset instruction message format. The preset instruction message format defines the frame structure of the control instruction and the order of its fields, including a frame header identifier, a device address field, an instruction type field, a control parameter field, and a checksum field. The device address identifier is written into the device address field, the type code representing the state adjustment operation is written into the instruction type field, and the modified control value is written into the control parameter field. After field assembly, an instruction data frame is formed, which carries complete control information in a structured format.
[0073] Accordingly, this embodiment performs serialization encoding on the instruction data frame to convert it into a transmittable data format. The content of each field in the instruction data frame is sequentially converted into a byte sequence according to the field order, and a frame length identifier is written at the beginning of the byte sequence to indicate the total number of bytes in the data frame. A verification operation is performed on the control parameter field and the device address field, and the verification result is written into the checksum field for data integrity verification at the receiving end. After serialization encoding, a control instruction is formed. In this embodiment, the control instruction is sent to the device driver module through a communication interface. The communication interface uses either wired or wireless transmission methods depending on the system configuration to ensure that the control instruction reliably reaches the device driver module.
[0074] After the control command is sent, the device driver module receives the control command through its communication port. The device driver module performs deserialization decoding on the received byte sequence and parses the content of each field according to the preset command message format. It extracts the device address identifier from the device address field, extracts the correction control value from the control parameter field, and reads the checksum field and compares it with the locally calculated checksum result to verify data integrity.
[0075] Based on the device address identifier, the device driver module locates the driver interface of the controlled device in the device registry. The device registry establishes a mapping relationship between device address identifiers and driver interfaces, and retrieves the corresponding driver interface handle after performing an entry search based on the device address identifier. The device driver module inputs the corrected control value into the drive signal conversion unit, and maps the corrected control value into drive signal parameters according to the control characteristics of the controlled device's actuator. The drive signal parameters include pulse width, voltage amplitude, and duration, used to precisely control the operating amplitude and direction of the actuator.
[0076] After the drive signal is generated, the device drive module outputs the drive signal to the actuator of the controlled device through the drive interface. The actuator initiates mechanical movement according to the control parameters of the drive signal, causing the controlled device to adjust from the current state to the target state. The target state is represented by the numerical form of the correction control value, indicating the position percentage or opening parameter that the controlled device should achieve. After the controlled device completes the state adjustment under the drive of the actuator, it reaches the target state, which serves as the benchmark for deviation comparison in the subsequent step S701.
[0077] In one embodiment of the IoT device control method based on illumination and scene in this application, it may further include the following: Step S701: The current position data of the controlled device is collected by the position sensor installed on the controlled device and converted into actual state value. The difference between the actual state value and the target state is calculated to obtain the state deviation. The state deviation is compared with the boundary value of the preset allowable range to obtain the deviation judgment result. If the deviation judgment result is out of limit, the compensation amount is calculated based on the state deviation and encapsulated to form a compensation instruction. The compensation instruction is sent to the device driver module to drive the controlled device to perform secondary adjustment. Step S702: Read ambient light intensity data and scene mode identifier from the time synchronization data group, assemble the actual state value, ambient light intensity data and scene mode identifier into a habit data record according to the preset record format, and write the habit data record into the user habit record table.
[0078] This embodiment acquires the current position data of the controlled device through a position sensor installed on the controlled device. The position sensor is deployed along the motion path of the actuator of the controlled device, monitoring the mechanical position of the actuator in real time and outputting corresponding electrical signals. These electrical signals are processed by a signal conditioning circuit and then input to an analog-to-digital converter, where they are converted into digitized current position data. This embodiment performs dimensional mapping processing on the current position data, converting it into an actual state value with the same dimensions as the correction control value. This actual state value represents the current opening degree or position state of the controlled device as a percentage.
[0079] After the actual state value is obtained, this embodiment performs a difference calculation with it and the target state reached by the controlled device in step S602. The state deviation is obtained by subtracting the target state from the actual state value. The sign of the state deviation indicates the direction of deviation of the actual position relative to the target position, and its absolute value indicates the degree of deviation. The state deviation reflects the positioning accuracy of the controlled device after state adjustment and is used to determine whether compensation adjustment is needed.
[0080] Accordingly, this embodiment performs a numerical comparison between the state deviation and the boundary value of a preset allowable range. The preset allowable range defines the maximum acceptable positional deviation interval of the system, and is jointly defined by the lower boundary value and the upper boundary value. The absolute value of the state deviation is compared with the upper boundary value of the preset allowable range. If the absolute value is less than or equal to the upper boundary value, the deviation is determined to be within the allowable range; if the absolute value is greater than the upper boundary value, the deviation is determined to be beyond the limit. After comparison, a deviation determination result is generated, and the deviation determination result is taken as either normal or beyond the limit.
[0081] If the deviation determination result is out of limit, this embodiment calculates a compensation amount based on the state deviation amount to eliminate the residual deviation. The value of the compensation amount is equal to the absolute value of the state deviation amount, and the compensation direction is opposite to the sign of the state deviation amount. The compensation amount is assembled with the device address identifier and compensation instruction type field according to a preset instruction message format and serialized to form a compensation instruction. In this embodiment, the compensation instruction is sent to the device driver module through the communication interface. The device driver module receives and decodes the instruction and drives the controlled device to perform secondary adjustment so that the actual state of the controlled device approaches the target state.
[0082] After the controlled device completes its state adjustment, this embodiment reads ambient light intensity data and scene mode identifier from the time synchronization data group. The ambient light intensity data records the indoor light level during this adjustment cycle, and the scene mode identifier records the scene mode type selected by the user. If the user does not send a valid scene selection command, the scene mode identifier is set to null to indicate that the current adjustment adopts the light adaptive mode.
[0083] Based on the actual state value, the ambient light intensity data, and the scene mode identifier, this embodiment performs field assembly according to a preset record format. The preset record format defines the field structure and arrangement order of the habit data record, including a timestamp field, a light intensity field, a scene mode field, and a device status field. The current system time is written to the timestamp field, the ambient light intensity data is written to the light intensity field, the scene mode identifier is written to the scene mode field, and the actual state value is written to the device status field. After field assembly, a habit data record is formed, and in this embodiment, the habit data record is written to a user habit record table. The historical data accumulated in the user habit record table can be read by the system in subsequent light adaptive adjustment branches to correct the device control baseline value to achieve personalized adjustment based on user operating preferences.
[0084] To effectively address the shortcomings of traditional technologies in areas such as time-synchronous fusion of multi-source sensing data, calculation of adaptive control values via dual-path scenarios and environments, closed-loop verification of device status, and accumulation of user habit data, and to provide technical support for scenario-aware adaptive control and personalized management optimization of indoor IoT devices, this application provides an embodiment of an IoT device control device based on illumination and scenario to implement all or part of the aforementioned IoT device control method based on illumination and scenario. See [link to embodiment]. Figure 2 The IoT device control device based on illumination and scene specifically includes the following components: The environmental acquisition module 10 is used to collect ambient light intensity data and synchronously collect time period identifiers by using a light sensor deployed in the indoor space according to a preset sampling period. It receives scene selection instructions sent by users through a guest control interactive terminal and aligns the ambient light intensity data, the time period identifiers and the scene selection instructions according to the collection timestamp to obtain a time synchronization data group. The intelligent analysis module 20 is used to read the scenario selection instruction from the time synchronization data group and determine whether there is a valid instruction. If there is a valid instruction, it retrieves the device control reference value of the corresponding scenario mode from the scenario parameter table, performs a multi-factor weighted operation on the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm to obtain a corrected control value. If there is no valid instruction, it performs interval matching on the ambient light intensity data and the preset light threshold interval to obtain the interval identifier, and reads the device control reference value from the reference value mapping table as the corrected control value based on the interval identifier and the time period identifier. The device control module 30 is used to encapsulate the correction control value into a control command and send it to the device driver module. The device driver module drives the controlled device to adjust to the target state corresponding to the correction control value. The actual state value of the controlled device is collected by the position sensor and compared with the deviation of the target state. If the deviation exceeds the preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, the ambient light intensity data and the scene mode identifier are written into the user habit record table.
[0085] As described above, the IoT device control device based on illumination and scenario provided in this application can construct a time-synchronized data group by aligning illumination intensity data, time period identifiers, and the timestamps of scenario selection instructions. Combined with the validity judgment of scenario instructions, it drives the calculation of dual-path adaptive correction control values. After completing closed-loop control through position sensor deviation comparison and secondary compensation adjustment, it writes the actual state data into the user habit record table. This effectively solves the shortcomings of traditional technologies in multi-source sensing data time synchronization fusion, scenario and environment dual-path adaptive control value calculation, device status closed-loop verification, and user habit data accumulation. It provides technical support for scenario-aware adaptive control and personalized management optimization of indoor IoT devices.
[0086] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the light and scene-based Internet of Things device control method.
[0087] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described IoT device control method based on illumination and scene.
[0088] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described IoT device control method based on illumination and scene.
[0089] In this embodiment of the invention, a time-synchronized data group is constructed by aligning light intensity data, time period identifiers, and the timestamps of scene selection instructions. Combined with the validity judgment of scene instructions, the dual-path adaptive correction control value is calculated. After completing closed-loop control through position sensor deviation comparison and secondary compensation adjustment, the actual state data is written into the user habit record table. This effectively solves the shortcomings of traditional technologies in terms of multi-source sensing data time synchronization fusion, scene and environment dual-path adaptive control value calculation, device status closed-loop verification, and user habit data accumulation. It provides technical support for scene-aware adaptive control and personalized management optimization of indoor IoT devices.
[0090] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0091] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0092] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0093] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0094] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for controlling IoT devices based on illumination and scene, characterized in that, The method includes: Ambient light intensity data is collected by light sensors deployed in the indoor space at a preset sampling period, and time period identifiers are collected simultaneously. The scene selection command sent by the user is received through the guest control interactive terminal. The ambient light intensity data, the time period identifiers and the scene selection command are aligned with the collection timestamp to obtain a time synchronization data group. The system reads the scenario selection instruction from the time synchronization data group and determines whether there is a valid instruction. If there is a valid instruction, it retrieves the device control reference value for the corresponding scenario mode from the scenario parameter table. The system performs a multi-factor weighted operation on the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm to obtain a corrected control value. If there is no valid instruction, the system performs interval matching on the ambient light intensity data and the preset light threshold interval to obtain the interval identifier. Based on the interval identifier and the time period identifier, the system reads the device control reference value from the reference value mapping table as the corrected control value. The corrected control value is encapsulated into a control command and sent to the device driver module. The device driver module drives the controlled device to adjust to the target state corresponding to the corrected control value. The actual state value of the controlled device is collected by the position sensor and compared with the deviation of the target state. If the deviation exceeds the preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, the ambient light intensity data and the scene mode identifier are written into the user habit record table.
2. The IoT device control method based on illumination and scene according to claim 1, characterized in that, The process involves collecting ambient light intensity data and simultaneously collecting time period identifiers using light sensors deployed in the indoor space at preset sampling periods, and receiving scene selection commands from users via a guest control interactive terminal, including: Ambient light intensity data is obtained by analog-to-digital conversion of ambient light using a light sensor deployed in an unobstructed location near a window in an indoor space, according to a preset sampling period. The current time is read from the system clock and the interval assignment is determined according to a preset time period division rule to obtain a time period identifier. The ambient light intensity data is then bound to the time period identifier to form a light acquisition record. The system receives the user's scene selection command through the interactive interface of the guest control terminal and extracts the scene mode field from the command to obtain the scene mode identifier. The scene mode identifier is then aligned with the ambient light intensity data and time segment identifier in the light acquisition record according to the acquisition timestamp to obtain a time synchronization data group.
3. The IoT device control method based on illumination and scene according to claim 1, characterized in that, The step of aligning the ambient light intensity data, the time period identifier, and the scene selection instruction according to the collection timestamp to obtain a time synchronization data group includes: The corresponding acquisition timestamp is extracted from the ambient light intensity data output by the light sensor as the light timestamp, the corresponding generation timestamp is extracted from the time period identifier generated by the system clock as the time period timestamp, and the corresponding reception timestamp is extracted from the scene selection instruction received by the customer control interaction terminal as the instruction timestamp. The light timestamp, the time period timestamp and the instruction timestamp are matched according to the preset time tolerance window to obtain the time alignment index. The ambient light intensity data, the time period identifier, and the scene selection instruction are associated and bound together according to the time alignment index to form a data record tuple. The data record tuple is then encapsulated with a unified timestamp to obtain a time synchronization data group.
4. The IoT device control method based on illumination and scene according to claim 1, characterized in that, The process of reading scenario selection instructions from the time synchronization data group and determining whether there are valid instructions is as follows: If valid instructions exist, the device control reference value for the corresponding scenario mode is retrieved from the scenario parameter table; the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm are used to perform a multi-factor weighted calculation to obtain a corrected control value, including: Read the scenario selection instruction from the time synchronization data group and perform non-empty verification and format compliance judgment on the instruction content to obtain the instruction validity mark. If the instruction validity mark is valid, extract the scenario mode field from the scenario selection instruction and retrieve the corresponding record from the scenario parameter table based on the scenario mode field to obtain the device control reference value and scenario adaptation illumination value. Ambient light intensity data and time period identifiers are read from the time synchronization data group. The ambient light intensity data and the scene-adapted light value are compared to obtain the light deviation. The corresponding time period weighting coefficient is read from the time period weight table according to the time period identifier. The light deviation and the time period weighting coefficient are multiplied to obtain the weighted deviation. The device control reference value and the weighted deviation are superimposed to obtain the corrected control value.
5. The IoT device control method based on illumination and scene according to claim 1, characterized in that, If no valid instruction content exists, the ambient light intensity data is matched with a preset light threshold interval to obtain the interval identifier. Based on the interval identifier and the time period identifier, the device control reference value is read from the reference value mapping table as the correction control value, including: If the instruction validity is marked as invalid, the ambient light intensity data is read from the time synchronization data group, and the ambient light intensity data is compared with the boundary values of each interval in the preset light threshold interval to determine the interval to which it belongs and obtain the interval identifier. Read the time period identifier from the time synchronization data group, combine the interval identifier and the time period identifier to form a joint index key, retrieve the corresponding record from the reference value mapping table according to the joint index key to obtain the device control reference value, and use the device control reference value as the correction control value.
6. The IoT device control method based on illumination and scene according to claim 1, characterized in that, The step of encapsulating the corrected control value into a control command and sending it to the device driver module, so that the device driver module drives the controlled device to adjust to the target state corresponding to the corrected control value, includes: Read the correction control value and assemble the correction control value with the device address identifier and instruction type field according to the preset instruction message format to obtain an instruction data frame. Perform serialization encoding on the instruction data frame to form a control instruction and send it to the device driver module through the communication interface. The device driver module receives the control command and decodes it to obtain the corrected control value and the device address identifier. Based on the device address identifier, it locates the controlled device and converts the corrected control value into a drive signal. The drive signal drives the actuator of the controlled device to operate, so that the controlled device is adjusted to the target state corresponding to the corrected control value.
7. The IoT device control method based on illumination and scene according to claim 1, characterized in that, The process involves collecting the actual state value of the controlled device via a position sensor and comparing it with the target state. If the deviation exceeds a preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, ambient light intensity data, and scene mode identifier are then written into a user habit record table, including: The current position data of the controlled device is collected by the position sensor installed on the controlled device and converted into actual state value. The difference between the actual state value and the target state is calculated to obtain the state deviation. The state deviation is compared with the boundary value of the preset allowable range to obtain the deviation judgment result. If the deviation judgment result is out of limit, the compensation amount is calculated based on the state deviation and encapsulated to form a compensation instruction. The compensation instruction is sent to the device driver module to drive the controlled device to perform secondary adjustment. Read ambient light intensity data and scene mode identifier from the time synchronization data group, assemble the actual state value, ambient light intensity data and scene mode identifier into a habit data record according to the preset record format, and write the habit data record into the user habit record table.
8. A control device for Internet of Things (IoT) devices based on illumination and scene, characterized in that, The device includes: The environmental acquisition module is used to collect ambient light intensity data and synchronously collect time period identifiers by using light sensors deployed in the indoor space at a preset sampling period. It receives scene selection instructions sent by users through the guest control interactive terminal and aligns the ambient light intensity data, the time period identifiers and the scene selection instructions according to the collection timestamp to obtain a time synchronization data group. The intelligent analysis module is used to read scenario selection instructions from the time synchronization data group and determine whether there is valid instruction content. If there is valid instruction content, it retrieves the device control reference value of the corresponding scenario mode from the scenario parameter table, performs multi-factor weighted operation on the device control reference value, the ambient light intensity data, and the time period identifier input adjustment algorithm to obtain the corrected control value. If there is no valid instruction content, it performs interval matching on the ambient light intensity data and the preset light threshold interval to obtain the interval identifier, and reads the device control benchmark value from the benchmark value mapping table as the corrected control value based on the interval identifier and the time period identifier. The device control module is used to encapsulate the corrected control value into a control command and send it to the device driver module. The device driver module drives the controlled device to adjust to the target state corresponding to the corrected control value. The actual state value of the controlled device is collected by the position sensor and compared with the deviation of the target state. If the deviation exceeds the preset allowable range, a compensation command is generated to drive the controlled device to perform a secondary adjustment. The actual state value, the ambient light intensity data and the scene mode identifier are written into the user habit record table.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the IoT device control method based on illumination and scene as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the IoT device control method based on illumination and scene as described in any one of claims 1 to 7.