Last active
August 29, 2021 13:10
-
-
Save ishioni/931bc6d2cc75efe19146f22f5cbaeb0a to your computer and use it in GitHub Desktop.
esphome ifan03 oscillation motor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| esphome: | |
| name: esphome_ifan03 | |
| platform: ESP8266 | |
| board: esp8285 | |
| includes: | |
| - ifan03.h | |
| wifi: | |
| ap: | |
| ssid: "esphome-ifan03" | |
| captive_portal: | |
| # Enable logging | |
| logger: | |
| # Enable Home Assistant API | |
| api: | |
| ota: | |
| remote_receiver: | |
| pin: GPIO3 | |
| binary_sensor: | |
| - platform: remote_receiver | |
| name: "Buzzer" | |
| id: remote_buzzer | |
| internal: true | |
| raw: | |
| code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 103, -104, 104, -103, 104, -103, 104, -104, 107, -721, 105, -206, 207, -518, 105, -931, 104, -104, 103, -725, 104, -104, 103, -725, 104, -104, 103, -207, 104, -414] | |
| on_release: | |
| then: | |
| - switch.toggle: buzzer_dummy | |
| - platform: remote_receiver | |
| name: "Fan off" | |
| id: remote_off | |
| raw: | |
| code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 104, -103, 104, -104, 103, -104, 105, -102, 104, -725, 104, -311, 103, -518, 104, -933, 103, -104, 104, -725, 104, -932, 104, -207, 207, -519] | |
| on_release: | |
| then: | |
| - fan.turn_off: ifan03_fan | |
| internal: true | |
| - platform: remote_receiver | |
| name: "Fan low" | |
| id: remote_low | |
| raw: | |
| code: [-207, 104, -104, 103, -104, 104, -103, 207, -104, 104, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -726, 103, -312, 103, -518, 104, -933, 103, -104, 104, -725, 104, -103, 104, -726, 103, -104, 311, -518] | |
| on_release: | |
| then: | |
| - fan.turn_on: | |
| id: ifan03_fan | |
| speed: LOW | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_on: buzzer_dummy | |
| then: | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| internal: true | |
| - platform: remote_receiver | |
| name: "Fan medium" | |
| id: remote_med | |
| raw: | |
| code: [-208, 103, -104, 104, -103, 104, -103, 208, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -104, 103, -726, 104, -310, 104, -518, 104, -933, 103, -104, 104, -725, 104, -207, 104, -622, 103, -416, 102, -415] | |
| on_release: | |
| then: | |
| - fan.turn_on: | |
| id: ifan03_fan | |
| speed: MEDIUM | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_on: buzzer_dummy | |
| then: | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| - delay: 50ms | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| internal: true | |
| - platform: remote_receiver | |
| name: "Fan high" | |
| id: remote_high | |
| raw: | |
| code: [-207, 104, -104, 103, -104, 104, -103, 208, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -104, 103, -726, 104, -311, 104, -518, 103, -934, 103, -103, 104, -726, 103, -104, 207, -622, 104, -103, 104, -207, 104, -415] | |
| on_release: | |
| then: | |
| - fan.turn_on: | |
| id: ifan03_fan | |
| speed: HIGH | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_on: buzzer_dummy | |
| then: | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| - delay: 50ms | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| - delay: 50ms | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| internal: true | |
| - platform: remote_receiver | |
| name: "Fan oscillate" | |
| id: remote_osc | |
| raw: | |
| code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 104, -103, 104, -103, 104, -104, 103, -104, 104, -725, 104, -311, 103, -518, 104, -933, 103, -104, 103, -726, 103, -311, 104, -518, 104, -207, 104, -103, 104, -414] | |
| on_release: | |
| then: | |
| - if: | |
| condition: | |
| or: | |
| - switch.is_on: relay_fan1 | |
| - switch.is_on: relay_fan2 | |
| - switch.is_on: relay_fan3 | |
| then: | |
| - switch.toggle: ifan03_oscillation | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_on: buzzer_dummy | |
| then: | |
| - output.turn_on: buzzer | |
| - delay: 50ms | |
| - output.turn_off: buzzer | |
| output: | |
| - platform: custom | |
| type: float | |
| outputs: | |
| id: fanoutput | |
| lambda: |- | |
| auto ifan03_fan = new IFan03Output(); | |
| App.register_component(ifan03_fan); | |
| return {ifan03_fan}; | |
| - platform: gpio | |
| pin: GPIO9 | |
| id: oscillation_out | |
| inverted: true | |
| - platform: gpio | |
| pin: GPIO10 | |
| id: buzzer | |
| inverted: true | |
| switch: | |
| - platform: template | |
| id: buzzer_dummy | |
| name: "Buzzer" | |
| optimistic: True | |
| - platform: output | |
| id: ifan03_oscillation | |
| output: oscillation_out | |
| - platform: template | |
| id: update_fan_speed | |
| optimistic: True | |
| turn_on_action: | |
| then: | |
| - delay: 200ms | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_off: relay_fan1 | |
| - switch.is_off: relay_fan2 | |
| - switch.is_off: relay_fan3 | |
| then: | |
| - fan.turn_off: ifan03_fan | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_on: relay_fan1 | |
| - switch.is_off: relay_fan2 | |
| - switch.is_off: relay_fan3 | |
| then: | |
| - fan.turn_on: | |
| id: ifan03_fan | |
| speed: LOW | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_off: relay_fan1 | |
| - switch.is_on: relay_fan2 | |
| - switch.is_off: relay_fan3 | |
| then: | |
| - fan.turn_on: | |
| id: ifan03_fan | |
| speed: MEDIUM | |
| - if: | |
| condition: | |
| and: | |
| - switch.is_off: relay_fan1 | |
| - switch.is_off: relay_fan2 | |
| - switch.is_on: relay_fan3 | |
| then: | |
| - fan.turn_on: | |
| id: ifan03_fan | |
| speed: HIGH | |
| - switch.turn_off: update_fan_speed | |
| - platform: gpio | |
| pin: GPIO14 | |
| id: relay_fan1 | |
| - platform: gpio | |
| pin: GPIO12 | |
| id: relay_fan2 | |
| - platform: gpio | |
| pin: GPIO15 | |
| id: relay_fan3 | |
| fan: | |
| - platform: speed | |
| output: fanoutput | |
| oscillation_output: oscillation_out | |
| id: ifan03_fan | |
| name: "iFan03 Fan" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment