diff --git a/codes/fan/7240.json b/codes/fan/7240.json new file mode 100644 index 000000000..b3db37341 --- /dev/null +++ b/codes/fan/7240.json @@ -0,0 +1,36 @@ +{ + "manufacturer": "EGLO", + "supportedModels": [ + "Noosa 202969", + "Noosa 202971", + "Noosa 202972", + "Noosa 202973", + "Noosa 204115", + "Noosa 204116", + "Noosa 204117", + "Noosa 204231", + "Noosa 204232", + "Noosa 204233" + ], + "supportedController": "ESPHome", + "commandsEncoding": "Raw", + "speed": [ + "1", + "2", + "3", + "4", + "5" + ], + "commands": { + "off": "[341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "toggle_direction": "[341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "oscillate": "[341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "default": { + "1": "[341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "2": "[341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "3": "[341, -341, 682, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -341, 682, -682, 341, -341, 682, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "4": "[341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]", + "5": "[341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -8900, 341, -682, 341, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -682, 341, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -682, 341, -682, 341, -341, 682, -341, 682, -341, 682, -682, 341, -682, 341, -341, 682, -341, 682, -682, 341, -178000]" + } + } +} \ No newline at end of file diff --git a/custom_components/smartir/fan.py b/custom_components/smartir/fan.py index 4c9bb9352..f1eabc3e2 100644 --- a/custom_components/smartir/fan.py +++ b/custom_components/smartir/fan.py @@ -114,8 +114,9 @@ def __init__(self, hass, config, device_data): | FanEntityFeature.TURN_ON) if (DIRECTION_REVERSE in self._commands and \ - DIRECTION_FORWARD in self._commands): - self._direction = DIRECTION_REVERSE + DIRECTION_FORWARD in self._commands) \ + or ('toggle_direction' in self._commands): + self._direction = DIRECTION_FORWARD self._support_flags = ( self._support_flags | FanEntityFeature.DIRECTION) if ('oscillate' in self._commands): @@ -126,6 +127,7 @@ def __init__(self, hass, config, device_data): self._temp_lock = asyncio.Lock() self._on_by_remote = False + self._prev_direction = DIRECTION_FORWARD #Init the IR/RF controller self._controller = get_controller( @@ -267,20 +269,27 @@ async def send_command(self): async with self._temp_lock: self._on_by_remote = False speed = self._speed - direction = self._direction or 'default' + direction = 'default' if ('toggle_direction' in self._commands) else (self._direction or 'default') oscillating = self._oscillating if speed.lower() == SPEED_OFF: - command = self._commands['off'] + self._prev_direction = DIRECTION_FORWARD + await self.send_single_command(self._commands['off']) + return elif oscillating: - command = self._commands['oscillate'] + await self.send_single_command(self._commands['oscillate']) else: - command = self._commands[direction][speed] + await self.send_single_command(self._commands[direction][speed]) - try: - await self._controller.send(command) - except Exception as e: - _LOGGER.exception(e) + if ('toggle_direction' in self._commands) and (self._direction != self._prev_direction): + self._prev_direction = self._direction + await self.send_single_command(self._commands['toggle_direction']) + + async def send_single_command(self, command): + try: + await self._controller.send(command) + except Exception as e: + _LOGGER.exception(e) @callback async def _async_power_sensor_changed(self, event: Event[EventStateChangedData]) -> None: diff --git a/docs/CLIMATE.md b/docs/CLIMATE.md index e7eeb9d49..5e7ce98d8 100644 --- a/docs/CLIMATE.md +++ b/docs/CLIMATE.md @@ -3,7 +3,7 @@

For this platform to work, we need a .json file containing all the necessary IR commands. -Find your device's brand code [here](CLIMATE.md#available-codes-for-climate-devices) and add the number in the `device_code` field. If your device is not working, you will need to learn your own codes and place the Json file in `smartir/codes/climate` subfolders. ~~[Keite Trần](https://github.com/keitetran/BroadlinkIRTools) developed [an amazing web-based app](https://keitetran.github.io/BroadlinkIRTools/) for this job.~~ +Find your device's brand code [here](CLIMATE.md#available-codes-for-climate-devices) and add the number in the `device_code` field. If your device is not working, you will need to learn your own codes and place the Json file in `smartir/codes/climate` subfolders. [Callum Gare](https://github.com/callumgare/BroadlinkIRTools) has a functional fork of [the amazing web-based app](https://callumgare.github.io/BroadlinkIRTools/) Keite Trần developed for this job. _Please note that the device_code field only accepts positive numbers. The .json extension is not required._ ## Configuration variables: