Skip to content

Conversation

@GavinIves
Copy link

feat: Added control command sending method for lamps

Added three ways to turn on the lamp. A Select was added under the configuration page of each lamp

1.Send One by One. The original method is to turn on the lamp, color temperature, brightness, and mode one by one (default value)
2.Send Turn On First. The command to turn on the lamp will be executed first each time, and then the color temperature, brightness, and mode will be sent in batches
3.Send together. All commands are sent together

Users can choose the most suitable method to send the command to turn on the lamp according to the firmware function of their lamps

Most lamps support Send together, which will make the turning on of the lamp the fastest and the display effect of the lamp on the lamp the best. For details, please refer to the problem mentioned in #983

A small number of lamps only support Send Turn On First. The command to turn on the lamp must be executed first before the subsequent color temperature and brightness adjustment can be accepted

Some old lamps can only be sent one by one by default

This update does not affect the previous configuration and will not affect previous users. The default logic has not changed

All test scripts have passed and all functions have been tested on my own physical machine

Since I have been using pycharm, I am not very good at using vscode. I didn't modify much code, but after formatting, a lot of the original code changed format, resulting in a lot of modifications. I did configure the googlestyle formatting tool, but the result was not satisfactory. Can you help me see where the problem is? However, the code quality is definitely no problem

image

#983

@SusanPhevos
Copy link
Contributor

The absence of this feature does not affect the normal use of the light. Adding this feature introduces too much complexity.
I think we can leave this PR as a patch for those who want this feature and do not merge it into the main branch.

@GavinIves
Copy link
Author

I think it greatly affects the lighting effect and the entire smart home experience. An abrupt flash or color change completely affects the meaning of smart home. This time the code has limited increase in complexity. In fact, it just adds a batch sending function, and the default logic is still the previous one. And I believe that the batch sending function will be added in the future due to other problems. And I can always maintain this function. Please consider merging it.

@GavinIves
Copy link
Author

GavinIves commented Jun 23, 2025

我在想要不要把def set_property_async 直接封装成

async def set_property_async(self,prop: Optional[MIoTSpecProperty],value: Any,update_value: bool = True,write_ha_state: bool = True) -> bool:
    set_properties_list=[{"prop":prop,"value":value}]
    return self.set_properties_async(set_properties_list,update_value,write_ha_state)

这样就不会有冗余了 set_properties_async的后续逻辑都是按照set_property_async的后续去写的 所有判断和检查也都做了 完全可以合并没有风险

@GavinIves
Copy link
Author

GavinIves commented Jul 9, 2025

@SusanPhevos
我将set_property_async移除了 全部都用set_properties_async来代替了 这样就能保证了代码简洁
这些功能我已经测试了一个月了 没有问题 现在有更好的批量发送命令的也有单个发送的 也保持了代码易维护
你看可以合并了吗 你不认可灯的部分 我可以把灯的部分取消掉 只合并批量发送命令的部分

@GavinIves GavinIves force-pushed the add-command-sending-mode-for-lights branch from e5a5bb5 to b95a2c1 Compare December 28, 2025 14:36
@GavinIves GavinIves force-pushed the add-command-sending-mode-for-lights branch 2 times, most recently from a43c93a to fc1129b Compare January 16, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants