Skip to content
36 changes: 36 additions & 0 deletions codes/fan/7240.json
Original file line number Diff line number Diff line change
@@ -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]"
}
}
}
29 changes: 19 additions & 10 deletions custom_components/smartir/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/CLIMATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

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:
Expand Down
Loading