tobias-richter / ansible-tasmota

Ansible Role for managing tasmota devices with tasmota commands
Apache License 2.0
31 stars 13 forks source link

Support for Template/DimmerRange/TuyaMCU #6

Closed diijkstra closed 3 years ago

diijkstra commented 3 years ago

This is a hacky way to add support for following commands:

Unfortunately support for TuyaMCU is hard to within current implementation. A response contains list of dictionaries with fnId, and dpId keys (ie.: {"TuyaMCU":[{"fnId":11,"dpId":20},{"fnId":26,"dpId":21},{"fnId":21,"dpId":22},{"fnId":23,"dpId":23},{"fnId":24,"dpId":24}]}). I've decided to require from user providing multiple TuyaMCU commands one per one fnId. To allow removing existing entries a special handling for dpId=0 is added which does not complain when given fnId was not on the list. If response contains other fnId,dpId pairs, they will be left intact. If given fnId and dpId is in multiple entries, both entries will be returned - this will cause update which should resolve conflict.

Template command is more readable when written as a dictionary in the yaml. Also there is less of an issue about formatting.

In other words, I've got a new device and had to scramble something for it ;-) Feel free to modify/reject/raise issues. And again, thanks for your work.

tobias-richter commented 3 years ago

@diijkstra thanks again for your contribution! And sorry for the github actions noise. I was struggeling a little bit when migrating this repo to Github Actions

diijkstra commented 3 years ago

@tobias-richter don't worry :-) I'm happy that you were able to merge it so fast. Thanks!