Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5031 lines
162 KiB

6 years ago
6 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
7 years ago
6 years ago
6 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
providers: relays, lights and buttons refactoring (#2414) - gpio module now tracks the known providers (right now, hardware and mcp expander) - refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions - refactored button module to use gpio provider instead of referencing types itself - removed dual & stm code from buttons, migrate both to relay module - added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did) - relays runtime configuration keys - relay command now shows configured relays and current & target statuses - refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead - remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT - allow to bind rf codes to real relays - drop tuya-specific lights provider, remove tuya code from relays and lights modules - integrate tuya via relay listeners and providers, use lights custom provider - implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle) - lights custom provider (global, not per-pin) and state listeners - remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT - lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT - refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing - transition time + step parameter for the lightUpdate - report mask parameter for the lightUpdate - minor fixes across the board resolve #2222
3 years ago
  1. // -----------------------------------------------------------------------------
  2. // Configuration HELP
  3. // -----------------------------------------------------------------------------
  4. //
  5. // Required:
  6. //
  7. // MANUFACTURER: Name of the manufacturer of the board ("string")
  8. // DEVICE: Name of the device ("string")
  9. //
  10. // For example, some configuration options for BUTTON, RELAY and LED modules.
  11. // See general.h, defaults.h and types.h for all of the available flags.
  12. //
  13. // BUTTON[1-8]_CONFIG: Configuration mask (note that BUTTON_PUSHBUTTON and BUTTON_SWITCH cannot be together)
  14. // - BUTTON_PUSHBUTTON: button event is fired when released
  15. // - BUTTON_SWITCH: button event is fired when pressed or released
  16. // - BUTTON_DEFAULT_HIGH: there is a pull up in place, HIGH is default state
  17. // - BUTTON_DEFAULT_LOW: there is a pull down in place, LOW is default state
  18. // - BUTTON_DEFAULT_BOOT: use state that we read on firmware boot
  19. // - BUTTON_SET_PULLUP: set pullup by software
  20. // - BUTTON_SET_PULLDOWN: set pulldown by software (esp8266: only GPIO16)
  21. // BUTTON[1-8]_... actions: Check types.h for BUTTONx_ACTION_...
  22. // BUTTON[1-8]_PIN: GPIO for the n-th button (1-based, up to 8 buttons)
  23. // BUTTON[1-8]_PROVIDER: Check types.h for the BUTTON_PROVIDER_...
  24. // BUTTON[1-8]_RELAY: Relay number that will be bound to the n-th button (when ACTION is set to ON, OFF or TOGGLE; 1-based)
  25. //
  26. // RELAY[1-8]_PIN: GPIO for the n-th relay (1-based, up to 8 relays)
  27. // RELAY[1-8]_TYPE: Relay can be RELAY_TYPE_NORMAL, RELAY_TYPE_INVERSE, RELAY_TYPE_LATCHED or RELAY_TYPE_LATCHED_INVERSE
  28. //
  29. // LED[1-8]_PIN: GPIO for the n-th LED (1-based, up to 8 LEDs)
  30. // LED[1-8]_PIN_INVERSE: LED has inversed logic (lit when pulled down)
  31. // LED[1-8]_MODE: Check types.h for LED_MODE_...
  32. // LED[1-8]_RELAY: Linked relay (1-based)
  33. //
  34. // Besides, other hardware specific information should be stated here
  35. #pragma once
  36. // -----------------------------------------------------------------------------
  37. // Custom hardware
  38. // -----------------------------------------------------------------------------
  39. #if defined(MANUFACTURER) and defined(DEVICE)
  40. // user has defined custom hardware, no need to check anything else
  41. // -----------------------------------------------------------------------------
  42. // ESPurna Core
  43. // -----------------------------------------------------------------------------
  44. #elif defined(ESPURNA_CORE)
  45. // This is a special device targeted to generate a light-weight binary image
  46. // meant to be able to do two-step-updates:
  47. // https://github.com/xoseperez/espurna/wiki/TwoStepUpdates
  48. // Info
  49. #define MANUFACTURER "ESPURNA"
  50. #define DEVICE "CORE"
  51. // Disable non-core modules
  52. #define ALEXA_SUPPORT 0
  53. #define API_SUPPORT 0
  54. #define BROKER_SUPPORT 0
  55. #define DEBUG_SERIAL_SUPPORT 0
  56. #define DEBUG_TELNET_SUPPORT 0
  57. #define DEBUG_WEB_SUPPORT 0
  58. #define DOMOTICZ_SUPPORT 0
  59. #define HOMEASSISTANT_SUPPORT 0
  60. #define I2C_SUPPORT 0
  61. #define MQTT_SUPPORT 0
  62. #define NTP_SUPPORT 0
  63. #define RPN_RULES_SUPPORT 0
  64. #define SCHEDULER_SUPPORT 0
  65. #define SENSOR_SUPPORT 0
  66. #define THINGSPEAK_SUPPORT 0
  67. #define WEB_SUPPORT 0
  68. #define TELNET_AUTHENTICATION 0
  69. #define TELNET_STA 1
  70. // Extra light-weight image
  71. //#define BUTTON_SUPPORT 0 // don't need / have buttons
  72. //#define LED_SUPPORT 0 // don't need wifi indicator
  73. //#define RELAY_SUPPORT 0 // don't need to preserve pin state between resets
  74. //#define OTA_ARDUINOOTA_SUPPORT 0 // when only using `ota` command
  75. //#define MDNS_SERVER_SUPPORT 0 //
  76. //#define TELNET_SUPPORT 0 // when only using espota.py
  77. //#define TERMINAL_SUPPORT 0 //
  78. #elif defined(ESPURNA_CORE_WEBUI)
  79. // This is a special device with no specific hardware
  80. // with the basics to easily upgrade it to a device-specific image
  81. // Info
  82. #define MANUFACTURER "ESPURNA"
  83. #define DEVICE "CORE_WEBUI"
  84. // Disable non-core modules
  85. #define ALEXA_SUPPORT 0
  86. #define API_SUPPORT 0
  87. #define BROKER_SUPPORT 0
  88. #define DOMOTICZ_SUPPORT 0
  89. #define DEBUG_SERIAL_SUPPORT 0
  90. //#define DEBUG_TELNET_SUPPORT 0
  91. //#define DEBUG_WEB_SUPPORT 0
  92. #define HOMEASSISTANT_SUPPORT 0
  93. #define I2C_SUPPORT 0
  94. #define MQTT_SUPPORT 0
  95. #define NTP_SUPPORT 0
  96. #define SCHEDULER_SUPPORT 0
  97. #define SENSOR_SUPPORT 0
  98. #define THINGSPEAK_SUPPORT 0
  99. //#define WEB_SUPPORT 0
  100. #define WEB_FORCE_PASS_CHANGE 0
  101. #define TELNET_AUTHENTICATION 0
  102. #define TELNET_STA 1
  103. // Extra light-weight image
  104. #define BUTTON_SUPPORT 0
  105. #define LED_SUPPORT 0
  106. //#define MDNS_SERVER_SUPPORT 0
  107. //#define TELNET_SUPPORT 0
  108. //#define TERMINAL_SUPPORT 0
  109. // -----------------------------------------------------------------------------
  110. // Development boards
  111. // -----------------------------------------------------------------------------
  112. #elif defined(NODEMCU_LOLIN)
  113. // Info
  114. #define MANUFACTURER "NODEMCU"
  115. #define DEVICE "LOLIN"
  116. // Buttons
  117. #define BUTTON1_PIN 0
  118. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  119. #define BUTTON1_RELAY 1
  120. // Hidden button will enter AP mode if dblclick and reset the device when long-long-clicked
  121. #define RELAY1_PIN 12
  122. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  123. // Light
  124. #define LED1_PIN 2
  125. #define LED1_PIN_INVERSE 1
  126. #elif defined(NODEMCU_BASIC)
  127. // Info
  128. // Generic NodeMCU Board without any buttons or relays connected.
  129. #define MANUFACTURER "NODEMCU"
  130. #define DEVICE "BASIC"
  131. #elif defined(WEMOS_D1_MINI)
  132. // Info
  133. #define MANUFACTURER "WEMOS"
  134. #define DEVICE "D1_MINI"
  135. // Buttons
  136. // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems
  137. #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND,
  138. // it's the same as using a Wemos one button shield
  139. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  140. #define BUTTON1_RELAY 1
  141. // LEDs
  142. #define LED1_PIN 2
  143. #define LED1_PIN_INVERSE 1
  144. #define I2C_SDA_PIN 4 // D2
  145. #define I2C_SCL_PIN 5 // D1
  146. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  147. // Info
  148. #define MANUFACTURER "WEMOS"
  149. #define DEVICE "D1_MINI_RELAYSHIELD"
  150. // Buttons
  151. // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems
  152. #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND,
  153. // it's the same as using a Wemos one button shield
  154. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  155. #define BUTTON1_RELAY 1
  156. // Relays
  157. #define RELAY1_PIN 5
  158. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  159. // LED
  160. #define LED1_PIN 2
  161. #define LED1_PIN_INVERSE 1
  162. // When Wemos relay shield is connected GPIO5 (D1) is used for relay,
  163. // so I2C must be remapped to other pins
  164. #define I2C_SDA_PIN 12 // D6
  165. #define I2C_SCL_PIN 14 // D5
  166. #elif defined(WEMOS_D1_TARPUNA_SHIELD)
  167. // Info
  168. #define MANUFACTURER "WEMOS"
  169. #define DEVICE "D1_TARPUNA_SHIELD"
  170. // Relays
  171. #define RELAY1_PIN 5
  172. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  173. #define DHT_SUPPORT 1
  174. #define DHT_PIN 12
  175. // -----------------------------------------------------------------------------
  176. // ESPurna
  177. // -----------------------------------------------------------------------------
  178. #elif defined(TINKERMAN_ESPURNA_H06)
  179. // Info
  180. #define MANUFACTURER "TINKERMAN"
  181. #define DEVICE "ESPURNA_H06"
  182. // Buttons
  183. #define BUTTON1_PIN 4
  184. #define BUTTON1_RELAY 1
  185. // Normal pushbutton
  186. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  187. // Relays
  188. #define RELAY1_PIN 12
  189. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  190. // LEDs
  191. #define LED1_PIN 2
  192. #define LED1_PIN_INVERSE 1
  193. // HLW8012
  194. #ifndef HLW8012_SUPPORT
  195. #define HLW8012_SUPPORT 1
  196. #endif
  197. #define HLW8012_SEL_PIN 2
  198. #define HLW8012_CF1_PIN 13
  199. #define HLW8012_CF_PIN 14
  200. #elif defined(TINKERMAN_ESPURNA_H08)
  201. // Info
  202. #define MANUFACTURER "TINKERMAN"
  203. #define DEVICE "ESPURNA_H08"
  204. // Buttons
  205. #define BUTTON1_PIN 4
  206. #define BUTTON1_RELAY 1
  207. // Normal pushbutton
  208. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  209. // Relays
  210. #define RELAY1_PIN 12
  211. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  212. // LEDs
  213. #define LED1_PIN 2
  214. #define LED1_PIN_INVERSE 0
  215. // HLW8012
  216. #ifndef HLW8012_SUPPORT
  217. #define HLW8012_SUPPORT 1
  218. #endif
  219. #define HLW8012_SEL_PIN 5
  220. #define HLW8012_CF1_PIN 13
  221. #define HLW8012_CF_PIN 14
  222. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  223. // Info
  224. #define MANUFACTURER "TINKERMAN"
  225. #define DEVICE "ESPURNA_SWITCH"
  226. // Buttons
  227. #define BUTTON1_PIN 4
  228. #define BUTTON1_RELAY 1
  229. // Touch button
  230. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON
  231. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  232. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  233. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  234. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  235. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_NONE
  236. // LEDs
  237. #define LED1_PIN 2
  238. #define LED1_PIN_INVERSE 0
  239. // Relays
  240. #define RELAY1_PIN 12
  241. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  242. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  243. #elif defined(TINKERMAN_RFM69GW)
  244. // Info
  245. #define MANUFACTURER "TINKERMAN"
  246. #define DEVICE "RFM69GW"
  247. // Buttons
  248. #define BUTTON1_PIN 0
  249. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  250. // RFM69GW
  251. #define RFM69_SUPPORT 1
  252. // Disable non-core modules
  253. #define ALEXA_SUPPORT 0
  254. #define DOMOTICZ_SUPPORT 0
  255. #define HOMEASSISTANT_SUPPORT 0
  256. #define I2C_SUPPORT 0
  257. #define SCHEDULER_SUPPORT 0
  258. #define SENSOR_SUPPORT 0
  259. #define THINGSPEAK_SUPPORT 0
  260. // -----------------------------------------------------------------------------
  261. // Itead Studio boards
  262. // -----------------------------------------------------------------------------
  263. #elif defined(ITEAD_SONOFF_BASIC)
  264. // Info
  265. #define MANUFACTURER "ITEAD"
  266. #define DEVICE "SONOFF_BASIC"
  267. // Buttons
  268. #define BUTTON1_PIN 0
  269. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  270. #define BUTTON1_RELAY 1
  271. #define BUTTON2_PIN 14
  272. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  273. #define BUTTON2_RELAY 1
  274. // Relays
  275. #define RELAY1_PIN 12
  276. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  277. // LEDs
  278. #define LED1_PIN 13
  279. #define LED1_PIN_INVERSE 1
  280. #elif defined(ITEAD_SONOFF_RF)
  281. // Info
  282. #define MANUFACTURER "ITEAD"
  283. #define DEVICE "SONOFF_RF"
  284. // Buttons
  285. #define BUTTON1_PIN 0
  286. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  287. #define BUTTON1_RELAY 1
  288. #define BUTTON2_PIN 14
  289. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  290. #define BUTTON2_RELAY 1
  291. // Relays
  292. #define RELAY1_PIN 12
  293. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  294. // LEDs
  295. #define LED1_PIN 13
  296. #define LED1_PIN_INVERSE 1
  297. #elif defined(ITEAD_SONOFF_MINI)
  298. // Info
  299. #define MANUFACTURER "ITEAD"
  300. #define DEVICE "SONOFF_MINI"
  301. // Buttons
  302. #define BUTTON1_PIN 0
  303. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  304. #define BUTTON1_RELAY 1
  305. #define BUTTON2_PIN 4
  306. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_BOOT
  307. #define BUTTON2_RELAY 1
  308. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  309. #define BUTTON2_RELEASE BUTTON_ACTION_TOGGLE
  310. // Relays
  311. #define RELAY1_PIN 12
  312. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  313. // LEDs
  314. #define LED1_PIN 13
  315. #define LED1_PIN_INVERSE 1
  316. #elif defined(ITEAD_SONOFF_TH)
  317. // Info
  318. #define MANUFACTURER "ITEAD"
  319. #define DEVICE "SONOFF_TH"
  320. // Buttons
  321. #define BUTTON1_PIN 0
  322. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  323. #define BUTTON1_RELAY 1
  324. // Relays
  325. #define RELAY1_PIN 12
  326. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  327. // LEDs
  328. #define LED1_PIN 13
  329. #define LED1_PIN_INVERSE 1
  330. // Jack is connected to GPIO14 (and with a small hack to GPIO4)
  331. #ifndef DALLAS_SUPPORT
  332. #define DALLAS_SUPPORT 1
  333. #endif
  334. #define DALLAS_PIN 14
  335. #ifndef DHT_SUPPORT
  336. #define DHT_SUPPORT 1
  337. #endif
  338. #define DHT_PIN 14
  339. #define DHT_TYPE DHT_CHIP_SI7021
  340. //#define I2C_SDA_PIN 4
  341. //#define I2C_SCL_PIN 14
  342. #elif defined(ITEAD_SONOFF_SV)
  343. // Info
  344. #define MANUFACTURER "ITEAD"
  345. #define DEVICE "SONOFF_SV"
  346. // Buttons
  347. #define BUTTON1_PIN 0
  348. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  349. #define BUTTON1_RELAY 1
  350. // Relays
  351. #define RELAY1_PIN 12
  352. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  353. // LEDs
  354. #define LED1_PIN 13
  355. #define LED1_PIN_INVERSE 1
  356. #elif defined(ITEAD_SLAMPHER)
  357. // Info
  358. #define MANUFACTURER "ITEAD"
  359. #define DEVICE "SLAMPHER"
  360. // Buttons
  361. #define BUTTON1_PIN 0
  362. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  363. #define BUTTON1_RELAY 1
  364. // Relays
  365. #define RELAY1_PIN 12
  366. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  367. // LEDs
  368. #define LED1_PIN 13
  369. #define LED1_PIN_INVERSE 1
  370. #elif defined(ITEAD_S20)
  371. // Info
  372. #define MANUFACTURER "ITEAD"
  373. #define DEVICE "S20"
  374. // Buttons
  375. #define BUTTON1_PIN 0
  376. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  377. #define BUTTON1_RELAY 1
  378. // Relays
  379. #define RELAY1_PIN 12
  380. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  381. // LEDs
  382. #define LED1_PIN 13
  383. #define LED1_PIN_INVERSE 1
  384. #elif defined(ITEAD_SONOFF_TOUCH)
  385. // Info
  386. #define MANUFACTURER "ITEAD"
  387. #define DEVICE "SONOFF_TOUCH"
  388. // Buttons
  389. #define BUTTON1_PIN 0
  390. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  391. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  392. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  393. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  394. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  395. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  396. #define BUTTON1_RELAY 1
  397. // Relays
  398. #define RELAY1_PIN 12
  399. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  400. // LEDs
  401. #define LED1_PIN 13
  402. #define LED1_PIN_INVERSE 1
  403. #elif defined(ITEAD_SONOFF_POW)
  404. // Info
  405. #define MANUFACTURER "ITEAD"
  406. #define DEVICE "SONOFF_POW"
  407. // Buttons
  408. #define BUTTON1_PIN 0
  409. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  410. #define BUTTON1_RELAY 1
  411. // Relays
  412. #define RELAY1_PIN 12
  413. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  414. // LEDs
  415. #define LED1_PIN 15
  416. #define LED1_PIN_INVERSE 0
  417. // HLW8012
  418. #ifndef HLW8012_SUPPORT
  419. #define HLW8012_SUPPORT 1
  420. #endif
  421. #define HLW8012_SEL_PIN 5
  422. #define HLW8012_CF1_PIN 13
  423. #define HLW8012_CF_PIN 14
  424. #elif defined(ITEAD_SONOFF_POW_R2)
  425. // Info
  426. #define MANUFACTURER "ITEAD"
  427. #define DEVICE "SONOFF_POW_R2"
  428. // Buttons
  429. #define BUTTON1_PIN 0
  430. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  431. #define BUTTON1_RELAY 1
  432. // Relays
  433. #define RELAY1_PIN 12
  434. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  435. // LEDs
  436. #define LED1_PIN 13
  437. #define LED1_PIN_INVERSE 1
  438. // Disable UART noise
  439. #define DEBUG_SERIAL_SUPPORT 0
  440. // CSE7766
  441. #ifndef CSE7766_SUPPORT
  442. #define CSE7766_SUPPORT 1
  443. #endif
  444. #define CSE7766_RX_PIN 3
  445. #elif defined(ITEAD_SONOFF_DUAL)
  446. // Info
  447. #define MANUFACTURER "ITEAD"
  448. #define DEVICE "SONOFF_DUAL"
  449. #define SERIAL_BAUDRATE 19230
  450. // LEDs
  451. #define LED1_PIN 13
  452. #define LED1_PIN_INVERSE 1
  453. // Relays
  454. #define RELAY_PROVIDER_DUAL_SUPPORT 1
  455. #define RELAY1_PROVIDER RELAY_PROVIDER_DUAL
  456. #define RELAY2_PROVIDER RELAY_PROVIDER_DUAL
  457. // No need to include generic GPIO support
  458. // "Buttons" are attached to a secondary MCU and RELAY_PROVIDER_DUAL handles that
  459. #define BUTTON_PROVIDER_GPIO_SUPPORT 0
  460. // Conflicts with relay operation
  461. #define DEBUG_SERIAL_SUPPORT 0
  462. #elif defined(ITEAD_SONOFF_DUAL_R2)
  463. #define MANUFACTURER "ITEAD"
  464. #define DEVICE "SONOFF_DUAL_R2"
  465. // Buttons
  466. #define BUTTON1_PIN 0 // Button 0 on header
  467. #define BUTTON2_PIN 9 // Button 1 on header
  468. #define BUTTON3_PIN 10 // Physical button
  469. #define BUTTON1_RELAY 1
  470. #define BUTTON2_RELAY 2
  471. #define BUTTON3_RELAY 1
  472. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  473. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  474. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  475. // Relays
  476. #define RELAY1_PIN 12
  477. #define RELAY2_PIN 5
  478. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  479. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  480. // LEDs
  481. #define LED1_PIN 13
  482. #define LED1_PIN_INVERSE 1
  483. #elif defined(ITEAD_SONOFF_4CH)
  484. // Info
  485. #define MANUFACTURER "ITEAD"
  486. #define DEVICE "SONOFF_4CH"
  487. // Buttons
  488. #define BUTTON1_PIN 0
  489. #define BUTTON2_PIN 9
  490. #define BUTTON3_PIN 10
  491. #define BUTTON4_PIN 14
  492. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  493. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  494. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  495. #define BUTTON4_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  496. #define BUTTON1_RELAY 1
  497. #define BUTTON2_RELAY 2
  498. #define BUTTON3_RELAY 3
  499. #define BUTTON4_RELAY 4
  500. // Relays
  501. #define RELAY1_PIN 12
  502. #define RELAY2_PIN 5
  503. #define RELAY3_PIN 4
  504. #define RELAY4_PIN 15
  505. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  506. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  507. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  508. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  509. // LEDs
  510. #define LED1_PIN 13
  511. #define LED1_PIN_INVERSE 1
  512. #elif defined(ITEAD_SONOFF_4CH_PRO)
  513. // Info
  514. #define MANUFACTURER "ITEAD"
  515. #define DEVICE "SONOFF_4CH_PRO"
  516. // Buttons
  517. #define BUTTON1_PIN 0
  518. #define BUTTON2_PIN 9
  519. #define BUTTON3_PIN 10
  520. #define BUTTON4_PIN 14
  521. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  522. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  523. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  524. #define BUTTON4_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  525. #define BUTTON1_RELAY 1
  526. #define BUTTON2_RELAY 2
  527. #define BUTTON3_RELAY 3
  528. #define BUTTON4_RELAY 4
  529. // Sonoff 4CH Pro uses a secondary STM32 microcontroller to handle
  530. // buttons and relays, but it also forwards button presses to the ESP8285.
  531. // This allows ESPurna to handle button presses -almost- the same way
  532. // as with other devices except:
  533. // * Double click seems to break/disable the button on the STM32 side
  534. // * With S6 switch to 1 (self-locking and inching modes) everything's OK
  535. // * With S6 switch to 0 (interlock mode) if there is a relay ON
  536. // and you click on another relay button, the STM32 sends a "press"
  537. // event for the button of the first relay (to turn it OFF) but it
  538. // does not send a "release" event. It's like it's holding the
  539. // button down since you can see it is still LOW.
  540. // Whatever reason the result is that it may actually perform a
  541. // long click or long-long click.
  542. // The configuration below make the button toggle the relay on press events
  543. // and disables any possibly harmful combination with S6 set to 0.
  544. // If you are sure you will only use S6 to 1 you can comment the
  545. // BUTTON1_LNGCLICK and BUTTON1_LNGLNGCLICK options below to recover the
  546. // reset mode and factory reset functionalities, or link other actions like
  547. // AP mode in the commented line below.
  548. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  549. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  550. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  551. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  552. //#define BUTTON1_LNGCLICK BUTTON_ACTION_AP
  553. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_NONE
  554. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  555. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  556. #define BUTTON3_PRESS BUTTON_ACTION_TOGGLE
  557. #define BUTTON3_CLICK BUTTON_ACTION_NONE
  558. #define BUTTON4_PRESS BUTTON_ACTION_TOGGLE
  559. #define BUTTON4_CLICK BUTTON_ACTION_NONE
  560. // Relays
  561. #define RELAY1_PIN 12
  562. #define RELAY2_PIN 5
  563. #define RELAY3_PIN 4
  564. #define RELAY4_PIN 15
  565. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  566. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  567. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  568. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  569. // LEDs
  570. #define LED1_PIN 13
  571. #define LED1_PIN_INVERSE 1
  572. #elif defined(ITEAD_1CH_INCHING)
  573. // The inching functionality is managed by a misterious IC in the board.
  574. // You cannot control the inching button and functionality from the ESP8266
  575. // Besides, enabling the inching functionality using the hardware button
  576. // will result in the relay switching on and off continuously.
  577. // Fortunately the unkown IC keeps memory of the hardware inching status
  578. // so you can just disable it and forget. The inching LED must be lit.
  579. // You can still use the pulse options from the web interface
  580. // without problem.
  581. // Info
  582. #define MANUFACTURER "ITEAD"
  583. #define DEVICE "1CH_INCHING"
  584. // Buttons
  585. #define BUTTON1_PIN 0
  586. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  587. #define BUTTON1_RELAY 1
  588. // Relays
  589. #define RELAY1_PIN 12
  590. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  591. // LEDs
  592. #define LED1_PIN 13
  593. #define LED1_PIN_INVERSE 1
  594. #elif defined(ITEAD_MOTOR)
  595. // Info
  596. #define MANUFACTURER "ITEAD"
  597. #define DEVICE "MOTOR"
  598. // Buttons
  599. #define BUTTON1_PIN 0
  600. #define BUTTON1_RELAY 1
  601. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  602. // Relays
  603. #define RELAY1_PIN 12
  604. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  605. // LEDs
  606. #define LED1_PIN 13
  607. #define LED1_PIN_INVERSE 1
  608. #elif defined(ITEAD_BNSZ01)
  609. // Info
  610. #define MANUFACTURER "ITEAD"
  611. #define DEVICE "BNSZ01"
  612. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  613. // LEDs
  614. #define LED1_PIN 13
  615. #define LED1_PIN_INVERSE 1
  616. // Light
  617. #define LIGHT_CHANNELS 1
  618. #define LIGHT_CH1_PIN 12
  619. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  620. // Info
  621. #define MANUFACTURER "ITEAD"
  622. #define DEVICE "SONOFF_RFBRIDGE"
  623. // Number of virtual switches
  624. #ifndef DUMMY_RELAY_COUNT
  625. #define DUMMY_RELAY_COUNT 8
  626. #endif
  627. // Buttons
  628. #define BUTTON1_PIN 0
  629. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  630. // LEDs
  631. #define LED1_PIN 13
  632. #define LED1_PIN_INVERSE 1
  633. #define RFB_SUPPORT 1
  634. // When using un-modified harware, ESPurna communicates with the secondary
  635. // MCU EFM8BB1 via UART at 19200 bps so we need to change the speed of
  636. // the port and remove UART noise on serial line
  637. #ifndef RFB_PROVIDER
  638. #define RFB_PROVIDER RFB_PROVIDER_EFM8BB1
  639. #endif
  640. #ifndef DEBUG_SERIAL_SUPPORT
  641. #define DEBUG_SERIAL_SUPPORT 0
  642. #endif
  643. #define SERIAL_BAUDRATE 19200
  644. // Only used when RFB_PROVIDER is RCSWITCH
  645. #define RFB_RX_PIN 4
  646. #define RFB_TX_PIN 5
  647. #elif defined(ITEAD_SONOFF_B1)
  648. // Info
  649. #define MANUFACTURER "ITEAD"
  650. #define DEVICE "SONOFF_B1"
  651. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  652. // Light
  653. #define LIGHT_CHANNELS 5
  654. #define MY92XX_MODEL MY92XX_MODEL_MY9231
  655. #define MY92XX_CHIPS 2
  656. #define MY92XX_DI_PIN 12
  657. #define MY92XX_DCKI_PIN 14
  658. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  659. #define MY92XX_CH1 4
  660. #define MY92XX_CH2 3
  661. #define MY92XX_CH3 5
  662. #define MY92XX_CH4 0
  663. #define MY92XX_CH5 1
  664. #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1
  665. #elif defined(ITEAD_SONOFF_LED)
  666. // Info
  667. #define MANUFACTURER "ITEAD"
  668. #define DEVICE "SONOFF_LED"
  669. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  670. // LEDs
  671. #define LED1_PIN 13
  672. #define LED1_PIN_INVERSE 1
  673. // Light
  674. #define LIGHT_CHANNELS 2
  675. #define LIGHT_CH1_PIN 12 // Cold white
  676. #define LIGHT_CH2_PIN 14 // Warm white
  677. #elif defined(ITEAD_SONOFF_T1_1CH)
  678. // Info
  679. #define MANUFACTURER "ITEAD"
  680. #define DEVICE "SONOFF_T1_1CH"
  681. // Buttons
  682. #define BUTTON1_PIN 0
  683. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  684. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  685. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  686. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  687. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  688. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  689. #define BUTTON1_RELAY 1
  690. // Relays
  691. #define RELAY1_PIN 12
  692. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  693. // LEDs
  694. #define LED1_PIN 13
  695. #define LED1_PIN_INVERSE 1
  696. #elif defined(ITEAD_SONOFF_T1_2CH)
  697. // Info
  698. #define MANUFACTURER "ITEAD"
  699. #define DEVICE "SONOFF_T1_2CH"
  700. // Buttons
  701. #define BUTTON1_PIN 0
  702. #define BUTTON2_PIN 9
  703. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  704. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  705. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  706. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  707. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  708. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  709. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  710. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  711. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  712. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  713. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  714. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_RESET
  715. #define BUTTON1_RELAY 1
  716. #define BUTTON2_RELAY 2
  717. // Relays
  718. #define RELAY1_PIN 12
  719. #define RELAY2_PIN 5
  720. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  721. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  722. // LEDs
  723. #define LED1_PIN 13
  724. #define LED1_PIN_INVERSE 1
  725. #elif defined(ITEAD_SONOFF_T1_3CH)
  726. // Info
  727. #define MANUFACTURER "ITEAD"
  728. #define DEVICE "SONOFF_T1_3CH"
  729. // Buttons
  730. #define BUTTON1_PIN 0
  731. #define BUTTON2_PIN 9
  732. #define BUTTON3_PIN 10
  733. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  734. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  735. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  736. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  737. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  738. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  739. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  740. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  741. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  742. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  743. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  744. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_RESET
  745. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  746. #define BUTTON3_PRESS BUTTON_ACTION_TOGGLE
  747. #define BUTTON3_CLICK BUTTON_ACTION_NONE
  748. #define BUTTON3_DBLCLICK BUTTON_ACTION_NONE
  749. #define BUTTON3_LNGCLICK BUTTON_ACTION_NONE
  750. #define BUTTON3_LNGLNGCLICK BUTTON_ACTION_RESET
  751. #define BUTTON1_RELAY 1
  752. #define BUTTON2_RELAY 2
  753. #define BUTTON3_RELAY 3
  754. // Relays
  755. #define RELAY1_PIN 12
  756. #define RELAY2_PIN 5
  757. #define RELAY3_PIN 4
  758. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  759. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  760. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  761. // LEDs
  762. #define LED1_PIN 13
  763. #define LED1_PIN_INVERSE 1
  764. #elif defined(ITEAD_SONOFF_S31)
  765. // Info
  766. #define MANUFACTURER "ITEAD"
  767. #define DEVICE "SONOFF_S31"
  768. // Buttons
  769. #define BUTTON1_PIN 0
  770. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  771. #define BUTTON1_RELAY 1
  772. // Relays
  773. #define RELAY1_PIN 12
  774. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  775. // LEDs
  776. #define LED1_PIN 13
  777. #define LED1_PIN_INVERSE 1
  778. // Disable UART noise
  779. #define DEBUG_SERIAL_SUPPORT 0
  780. // CSE7766
  781. #define CSE7766_SUPPORT 1
  782. #define CSE7766_RX_PIN 3
  783. #elif defined(ITEAD_SONOFF_S31_LITE)
  784. // Info
  785. #define MANUFACTURER "ITEAD"
  786. #define DEVICE "SONOFF_S31_LITE"
  787. // Buttons
  788. #define BUTTON1_PIN 0
  789. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  790. #define BUTTON1_RELAY 1
  791. // Relays
  792. #define RELAY1_PIN 12
  793. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  794. // LEDs
  795. #define LED1_PIN 13
  796. #define LED1_PIN_INVERSE 1
  797. #elif defined(ITEAD_SONOFF_IFAN02)
  798. // Info
  799. #define MANUFACTURER "ITEAD"
  800. #define DEVICE "SONOFF_IFAN02"
  801. // Base module
  802. #define IFAN_SUPPORT 1
  803. // These buttons are triggered by the remote
  804. // Fan module adds a custom button handler and a special relay controlling the speed
  805. #define BUTTON1_PIN 0
  806. #define BUTTON1_CLICK BUTTON_ACTION_TOGGLE
  807. #define BUTTON2_PIN 9
  808. #define BUTTON2_CLICK BUTTON_ACTION_FAN_LOW
  809. #define BUTTON3_PIN 10
  810. #define BUTTON3_CLICK BUTTON_ACTION_FAN_MEDIUM
  811. #define BUTTON4_PIN 14
  812. #define BUTTON4_CLICK BUTTON_ACTION_FAN_HIGH
  813. // LEDs
  814. #define LED1_PIN 13
  815. #define LED1_PIN_INVERSE 1
  816. // -----------------------------------------------------------------------------
  817. // ORVIBO
  818. // -----------------------------------------------------------------------------
  819. #elif defined(ORVIBO_B25)
  820. // Info
  821. #define MANUFACTURER "ORVIBO"
  822. #define DEVICE "B25"
  823. // Buttons
  824. #define BUTTON1_PIN 14
  825. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  826. #define BUTTON1_RELAY 1
  827. // Relays
  828. #define RELAY1_PIN 5
  829. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  830. // LEDs
  831. #define LED1_PIN 12 // 4 blue led
  832. #define LED1_PIN_INVERSE 1
  833. #define LED2_PIN 4 // 12 red led
  834. #define LED2_PIN_INVERSE 1
  835. // -----------------------------------------------------------------------------
  836. // YJZK
  837. // -----------------------------------------------------------------------------
  838. #elif defined(YJZK_SWITCH_1CH)
  839. // Info
  840. #define MANUFACTURER "YJZK"
  841. #define DEVICE "SWITCH_1CH"
  842. // Buttons
  843. #define BUTTON1_PIN 0
  844. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  845. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  846. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  847. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  848. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  849. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  850. #define BUTTON1_RELAY 1
  851. // Relays
  852. #define RELAY1_PIN 12
  853. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  854. // LEDs
  855. #define LED1_PIN 13
  856. #define LED1_PIN_INVERSE 0
  857. #elif defined(YJZK_SWITCH_2CH)
  858. // Info
  859. #define MANUFACTURER "YJZK"
  860. #define DEVICE "SWITCH_2CH"
  861. // Buttons
  862. #define BUTTON1_PIN 0
  863. #define BUTTON2_PIN 9
  864. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  865. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  866. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  867. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  868. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  869. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  870. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  871. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  872. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  873. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  874. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  875. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_RESET
  876. #define BUTTON1_RELAY 1
  877. #define BUTTON2_RELAY 2
  878. // Relays
  879. #define RELAY1_PIN 12
  880. #define RELAY2_PIN 5
  881. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  882. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  883. // LEDs
  884. #define LED1_PIN 13
  885. #define LED1_PIN_INVERSE 0
  886. // YJZK 3CH switch
  887. // Also Lixin Touch Wifi 3M
  888. #elif defined(YJZK_SWITCH_3CH)
  889. // Info
  890. #define MANUFACTURER "YJZK"
  891. #define DEVICE "SWITCH_3CH"
  892. // Buttons
  893. #define BUTTON1_PIN 0
  894. #define BUTTON2_PIN 9
  895. #define BUTTON3_PIN 10
  896. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  897. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  898. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  899. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  900. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  901. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  902. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  903. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  904. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  905. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  906. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  907. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_RESET
  908. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  909. #define BUTTON3_PRESS BUTTON_ACTION_TOGGLE
  910. #define BUTTON3_CLICK BUTTON_ACTION_NONE
  911. #define BUTTON3_DBLCLICK BUTTON_ACTION_NONE
  912. #define BUTTON3_LNGCLICK BUTTON_ACTION_NONE
  913. #define BUTTON3_LNGLNGCLICK BUTTON_ACTION_RESET
  914. #define BUTTON1_RELAY 1
  915. #define BUTTON2_RELAY 2
  916. #define BUTTON3_RELAY 3
  917. // Relays
  918. #define RELAY1_PIN 12
  919. #define RELAY2_PIN 5
  920. #define RELAY3_PIN 4
  921. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  922. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  923. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  924. // LEDs
  925. #define LED1_PIN 13
  926. #define LED1_PIN_INVERSE 0
  927. // -----------------------------------------------------------------------------
  928. // Electrodragon boards
  929. // -----------------------------------------------------------------------------
  930. #elif defined(ELECTRODRAGON_WIFI_IOT)
  931. // Info
  932. #define MANUFACTURER "ELECTRODRAGON"
  933. #define DEVICE "WIFI_IOT"
  934. // Buttons
  935. #define BUTTON1_PIN 0
  936. #define BUTTON2_PIN 2
  937. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  938. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  939. #define BUTTON1_RELAY 1
  940. #define BUTTON2_RELAY 2
  941. // Relays
  942. #define RELAY1_PIN 12
  943. #define RELAY2_PIN 13
  944. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  945. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  946. // LEDs
  947. #define LED1_PIN 16
  948. #define LED1_PIN_INVERSE 0
  949. // -----------------------------------------------------------------------------
  950. // WorkChoice ecoPlug
  951. // -----------------------------------------------------------------------------
  952. #elif defined(WORKCHOICE_ECOPLUG)
  953. // Info
  954. #define MANUFACTURER "WORKCHOICE"
  955. #define DEVICE "ECOPLUG"
  956. // Buttons
  957. #define BUTTON1_PIN 13
  958. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  959. #define BUTTON1_RELAY 1
  960. // Relays
  961. #define RELAY1_PIN 15
  962. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  963. // LEDs
  964. #define LED1_PIN 2
  965. #define LED1_PIN_INVERSE 0
  966. // -----------------------------------------------------------------------------
  967. // AI Thinker
  968. // -----------------------------------------------------------------------------
  969. #elif defined(AITHINKER_AI_LIGHT)
  970. // Info
  971. #define MANUFACTURER "AITHINKER"
  972. #define DEVICE "AI_LIGHT"
  973. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  974. // Light
  975. #define LIGHT_CHANNELS 4
  976. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  977. #define MY92XX_CHIPS 1
  978. #define MY92XX_DI_PIN 13
  979. #define MY92XX_DCKI_PIN 15
  980. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  981. // -----------------------------------------------------------------------------
  982. // Lyasi LED
  983. // -----------------------------------------------------------------------------
  984. #elif defined(LYASI_LIGHT)
  985. // Info
  986. #define MANUFACTURER "LYASI"
  987. #define DEVICE "RGB_LED"
  988. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  989. // Light
  990. #define LIGHT_CHANNELS 4
  991. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  992. #define MY92XX_CHIPS 1
  993. #define MY92XX_DI_PIN 4
  994. #define MY92XX_DCKI_PIN 5
  995. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  996. // -----------------------------------------------------------------------------
  997. // LED Controller
  998. // -----------------------------------------------------------------------------
  999. #elif defined(MAGICHOME_LED_CONTROLLER)
  1000. // Info
  1001. #define MANUFACTURER "MAGICHOME"
  1002. #define DEVICE "LED_CONTROLLER"
  1003. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1004. // LEDs
  1005. #define LED1_PIN 2
  1006. #define LED1_PIN_INVERSE 1
  1007. // Light
  1008. #define LIGHT_CHANNELS 4
  1009. #define LIGHT_CH1_PIN 14 // RED
  1010. #define LIGHT_CH2_PIN 5 // GREEN
  1011. #define LIGHT_CH3_PIN 12 // BLUE
  1012. #define LIGHT_CH4_PIN 13 // WHITE
  1013. // IR
  1014. #define IR_SUPPORT 1
  1015. #define IR_RX_PIN 4
  1016. #define IR_BUTTON_SET 1
  1017. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  1018. // Info
  1019. #define MANUFACTURER "MAGICHOME"
  1020. #define DEVICE "LED_CONTROLLER_20"
  1021. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1022. // LEDs
  1023. #define LED1_PIN 2
  1024. #define LED1_PIN_INVERSE 1
  1025. // Light
  1026. #define LIGHT_CHANNELS 4
  1027. #define LIGHT_CH1_PIN 5 // RED
  1028. #define LIGHT_CH2_PIN 12 // GREEN
  1029. #define LIGHT_CH3_PIN 13 // BLUE
  1030. #define LIGHT_CH4_PIN 15 // WHITE
  1031. // IR
  1032. #define IR_SUPPORT 1
  1033. #define IR_RX_PIN 4
  1034. #define IR_BUTTON_SET 1
  1035. #elif defined(MAGICHOME_ZJ_WFMN_A_11)
  1036. // Info
  1037. #define MANUFACTURER "MAGICHOME"
  1038. #define DEVICE "ZJ_WFMN_A_11"
  1039. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1040. // LEDs
  1041. #define LED1_PIN 2
  1042. #define LED1_PIN_INVERSE 1
  1043. #define LED2_PIN 15
  1044. #define LED2_PIN_INVERSE 1
  1045. // Light
  1046. #define LIGHT_CHANNELS 4
  1047. #define LIGHT_CH1_PIN 12 // RED
  1048. #define LIGHT_CH2_PIN 5 // GREEN
  1049. #define LIGHT_CH3_PIN 13 // BLUE
  1050. #define LIGHT_CH4_PIN 14 // WHITE
  1051. // IR
  1052. #define IR_SUPPORT 1
  1053. #define IR_RX_PIN 4
  1054. #define IR_BUTTON_SET 1
  1055. #elif defined(MAGICHOME_ZJ_WFMN_B_11)
  1056. // Info
  1057. #define MANUFACTURER "MAGICHOME"
  1058. #define DEVICE "ZJ_WFMN_B_11"
  1059. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1060. // LEDs
  1061. #define LED1_PIN 2
  1062. #define LED1_PIN_INVERSE 1
  1063. #define LED2_PIN 15
  1064. #define LED2_PIN_INVERSE 1
  1065. // Light
  1066. #define LIGHT_CHANNELS 4
  1067. #define LIGHT_CH1_PIN 14 // RED
  1068. #define LIGHT_CH2_PIN 5 // GREEN
  1069. #define LIGHT_CH3_PIN 12 // BLUE
  1070. #define LIGHT_CH4_PIN 13 // WHITE
  1071. // RF
  1072. #define RFB_SUPPORT 1
  1073. #define RFB_PROVIDER RFB_PROVIDER_RCSWITCH
  1074. #define RFB_RX_PIN 4
  1075. #elif defined(MAGICHOME_ZJ_WFMN_C_11)
  1076. // Info
  1077. #define MANUFACTURER "MAGICHOME"
  1078. #define DEVICE "ZJ_WFMN_C_11"
  1079. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1080. // Buttons
  1081. #define BUTTON1_PIN 0
  1082. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1083. #define BUTTON1_RELAY 1
  1084. // LEDs
  1085. #define LED1_PIN 2
  1086. #define LED1_PIN_INVERSE 1
  1087. // Light
  1088. #define LIGHT_CHANNELS 1
  1089. #define LIGHT_CH1_PIN 12 // WHITE
  1090. #elif defined(MAGICHOME_ZJ_ESPM_5CH_B_13)
  1091. // Info
  1092. #define MANUFACTURER "MAGICHOME"
  1093. #define DEVICE "ZJ_ESPM_5CH_B_13"
  1094. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1095. // Buttons
  1096. #define BUTTON1_PIN 0
  1097. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1098. #define BUTTON1_RELAY 1
  1099. // LEDs
  1100. #define LED1_PIN 2
  1101. #define LED1_PIN_INVERSE 1
  1102. // Light
  1103. #define LIGHT_CHANNELS 5
  1104. #define LIGHT_CH1_PIN 14 // RED
  1105. #define LIGHT_CH2_PIN 12 // GREEN
  1106. #define LIGHT_CH3_PIN 13 // BLUE
  1107. #define LIGHT_CH4_PIN 5 // COLD WHITE
  1108. #define LIGHT_CH5_PIN 15 // WARM WHITE
  1109. #elif defined(MAGICHOME_ZJ_LB_RGBWW_L)
  1110. // Info
  1111. #define MANUFACTURER "MAGICHOME"
  1112. #define DEVICE "ZJ_LB_RGBWW_L"
  1113. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1114. // Light
  1115. #define LIGHT_CHANNELS 5
  1116. #define LIGHT_CH1_PIN 5 // RED
  1117. #define LIGHT_CH2_PIN 4 // GREEN
  1118. #define LIGHT_CH3_PIN 14 // BLUE
  1119. #define LIGHT_CH4_PIN 12 // COLD WHITE
  1120. #define LIGHT_CH5_PIN 13 // WARM WHITE
  1121. // -----------------------------------------------------------------------------
  1122. // HUACANXING H801 & H802
  1123. // -----------------------------------------------------------------------------
  1124. #elif defined(HUACANXING_H801)
  1125. // Info
  1126. #define MANUFACTURER "HUACANXING"
  1127. #define DEVICE "H801"
  1128. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1129. #define DEBUG_PORT Serial1
  1130. #define SERIAL_RX_ENABLED 1
  1131. // LEDs
  1132. #define LED1_PIN 5
  1133. #define LED1_PIN_INVERSE 1
  1134. // Light
  1135. #define LIGHT_CHANNELS 5
  1136. #define LIGHT_CH1_PIN 15 // RED
  1137. #define LIGHT_CH2_PIN 13 // GREEN
  1138. #define LIGHT_CH3_PIN 12 // BLUE
  1139. #define LIGHT_CH4_PIN 14 // WHITE1
  1140. #define LIGHT_CH5_PIN 4 // WHITE2
  1141. #elif defined(HUACANXING_H802)
  1142. // Info
  1143. #define MANUFACTURER "HUACANXING"
  1144. #define DEVICE "H802"
  1145. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1146. #define DEBUG_PORT Serial1
  1147. #define SERIAL_RX_ENABLED 1
  1148. // Light
  1149. #define LIGHT_CHANNELS 4
  1150. #define LIGHT_CH1_PIN 12 // RED
  1151. #define LIGHT_CH2_PIN 14 // GREEN
  1152. #define LIGHT_CH3_PIN 13 // BLUE
  1153. #define LIGHT_CH4_PIN 15 // WHITE
  1154. // -----------------------------------------------------------------------------
  1155. // HUGOAI AWP02L-N
  1156. // Pin equivalence extracted from https://templates.blakadder.com/hugoai_awp02l-n.html
  1157. //
  1158. // It follows almost same structure as AOYCOCR X5P with only 1 LED on GPIO02
  1159. //
  1160. // -----------------------------------------------------------------------------
  1161. #elif defined(HUGOAI_AWP02L_N)
  1162. #define MANUFACTURER "HUGOAI"
  1163. #define DEVICE "AWP02L_N"
  1164. // Buttons
  1165. #define BUTTON1_PIN 13
  1166. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1167. #define BUTTON1_RELAY 1
  1168. // the defaults are reasonable, but you can change them as desired
  1169. //#define BUTTON1_PRESS BUTTON_ACTION_NONE
  1170. //#define BUTTON1_CLICK BUTTON_ACTION_TOGGLE
  1171. //#define BUTTON1_DBLCLICK BUTTON_ACTION_AP
  1172. //#define BUTTON1_LNGCLICK BUTTON_ACTION_RESET
  1173. //#define BUTTON1_LNGLNGCLICK BUTTON_ACTION_FACTORY
  1174. // Relays
  1175. #define RELAY1_PIN 15
  1176. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1177. // LEDs
  1178. // LED1 (blue) indicates on/off state; you could use LED_MODE_FOLLOW_INVERSE
  1179. // so that the LED lights the button when 'off' so it can be found easily.
  1180. #define LED1_PIN 2
  1181. #define LED1_PIN_INVERSE 1
  1182. #define LED1_MODE LED_MODE_FOLLOW
  1183. #define LED1_RELAY 1
  1184. // -----------------------------------------------------------------------------
  1185. // Jan Goedeke Wifi Relay
  1186. // https://github.com/JanGoe/esp8266-wifi-relay
  1187. // -----------------------------------------------------------------------------
  1188. #elif defined(JANGOE_WIFI_RELAY_NC)
  1189. // Info
  1190. #define MANUFACTURER "JANGOE"
  1191. #define DEVICE "WIFI_RELAY_NC"
  1192. // Buttons
  1193. #define BUTTON1_PIN 12
  1194. #define BUTTON2_PIN 13
  1195. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1196. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1197. #define BUTTON1_RELAY 1
  1198. #define BUTTON2_RELAY 2
  1199. // Relays
  1200. #define RELAY1_PIN 2
  1201. #define RELAY2_PIN 14
  1202. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  1203. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  1204. #elif defined(JANGOE_WIFI_RELAY_NO)
  1205. // Info
  1206. #define MANUFACTURER "JANGOE"
  1207. #define DEVICE "WIFI_RELAY_NO"
  1208. // Buttons
  1209. #define BUTTON1_PIN 12
  1210. #define BUTTON2_PIN 13
  1211. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1212. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1213. #define BUTTON1_RELAY 1
  1214. #define BUTTON2_RELAY 2
  1215. // Relays
  1216. #define RELAY1_PIN 2
  1217. #define RELAY2_PIN 14
  1218. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1219. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1220. // -----------------------------------------------------------------------------
  1221. // Jorge García Wifi+Relays Board Kit
  1222. // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
  1223. // https://github.com/jorgegarciadev/wifikit
  1224. // -----------------------------------------------------------------------------
  1225. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  1226. // Info
  1227. #define MANUFACTURER "JORGEGARCIA"
  1228. #define DEVICE "WIFI_RELAYS"
  1229. // Relays
  1230. #define RELAY1_PIN 0
  1231. #define RELAY2_PIN 2
  1232. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  1233. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  1234. // -----------------------------------------------------------------------------
  1235. // WiFi MQTT Relay / Thermostat
  1236. // -----------------------------------------------------------------------------
  1237. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  1238. // Info
  1239. #define MANUFACTURER "OPENENERGYMONITOR"
  1240. #define DEVICE "MQTT_RELAY"
  1241. // Buttons
  1242. #define BUTTON1_PIN 0
  1243. #define BUTTON1_RELAY 1
  1244. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1245. // Relays
  1246. #define RELAY1_PIN 12
  1247. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1248. // LEDs
  1249. #define LED1_PIN 16
  1250. #define LED1_PIN_INVERSE 0
  1251. // -----------------------------------------------------------------------------
  1252. // WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap
  1253. // https://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_id=114&ipn=icep&toolid=20004&campid=5338044841&mpre=http%3A%2F%2Fwww.ebay.com%2Fitm%2FWiOn-50050-Indoor-Wi-Fi-Outlet-Wireless-Switch-Programmable-Timer-%2F263112281551
  1254. // https://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_id=114&ipn=icep&toolid=20004&campid=5338044841&mpre=http%3A%2F%2Fwww.ebay.com%2Fitm%2FWiOn-50055-Indoor-Wi-Fi-Wall-Tap-Monitor-Energy-Usage-Wireless-Smart-Switch-%2F263020837777
  1255. // -----------------------------------------------------------------------------
  1256. #elif defined(WION_50055)
  1257. // Currently untested, does not support energy monitoring
  1258. // Info
  1259. #define MANUFACTURER "WION"
  1260. #define DEVICE "50055"
  1261. // Buttons
  1262. #define BUTTON1_PIN 13
  1263. #define BUTTON1_RELAY 1
  1264. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1265. // Relays
  1266. #define RELAY1_PIN 15
  1267. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1268. // LEDs
  1269. #define LED1_PIN 2
  1270. #define LED1_PIN_INVERSE 0
  1271. // -----------------------------------------------------------------------------
  1272. // EX-Store Wifi Relay v3.1
  1273. // https://ex-store.de/ESP8266-WiFi-Relay-V31
  1274. // -----------------------------------------------------------------------------
  1275. #elif defined(EXS_WIFI_RELAY_V31)
  1276. // Untested
  1277. // Info
  1278. #define MANUFACTURER "EXS"
  1279. #define DEVICE "WIFI_RELAY_V31"
  1280. // Buttons
  1281. #define BUTTON1_PIN 0
  1282. #define BUTTON1_RELAY 1
  1283. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1284. // Relays
  1285. #define RELAY1_PIN 13
  1286. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  1287. #define RELAY1_RESET_PIN 12
  1288. // -----------------------------------------------------------------------------
  1289. // EX-Store Wifi Relay v5.0
  1290. // -----------------------------------------------------------------------------
  1291. #elif defined(EXS_WIFI_RELAY_V50)
  1292. // Info
  1293. #define MANUFACTURER "EXS"
  1294. #define DEVICE "WIFI_RELAY_V50"
  1295. // Buttons
  1296. #define BUTTON1_PIN 5
  1297. #define BUTTON1_RELAY 1
  1298. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT | BUTTON_SET_PULLUP
  1299. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  1300. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  1301. #define BUTTON2_PIN 4
  1302. #define BUTTON2_RELAY 2
  1303. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT | BUTTON_SET_PULLUP
  1304. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  1305. #define BUTTON2_RELEASE BUTTON_ACTION_TOGGLE
  1306. // Relays
  1307. #define RELAY1_PIN 14
  1308. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  1309. #define RELAY1_RESET_PIN 16
  1310. #define RELAY2_PIN 13
  1311. #define RELAY2_TYPE RELAY_TYPE_LATCHED
  1312. #define RELAY2_RESET_PIN 12
  1313. // LEDs
  1314. #define LED1_PIN 15
  1315. #define LED1_PIN_INVERSE 0
  1316. // -----------------------------------------------------------------------------
  1317. // V9261F
  1318. // -----------------------------------------------------------------------------
  1319. #elif defined(GENERIC_V9261F)
  1320. // Info
  1321. #define MANUFACTURER "GENERIC"
  1322. #define DEVICE "V9261F"
  1323. #define ALEXA_SUPPORT 0
  1324. // V9261F
  1325. #define V9261F_SUPPORT 1
  1326. #define V9261F_PIN 2
  1327. #define V9261F_PIN_INVERSE 1
  1328. // -----------------------------------------------------------------------------
  1329. // ECH1560
  1330. // -----------------------------------------------------------------------------
  1331. #elif defined(GENERIC_ECH1560)
  1332. // Info
  1333. #define MANUFACTURER "GENERIC"
  1334. #define DEVICE "ECH1560"
  1335. #define ALEXA_SUPPORT 0
  1336. // ECH1560
  1337. #define ECH1560_SUPPORT 1
  1338. #define ECH1560_CLK_PIN 4
  1339. #define ECH1560_MISO_PIN 5
  1340. #define ECH1560_INVERTED 0
  1341. // -----------------------------------------------------------------------------
  1342. // PZEM004T
  1343. // -----------------------------------------------------------------------------
  1344. #elif defined(GENERIC_PZEM004T)
  1345. // Info
  1346. #define MANUFACTURER "GENERIC"
  1347. #define DEVICE "PZEM004T"
  1348. #define PZEM004T_SUPPORT 1
  1349. #define ALEXA_SUPPORT 0
  1350. #define DEBUG_SERIAL_SUPPORT 0
  1351. // -----------------------------------------------------------------------------
  1352. // ESP-01 generic esp8266 board with 512 kB flash
  1353. // -----------------------------------------------------------------------------
  1354. #elif defined(GENERIC_ESP01_512KB)
  1355. // Info
  1356. #define MANUFACTURER "GENERIC"
  1357. #define DEVICE "ESP01_512KB"
  1358. // Relays
  1359. #define RELAY1_PIN 2
  1360. #ifndef RELAY1_TYPE
  1361. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1362. #endif
  1363. // No need for OTA
  1364. #define OTA_WEB_SUPPORT 0
  1365. #define OTA_ARDUINOOTA_SUPPORT 0
  1366. #define OTA_CLIENT OTA_CLIENT_NONE
  1367. // Web UI blob & MDNS are pretty large
  1368. #define WEB_EMBEDDED 0
  1369. #define MDNS_SERVER_SUPPORT 0
  1370. // -----------------------------------------------------------------------------
  1371. // ESPLive
  1372. // https://github.com/ManCaveMade/ESP-Live
  1373. // -----------------------------------------------------------------------------
  1374. #elif defined(MANCAVEMADE_ESPLIVE)
  1375. // Info
  1376. #define MANUFACTURER "MANCAVEMADE"
  1377. #define DEVICE "ESPLIVE"
  1378. // Buttons
  1379. #define BUTTON1_PIN 4
  1380. #define BUTTON2_PIN 5
  1381. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1382. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1383. #define BUTTON1_RELAY 1
  1384. #define BUTTON2_RELAY 2
  1385. // Relays
  1386. #define RELAY1_PIN 12
  1387. #define RELAY2_PIN 13
  1388. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1389. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1390. // DS18B20
  1391. #ifndef DALLAS_SUPPORT
  1392. #define DALLAS_SUPPORT 1
  1393. #endif
  1394. #define DALLAS_PIN 2
  1395. #define DALLAS_UPDATE_INTERVAL 5000
  1396. #define TEMPERATURE_MIN_CHANGE 1.0
  1397. // -----------------------------------------------------------------------------
  1398. // QuinLED
  1399. // http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html
  1400. // -----------------------------------------------------------------------------
  1401. #elif defined(INTERMITTECH_QUINLED)
  1402. // Info
  1403. #define MANUFACTURER "INTERMITTECH"
  1404. #define DEVICE "QUINLED"
  1405. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1406. // LEDs
  1407. #define LED1_PIN 5
  1408. #define LED1_PIN_INVERSE 1
  1409. // Light
  1410. #define LIGHT_CHANNELS 2
  1411. #define LIGHT_CH1_PIN 0
  1412. #define LIGHT_CH2_PIN 2
  1413. // -----------------------------------------------------------------------------
  1414. // Arilux AL-LC06
  1415. // -----------------------------------------------------------------------------
  1416. #elif defined(ARILUX_AL_LC01)
  1417. // Info
  1418. #define MANUFACTURER "ARILUX"
  1419. #define DEVICE "AL_LC01"
  1420. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1421. // Light
  1422. #define LIGHT_CHANNELS 3
  1423. #define LIGHT_CH1_PIN 5 // RED
  1424. #define LIGHT_CH2_PIN 12 // GREEN
  1425. #define LIGHT_CH3_PIN 13 // BLUE
  1426. #elif defined(ARILUX_AL_LC02)
  1427. // Info
  1428. #define MANUFACTURER "ARILUX"
  1429. #define DEVICE "AL_LC02"
  1430. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1431. // Light
  1432. #define LIGHT_CHANNELS 4
  1433. #define LIGHT_CH1_PIN 12 // RED
  1434. #define LIGHT_CH2_PIN 5 // GREEN
  1435. #define LIGHT_CH3_PIN 13 // BLUE
  1436. #define LIGHT_CH4_PIN 15 // WHITE1
  1437. #elif defined(ARILUX_AL_LC02_V14)
  1438. // Info
  1439. #define MANUFACTURER "ARILUX"
  1440. #define DEVICE "AL_LC02_V14"
  1441. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1442. // Light
  1443. #define LIGHT_CHANNELS 4
  1444. #define LIGHT_CH1_PIN 14 // RED
  1445. #define LIGHT_CH2_PIN 5 // GREEN
  1446. #define LIGHT_CH3_PIN 12 // BLUE
  1447. #define LIGHT_CH4_PIN 13 // WHITE1
  1448. #elif defined(ARILUX_AL_LC06)
  1449. // Info
  1450. #define MANUFACTURER "ARILUX"
  1451. #define DEVICE "AL_LC06"
  1452. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1453. // Buttons
  1454. #define BUTTON1_PIN 0
  1455. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1456. #define BUTTON1_RELAY 1
  1457. // Light
  1458. #define LIGHT_CHANNELS 5
  1459. #define LIGHT_CH1_PIN 14 // RED
  1460. #define LIGHT_CH2_PIN 12 // GREEN
  1461. #define LIGHT_CH3_PIN 13 // BLUE
  1462. #define LIGHT_CH4_PIN 15 // WHITE1
  1463. #define LIGHT_CH5_PIN 5 // WHITE2
  1464. #elif defined(ARILUX_AL_LC11)
  1465. // Info
  1466. #define MANUFACTURER "ARILUX"
  1467. #define DEVICE "AL_LC11"
  1468. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1469. // Light
  1470. #define LIGHT_CHANNELS 5
  1471. #define LIGHT_CH1_PIN 5 // RED
  1472. #define LIGHT_CH2_PIN 4 // GREEN
  1473. #define LIGHT_CH3_PIN 14 // BLUE
  1474. #define LIGHT_CH4_PIN 13 // WHITE1
  1475. #define LIGHT_CH5_PIN 12 // WHITE1
  1476. #elif defined(ARILUX_E27)
  1477. // Info
  1478. #define MANUFACTURER "ARILUX"
  1479. #define DEVICE "E27"
  1480. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  1481. // Light
  1482. #define LIGHT_CHANNELS 4
  1483. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  1484. #define MY92XX_CHIPS 1
  1485. #define MY92XX_DI_PIN 13
  1486. #define MY92XX_DCKI_PIN 15
  1487. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  1488. // -----------------------------------------------------------------------------
  1489. // XENON SM-PW701U
  1490. // -----------------------------------------------------------------------------
  1491. #elif defined(XENON_SM_PW702U)
  1492. // Info
  1493. #define MANUFACTURER "XENON"
  1494. #define DEVICE "SM_PW702U"
  1495. // Buttons
  1496. #define BUTTON1_PIN 13
  1497. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1498. #define BUTTON1_RELAY 1
  1499. // Relays
  1500. #define RELAY1_PIN 12
  1501. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1502. // LEDs
  1503. #define LED1_PIN 4
  1504. #define LED1_PIN_INVERSE 1
  1505. // -----------------------------------------------------------------------------
  1506. // ISELECTOR SM-PW702
  1507. // -----------------------------------------------------------------------------
  1508. #elif defined(ISELECTOR_SM_PW702)
  1509. // Info
  1510. #define MANUFACTURER "ISELECTOR"
  1511. #define DEVICE "SM_PW702"
  1512. // Buttons
  1513. #define BUTTON1_PIN 13
  1514. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1515. #define BUTTON1_RELAY 1
  1516. // Relays
  1517. #define RELAY1_PIN 12
  1518. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1519. // LEDs
  1520. #define LED1_PIN 4 //BLUE
  1521. #define LED1_PIN_INVERSE 0
  1522. #define LED2_PIN 5 //RED
  1523. #define LED2_PIN_INVERSE 1
  1524. // -----------------------------------------------------------------------------
  1525. // AUTHOMETION LYT8266
  1526. // https://authometion.com/shop/en/home/13-lyt8266.html
  1527. // -----------------------------------------------------------------------------
  1528. #elif defined(AUTHOMETION_LYT8266)
  1529. // Info
  1530. #define MANUFACTURER "AUTHOMETION"
  1531. #define DEVICE "LYT8266"
  1532. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1533. // Light
  1534. #define LIGHT_CHANNELS 4
  1535. #define LIGHT_CH1_PIN 13 // RED
  1536. #define LIGHT_CH2_PIN 12 // GREEN
  1537. #define LIGHT_CH3_PIN 14 // BLUE
  1538. #define LIGHT_CH4_PIN 2 // WHITE
  1539. #define LIGHT_ENABLE_PIN 15
  1540. #elif defined(GIZWITS_WITTY_CLOUD)
  1541. // Info
  1542. #define MANUFACTURER "GIZWITS"
  1543. #define DEVICE "WITTY_CLOUD"
  1544. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1545. // Buttons
  1546. #define BUTTON1_PIN 4
  1547. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1548. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  1549. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  1550. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  1551. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  1552. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  1553. #define ANALOG_SUPPORT 1
  1554. // LEDs
  1555. #define LED1_PIN 2 // BLUE build-in
  1556. #define LED1_PIN_INVERSE 1
  1557. // Light
  1558. #define LIGHT_CHANNELS 3
  1559. #define LIGHT_CH1_PIN 15 // RED
  1560. #define LIGHT_CH2_PIN 12 // GREEN
  1561. #define LIGHT_CH3_PIN 13 // BLUE
  1562. // -----------------------------------------------------------------------------
  1563. // KMC 70011
  1564. // https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B
  1565. // -----------------------------------------------------------------------------
  1566. #elif defined(KMC_70011)
  1567. // Info
  1568. #define MANUFACTURER "KMC"
  1569. #define DEVICE "70011"
  1570. // Buttons
  1571. #define BUTTON1_PIN 0
  1572. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1573. #define BUTTON1_RELAY 1
  1574. // Relays
  1575. #define RELAY1_PIN 14
  1576. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1577. // LEDs
  1578. #define LED1_PIN 13
  1579. #define LED1_PIN_INVERSE 1
  1580. // HLW8012
  1581. #ifndef HLW8012_SUPPORT
  1582. #define HLW8012_SUPPORT 1
  1583. #endif
  1584. #define HLW8012_SEL_PIN 12
  1585. #define HLW8012_CF1_PIN 5
  1586. #define HLW8012_CF_PIN 4
  1587. #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor
  1588. // -----------------------------------------------------------------------------
  1589. // Euromate (?) Wifi Stecker Schuko
  1590. // https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706
  1591. // Thanks to @Geitde
  1592. // -----------------------------------------------------------------------------
  1593. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  1594. // Info
  1595. #define MANUFACTURER "EUROMATE"
  1596. #define DEVICE "WIFI_STECKER_SCHUKO"
  1597. // Buttons
  1598. #define BUTTON1_PIN 14
  1599. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1600. #define BUTTON1_RELAY 1
  1601. // The relay in the device is not a bistable (latched) relay.
  1602. // The device is reported to have a flip-flop circuit to drive the relay
  1603. // So @Geitde hack is still the only possible
  1604. // Hack: drive GPIO12 low and use GPIO5 as normal relay pin:
  1605. #define RELAY1_PIN 5
  1606. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1607. #define LED2_PIN 12 /* DUMMY: exploit default off state for GPIO12=low */
  1608. #define LED2_PIN_INVERSE 0
  1609. // LEDs
  1610. #define LED1_PIN 4
  1611. #define LED1_PIN_INVERSE 0
  1612. // -----------------------------------------------------------------------------
  1613. // Euromate (?) Wifi Stecker Schuko Version 2
  1614. // This configuration is for the second generation of devices sold by OBI.
  1615. // https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko-weiss/p/4077806
  1616. // -----------------------------------------------------------------------------
  1617. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO_V2)
  1618. // Info
  1619. #define MANUFACTURER "EUROMATE"
  1620. #define DEVICE "WIFI_STECKER_SCHUKO_V2"
  1621. // Buttons
  1622. #define BUTTON1_PIN 5
  1623. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1624. #define BUTTON1_RELAY 1
  1625. // Relays
  1626. #define RELAY1_PIN 4
  1627. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1628. // Green
  1629. #define LED1_PIN 12
  1630. #define LED1_MODE LED_MODE_WIFI
  1631. #define LED1_PIN_INVERSE 0
  1632. // Red
  1633. #define LED2_PIN 13
  1634. #define LED2_MODE LED_MODE_RELAY
  1635. #define LED2_PIN_INVERSE 0
  1636. // -----------------------------------------------------------------------------
  1637. // Generic 8CH
  1638. // -----------------------------------------------------------------------------
  1639. #elif defined(GENERIC_8CH)
  1640. // Info
  1641. #define MANUFACTURER "GENERIC"
  1642. #define DEVICE "8CH"
  1643. // Relays
  1644. #define RELAY1_PIN 0
  1645. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1646. #define RELAY2_PIN 2
  1647. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1648. #define RELAY3_PIN 4
  1649. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  1650. #define RELAY4_PIN 5
  1651. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  1652. #define RELAY5_PIN 12
  1653. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  1654. #define RELAY6_PIN 13
  1655. #define RELAY6_TYPE RELAY_TYPE_NORMAL
  1656. #define RELAY7_PIN 14
  1657. #define RELAY7_TYPE RELAY_TYPE_NORMAL
  1658. #define RELAY8_PIN 15
  1659. #define RELAY8_TYPE RELAY_TYPE_NORMAL
  1660. // -----------------------------------------------------------------------------
  1661. // STM RELAY
  1662. // -----------------------------------------------------------------------------
  1663. #elif defined(STM_RELAY)
  1664. // Info
  1665. #define MANUFACTURER "STM_RELAY"
  1666. #define DEVICE "2CH"
  1667. // Relays
  1668. #define RELAY_PROVIDER_STM_SUPPORT 1
  1669. #define RELAY1_PROVIDER RELAY_PROVIDER_STM
  1670. #define RELAY2_PROVIDER RELAY_PROVIDER_STM
  1671. // Make sure we space out serial writes when relays are in sync. ref:
  1672. // - https://github.com/xoseperez/espurna/issues/1130
  1673. // - https://github.com/xoseperez/espurna/issues/1519
  1674. // - https://github.com/xoseperez/espurna/pull/1520
  1675. #define RELAY_DELAY_INTERLOCK 100
  1676. // Remove UART noise on serial line
  1677. // (or use `#define DEBUG_PORT Serial1` instead)
  1678. #define DEBUG_SERIAL_SUPPORT 0
  1679. // -----------------------------------------------------------------------------
  1680. // Tonbux Powerstrip02
  1681. // -----------------------------------------------------------------------------
  1682. #elif defined(TONBUX_POWERSTRIP02)
  1683. // Info
  1684. #define MANUFACTURER "TONBUX"
  1685. #define DEVICE "POWERSTRIP02"
  1686. // Buttons
  1687. #define BUTTON1_PIN 5
  1688. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1689. #define BUTTON1_RELAY 0
  1690. // Relays
  1691. #define RELAY1_PIN 4
  1692. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  1693. #define RELAY2_PIN 13
  1694. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  1695. #define RELAY3_PIN 12
  1696. #define RELAY3_TYPE RELAY_TYPE_INVERSE
  1697. #define RELAY4_PIN 14
  1698. #define RELAY4_TYPE RELAY_TYPE_INVERSE
  1699. // Not a relay. USB ports on/off
  1700. #define RELAY5_PIN 16
  1701. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  1702. // LEDs
  1703. #define LED1_PIN 0 // 1 blue led
  1704. #define LED1_PIN_INVERSE 1
  1705. #define LED2_PIN 3 // 3 red leds
  1706. #define LED2_PIN_INVERSE 1
  1707. // -----------------------------------------------------------------------------
  1708. // Lingan SWA1
  1709. // -----------------------------------------------------------------------------
  1710. #elif defined(LINGAN_SWA1)
  1711. // Info
  1712. #define MANUFACTURER "LINGAN"
  1713. #define DEVICE "SWA1"
  1714. // Buttons
  1715. #define BUTTON1_PIN 13
  1716. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1717. #define BUTTON1_RELAY 1
  1718. // Relays
  1719. #define RELAY1_PIN 5
  1720. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1721. // LEDs
  1722. #define LED1_PIN 4
  1723. #define LED1_PIN_INVERSE 1
  1724. // -----------------------------------------------------------------------------
  1725. // HEYGO HY02
  1726. // -----------------------------------------------------------------------------
  1727. #elif defined(HEYGO_HY02)
  1728. // Info
  1729. #define MANUFACTURER "HEYGO"
  1730. #define DEVICE "HY02"
  1731. // Buttons
  1732. #define BUTTON1_PIN 13
  1733. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1734. #define BUTTON1_RELAY 1
  1735. // Relays
  1736. #define RELAY1_PIN 12
  1737. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1738. // LEDs
  1739. #define LED1_PIN 4
  1740. #define LED1_PIN_INVERSE 0
  1741. // -----------------------------------------------------------------------------
  1742. // Maxcio W-US002S
  1743. // -----------------------------------------------------------------------------
  1744. #elif defined(MAXCIO_WUS002S)
  1745. // Info
  1746. #define MANUFACTURER "MAXCIO"
  1747. #define DEVICE "WUS002S"
  1748. // Buttons
  1749. #define BUTTON1_PIN 2
  1750. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1751. #define BUTTON1_RELAY 1
  1752. // Relays
  1753. #define RELAY1_PIN 13
  1754. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1755. // LEDs
  1756. #define LED1_PIN 3
  1757. #define LED1_PIN_INVERSE 0
  1758. // HLW8012
  1759. #ifndef HLW8012_SUPPORT
  1760. #define HLW8012_SUPPORT 1
  1761. #endif
  1762. #define HLW8012_SEL_PIN 12
  1763. #define HLW8012_CF1_PIN 5
  1764. #define HLW8012_CF_PIN 4
  1765. #define HLW8012_CURRENT_R 0.002 // Current resistor
  1766. #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor
  1767. // LED1 on RX pin
  1768. #define DEBUG_SERIAL_SUPPORT 1
  1769. // -----------------------------------------------------------------------------
  1770. // Maxcio W-DE004
  1771. // -----------------------------------------------------------------------------
  1772. #elif defined(MAXCIO_WDE004)
  1773. // Info
  1774. #define MANUFACTURER "MAXCIO"
  1775. #define DEVICE "WDE004"
  1776. // Buttons
  1777. #define BUTTON1_PIN 1
  1778. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1779. #define BUTTON1_RELAY 1
  1780. // Relays
  1781. #define RELAY1_PIN 14
  1782. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1783. // LEDs
  1784. #define LED1_PIN 13
  1785. #define LED1_PIN_INVERSE 1
  1786. // -----------------------------------------------------------------------------
  1787. // Maxcio W-UK007S
  1788. // Like this: https://www.amazon.co.uk/Maxcio-Monitoring-Function-Compatible-Required/dp/B07BWFB55Q/ref=pd_rhf_se_p_img_2?_encoding=UTF8&psc=1&refRID=4H63A43SKHV8WV54XH19
  1789. // -----------------------------------------------------------------------------
  1790. #elif defined(MAXCIO_WUK007S)
  1791. // Info
  1792. #define MANUFACTURER "MAXCIO"
  1793. #define DEVICE "WUK007S"
  1794. // Buttons
  1795. #define BUTTON1_PIN 13
  1796. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1797. #define BUTTON1_RELAY 1
  1798. // Relays
  1799. #define RELAY1_PIN 15
  1800. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1801. // LEDs
  1802. #define LED1_PIN 0
  1803. #define LED1_PIN_INVERSE 0
  1804. #define LED1_RELAY 1
  1805. #define LED1_MODE LED_MODE_RELAY_WIFI
  1806. // HJL01 / BL0937
  1807. #ifndef HLW8012_SUPPORT
  1808. #define HLW8012_SUPPORT 1
  1809. #endif
  1810. #define HLW8012_SEL_PIN 12
  1811. #define HLW8012_CF1_PIN 14
  1812. #define HLW8012_CF_PIN 5
  1813. #define HLW8012_SEL_CURRENT LOW
  1814. #define HLW8012_CURRENT_RATIO 24380
  1815. #define HLW8012_VOLTAGE_RATIO 32048
  1816. #define HLW8012_POWER_RATIO 3509285
  1817. #define HLW8012_INTERRUPT_ON FALLING
  1818. // -----------------------------------------------------------------------------
  1819. // Oukitel P1 Smart Plug
  1820. // https://www.amazon.com/Docooler-OUKITEL-Control-Wireless-Adaptor/dp/B07J3BYFJX/ref=sr_1_fkmrnull_2?keywords=oukitel+p1+smart+switch&qid=1550424399&s=gateway&sr=8-2-fkmrnull
  1821. // -----------------------------------------------------------------------------
  1822. #elif defined(OUKITEL_P1)
  1823. // Info
  1824. #define MANUFACTURER "Oukitel"
  1825. #define DEVICE "P1"
  1826. // Buttons
  1827. #define BUTTON1_PIN 13
  1828. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1829. #define BUTTON1_RELAY 1
  1830. // Relays
  1831. // Right
  1832. #define RELAY1_PIN 12
  1833. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1834. // Left
  1835. #define RELAY2_PIN 15
  1836. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1837. // LEDs
  1838. #define LED1_PIN 0 // blue
  1839. #define LED1_PIN_INVERSE 1
  1840. #define LED1_MODE LED_MODE_WIFI
  1841. // -----------------------------------------------------------------------------
  1842. // YiDian XS-SSA05
  1843. // -----------------------------------------------------------------------------
  1844. #elif defined(YIDIAN_XSSSA05)
  1845. // Info
  1846. #define MANUFACTURER "YIDIAN"
  1847. #define DEVICE "XSSSA05"
  1848. // Buttons
  1849. #define BUTTON1_PIN 13
  1850. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1851. #define BUTTON1_RELAY 1
  1852. // Relays
  1853. #define RELAY1_PIN 12
  1854. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1855. // LEDs
  1856. #define LED1_PIN 0 // red
  1857. #define LED1_PIN_INVERSE 1
  1858. #define LED1_MODE LED_MODE_WIFI
  1859. #define LED2_PIN 15 // blue
  1860. #define LED2_PIN_INVERSE 1
  1861. #define LED2_MODE LED_MODE_RELAY
  1862. // HLW8012
  1863. #ifndef HLW8012_SUPPORT
  1864. #define HLW8012_SUPPORT 1
  1865. #endif
  1866. #define HLW8012_SEL_PIN 3
  1867. #define HLW8012_CF1_PIN 14
  1868. #define HLW8012_CF_PIN 5
  1869. #define HLW8012_SEL_CURRENT LOW
  1870. #define HLW8012_CURRENT_RATIO 25740
  1871. #define HLW8012_VOLTAGE_RATIO 313400
  1872. #define HLW8012_POWER_RATIO 3414290
  1873. #define HLW8012_INTERRUPT_ON FALLING
  1874. // -----------------------------------------------------------------------------
  1875. // TONBUX XS-SSA01
  1876. // -----------------------------------------------------------------------------
  1877. #elif defined(TONBUX_XSSSA01)
  1878. // Info
  1879. #define MANUFACTURER "TONBUX"
  1880. #define DEVICE "XSSSA01"
  1881. // Buttons
  1882. #define BUTTON1_PIN 4
  1883. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1884. #define BUTTON1_RELAY 1
  1885. // Relays
  1886. #define RELAY1_PIN 14
  1887. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1888. // LEDs
  1889. #define LED1_PIN 13
  1890. #define LED1_PIN_INVERSE 0
  1891. // -----------------------------------------------------------------------------
  1892. // TONBUX XS-SSA06
  1893. // -----------------------------------------------------------------------------
  1894. #elif defined(TONBUX_XSSSA06)
  1895. // Info
  1896. #define MANUFACTURER "TONBUX"
  1897. #define DEVICE "XSSSA06"
  1898. // Buttons
  1899. #define BUTTON1_PIN 13
  1900. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1901. #define BUTTON1_RELAY 1
  1902. // Relays
  1903. #define RELAY1_PIN 15
  1904. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1905. // LEDs
  1906. #define LED1_PIN 0 // R - 8 rgb led ring
  1907. #define LED1_PIN_INVERSE 0
  1908. #define LED2_PIN 5 // G
  1909. #define LED2_PIN_INVERSE 0
  1910. #define LED3_PIN 2 // B
  1911. #define LED3_PIN_INVERSE 0
  1912. // -----------------------------------------------------------------------------
  1913. // GREEN ESP8266 RELAY MODULE
  1914. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266
  1915. // -----------------------------------------------------------------------------
  1916. #elif defined(GREEN_ESP8266RELAY)
  1917. // Info
  1918. #define MANUFACTURER "GREEN"
  1919. #define DEVICE "ESP8266RELAY"
  1920. // Buttons
  1921. // Not a button but input via Optocoupler
  1922. #define BUTTON1_PIN 5
  1923. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1924. #define BUTTON1_RELAY 1
  1925. // Relays
  1926. #define RELAY1_PIN 4
  1927. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1928. // LEDs
  1929. #define LED1_PIN 2
  1930. #define LED1_PIN_INVERSE 1
  1931. // -----------------------------------------------------------------------------
  1932. // Henrique Gravina ESPIKE
  1933. // https://github.com/Henriquegravina/Espike
  1934. // -----------------------------------------------------------------------------
  1935. #elif defined(IKE_ESPIKE)
  1936. #define MANUFACTURER "IKE"
  1937. #define DEVICE "ESPIKE"
  1938. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_NONE
  1939. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  1940. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  1941. #define BUTTON1_PIN 13
  1942. #define BUTTON1_RELAY 1
  1943. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1944. #define BUTTON2_PIN 12
  1945. #define BUTTON2_RELAY 2
  1946. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1947. #define BUTTON3_PIN 14
  1948. #define BUTTON3_RELAY 3
  1949. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1950. #define RELAY1_PIN 4
  1951. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1952. #define RELAY2_PIN 5
  1953. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1954. #define RELAY3_PIN 16
  1955. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  1956. #define LED1_PIN 2
  1957. #define LED1_PIN_INVERSE 1
  1958. // -----------------------------------------------------------------------------
  1959. // SWIFITCH
  1960. // https://github.com/ArnieX/swifitch
  1961. // -----------------------------------------------------------------------------
  1962. #elif defined(ARNIEX_SWIFITCH)
  1963. // Info
  1964. #define MANUFACTURER "ARNIEX"
  1965. #define DEVICE "SWIFITCH"
  1966. // Buttons
  1967. #define BUTTON1_PIN 4 // D2
  1968. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_BOOT
  1969. #define BUTTON1_RELAY 1
  1970. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  1971. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  1972. // Relays
  1973. #define RELAY1_PIN 5 // D1
  1974. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  1975. // LEDs
  1976. #define LED1_PIN 12 // D6
  1977. #define LED1_PIN_INVERSE 1
  1978. // -----------------------------------------------------------------------------
  1979. // ESP-01S RELAY v4.0
  1980. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
  1981. // -----------------------------------------------------------------------------
  1982. #elif defined(GENERIC_ESP01S_RELAY_V40)
  1983. // Info
  1984. #define MANUFACTURER "GENERIC"
  1985. #define DEVICE "ESP01S_RELAY_40"
  1986. // Relays
  1987. #define RELAY1_PIN 0
  1988. #ifndef RELAY1_TYPE
  1989. #define RELAY1_TYPE RELAY_TYPE_NORMAL // See #1504 and #1554
  1990. #endif
  1991. // LEDs
  1992. #define LED1_PIN 2
  1993. #define LED1_PIN_INVERSE 0
  1994. // -----------------------------------------------------------------------------
  1995. // ESP-01S RGB LED v1.0 (some sold with ws2818)
  1996. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
  1997. // -----------------------------------------------------------------------------
  1998. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  1999. // Info
  2000. #define MANUFACTURER "GENERIC"
  2001. #define DEVICE "ESP01S_RGBLED_10"
  2002. // This board is sold as RGB LED module BUT it has on board 3 pin ph2.0 connector (VCC, GPIO2, GND)
  2003. // so, if you wish, you may connect LED, BUTTON, RELAY, SENSOR etc.
  2004. // Buttons
  2005. //#define BUTTON1_PIN 2
  2006. // Relays
  2007. //#define RELAY1_PIN 2
  2008. // LEDs
  2009. #define LED1_PIN 2
  2010. #define LED1_PIN_INVERSE 0
  2011. // -----------------------------------------------------------------------------
  2012. // ESP-01S DHT11 v1.0
  2013. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
  2014. // -----------------------------------------------------------------------------
  2015. #elif defined(GENERIC_ESP01S_DHT11_V10)
  2016. // Info
  2017. #define MANUFACTURER "GENERIC"
  2018. #define DEVICE "ESP01S_DHT11_10"
  2019. // DHT11
  2020. #ifndef DHT_SUPPORT
  2021. #define DHT_SUPPORT 1
  2022. #endif
  2023. #define DHT_PIN 2
  2024. #define DHT_TYPE DHT_CHIP_DHT11
  2025. // -----------------------------------------------------------------------------
  2026. // ESP-01S DS18B20 v1.0
  2027. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
  2028. // -----------------------------------------------------------------------------
  2029. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  2030. // Info
  2031. #define MANUFACTURER "GENERIC"
  2032. #define DEVICE "ESP01S_DS18B20_10"
  2033. // DB18B20
  2034. #ifndef DALLAS_SUPPORT
  2035. #define DALLAS_SUPPORT 1
  2036. #endif
  2037. #define DALLAS_PIN 2
  2038. // -----------------------------------------------------------------------------
  2039. // ESP-DIN relay board V1
  2040. // https://github.com/pilotak/esp_din
  2041. // -----------------------------------------------------------------------------
  2042. #elif defined(PILOTAK_ESP_DIN_V1)
  2043. // Info
  2044. #define MANUFACTURER "PILOTAK"
  2045. #define DEVICE "ESP_DIN_V1"
  2046. // Buttons
  2047. #define BUTTON1_PIN 0
  2048. #define BUTTON1_RELAY 1
  2049. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2050. // Relays
  2051. #define RELAY1_PIN 4
  2052. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2053. #define RELAY2_PIN 5
  2054. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2055. // LEDs
  2056. #define LED1_PIN 15
  2057. #define LED1_PIN_INVERSE 0
  2058. #define I2C_SDA_PIN 12
  2059. #define I2C_SCL_PIN 13
  2060. #ifndef DALLAS_SUPPORT
  2061. #define DALLAS_SUPPORT 1
  2062. #endif
  2063. #define DALLAS_PIN 2
  2064. #define RFB_SUPPORT 1
  2065. #define RFB_PROVIDER RFB_PROVIDER_RCSWITCH
  2066. #define RFB_RX_PIN 14
  2067. #ifndef DIGITAL_SUPPORT
  2068. #define DIGITAL_SUPPORT 1
  2069. #endif
  2070. #define DIGITAL1_PIN 16
  2071. #define DIGITAL1_PIN_MODE INPUT
  2072. #define DIGITAL1_DEFAULT_STATE 0
  2073. // -----------------------------------------------------------------------------
  2074. // Heltec Touch Relay
  2075. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay
  2076. // -----------------------------------------------------------------------------
  2077. #elif defined(HELTEC_TOUCHRELAY)
  2078. // Info
  2079. #define MANUFACTURER "HELTEC"
  2080. #define DEVICE "TOUCH_RELAY"
  2081. // Buttons
  2082. #define BUTTON1_PIN 14
  2083. #define BUTTON1_RELAY 1
  2084. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON
  2085. // Relays
  2086. #define RELAY1_PIN 12
  2087. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2088. // -----------------------------------------------------------------------------
  2089. // Zhilde ZLD-44EU-W
  2090. // http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html
  2091. // -----------------------------------------------------------------------------
  2092. #elif defined(ZHILDE_44EU_W)
  2093. // Info
  2094. #define MANUFACTURER "ZHILDE"
  2095. #define DEVICE "44EU_W"
  2096. // Based on the reporter, this product uses GPIO1 and 3 for the button
  2097. // and onboard LED, so hardware serial should be disabled...
  2098. #define DEBUG_SERIAL_SUPPORT 0
  2099. // Buttons
  2100. #define BUTTON1_PIN 3
  2101. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2102. // Relays
  2103. #define RELAY1_PIN 5
  2104. #define RELAY2_PIN 4
  2105. #define RELAY3_PIN 12
  2106. #define RELAY4_PIN 13
  2107. #define RELAY5_PIN 14
  2108. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2109. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2110. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  2111. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  2112. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  2113. // LEDs
  2114. #define LED1_PIN 1
  2115. #define LED1_PIN_INVERSE 1
  2116. // -----------------------------------------------------------------------------
  2117. // Zhilde ZLD-64EU-W
  2118. // -----------------------------------------------------------------------------
  2119. #elif defined(ZHILDE_64EU_W)
  2120. // Info
  2121. #define MANUFACTURER "ZHILDE"
  2122. #define DEVICE "64EU_W"
  2123. // Based on https://templates.blakadder.com/ZLD64-EU-W.html ,
  2124. // This product uses GPIO1 for LED and 3 for the button, so hardware serial should be disabled...
  2125. #define DEBUG_SERIAL_SUPPORT 0
  2126. #define BUTTON1_PIN 3
  2127. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  2128. #define BUTTON1_PRESS BUTTON_ACTION_NONE
  2129. #define BUTTON1_RELAY 3
  2130. #define RELAY1_PIN 5
  2131. #define RELAY2_PIN 4
  2132. #define RELAY3_PIN 14
  2133. #define LED1_PIN 1
  2134. #define LED1_PIN_INVERSE 1
  2135. // -----------------------------------------------------------------------------
  2136. // Allnet 4duino ESP8266-UP-Relais
  2137. // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/
  2138. // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf
  2139. // -----------------------------------------------------------------------------
  2140. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  2141. // Info
  2142. #define MANUFACTURER "ALLNET"
  2143. #define DEVICE "4DUINO_IOT_WLAN_RELAIS"
  2144. // Relays
  2145. #define RELAY1_PIN 14
  2146. #define RELAY1_RESET_PIN 12
  2147. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  2148. // LEDs
  2149. #define LED1_PIN 0
  2150. #define LED1_PIN_INVERSE 1
  2151. // Buttons
  2152. //#define BUTTON1_PIN 0
  2153. //#define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2154. // Using pins labelled as SDA & SCL as buttons
  2155. #define BUTTON2_PIN 4
  2156. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON
  2157. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  2158. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  2159. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  2160. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  2161. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_NONE
  2162. #define BUTTON3_PIN 5
  2163. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON
  2164. // Using pins labelled as SDA & SCL for I2C
  2165. //#define I2C_SDA_PIN 4
  2166. //#define I2C_SCL_PIN 5
  2167. // -----------------------------------------------------------------------------
  2168. // Luani HVIO
  2169. // https://luani.de/projekte/esp8266-hvio/
  2170. // https://luani.de/blog/esp8266-230v-io-modul/
  2171. // -----------------------------------------------------------------------------
  2172. #elif defined(LUANI_HVIO)
  2173. // Info
  2174. #define MANUFACTURER "LUANI"
  2175. #define DEVICE "HVIO"
  2176. // Buttons
  2177. #define BUTTON1_PIN 12
  2178. #define BUTTON1_RELAY 1
  2179. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT //Hardware Pullup
  2180. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2181. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  2182. #define BUTTON2_PIN 13
  2183. #define BUTTON2_RELAY 2
  2184. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT //Hardware Pullup
  2185. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  2186. #define BUTTON2_RELEASE BUTTON_ACTION_TOGGLE
  2187. // Relays
  2188. #define RELAY1_PIN 4
  2189. #define RELAY2_PIN 5
  2190. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2191. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2192. // LEDs
  2193. #define LED1_PIN 15
  2194. #define LED1_PIN_INVERSE 0
  2195. // -----------------------------------------------------------------------------
  2196. // Tonbux 50-100M Smart Mosquito Killer USB
  2197. // https://www.aliexpress.com/item/Original-Tonbux-50-100M-Smart-Mosquito-Killer-USB-Plug-No-Noise-Repellent-App-Smart-Module/32859330820.html
  2198. // -----------------------------------------------------------------------------
  2199. #elif defined(TONBUX_MOSQUITO_KILLER)
  2200. // Info
  2201. #define MANUFACTURER "TONBUX"
  2202. #define DEVICE "MOSQUITO_KILLER"
  2203. // Buttons
  2204. #define BUTTON1_PIN 2
  2205. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2206. #define BUTTON1_RELAY 1
  2207. // Relays
  2208. #define RELAY1_PIN 5 // not a relay, fan
  2209. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2210. // LEDs
  2211. #define LED1_PIN 15 // blue led
  2212. #define LED1_PIN_INVERSE 1
  2213. #define LED1_MODE LED_MODE_WIFI
  2214. #define LED2_PIN 14 // red led
  2215. #define LED2_PIN_INVERSE 1
  2216. #define LED2_MODE LED_MODE_RELAY
  2217. #define LED3_PIN 12 // UV leds (1-2-3-4-5-6-7-8)
  2218. #define LED3_PIN_INVERSE 0
  2219. #define LED3_RELAY 1
  2220. #define LED4_PIN 16 // UV leds (9-10-11)
  2221. #define LED4_PIN_INVERSE 0
  2222. #define LED4_RELAY 1
  2223. // -----------------------------------------------------------------------------
  2224. // Avatto NAS-WR01W Wifi Smart Power Plug
  2225. // https://www.aliexpress.com/item/33011753732.html
  2226. // https://todo...
  2227. // -----------------------------------------------------------------------------
  2228. #elif defined(AVATTO_NAS_WR01W)
  2229. // Info
  2230. #define MANUFACTURER "AVATTO"
  2231. #define DEVICE "NAS_WR01W"
  2232. // Buttons
  2233. #define BUTTON1_PIN 0
  2234. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2235. #define BUTTON1_RELAY 1
  2236. // Relays
  2237. #define RELAY1_PIN 14
  2238. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2239. // LEDs
  2240. #define LED1_PIN 13
  2241. #define LED1_PIN_INVERSE 1
  2242. // HJL01 / BL0937
  2243. #ifndef HLW8012_SUPPORT
  2244. #define HLW8012_SUPPORT 1
  2245. #endif
  2246. #define HLW8012_SEL_PIN 12
  2247. #define HLW8012_CF1_PIN 5
  2248. #define HLW8012_CF_PIN 4
  2249. #define HLW8012_SEL_CURRENT LOW
  2250. #define HLW8012_CURRENT_RATIO 25740
  2251. #define HLW8012_VOLTAGE_RATIO 313400
  2252. #define HLW8012_POWER_RATIO 3414290
  2253. #define HLW8012_INTERRUPT_ON FALLING
  2254. // -----------------------------------------------------------------------------
  2255. // NEO Coolcam NAS-WR01W Wifi Smart Power Plug
  2256. // https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N
  2257. // https://www.fasttech.com/product/9649426-neo-coolcam-nas-wr01w-wifi-smart-power-plug-eu
  2258. // -----------------------------------------------------------------------------
  2259. #elif defined(NEO_COOLCAM_NAS_WR01W)
  2260. // Info
  2261. #define MANUFACTURER "NEO_COOLCAM"
  2262. #define DEVICE "NAS_WR01W"
  2263. // Buttons
  2264. #define BUTTON1_PIN 13
  2265. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2266. #define BUTTON1_RELAY 1
  2267. // Relays
  2268. #define RELAY1_PIN 12
  2269. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2270. // LEDs
  2271. #define LED1_PIN 4
  2272. #define LED1_PIN_INVERSE 1
  2273. // -----------------------------------------------------------------------------
  2274. // Deltaco SH_P01 Wifi Smart Power Plug
  2275. // -----------------------------------------------------------------------------
  2276. #elif defined(DELTACO_SH_P01)
  2277. // Info
  2278. #define MANUFACTURER "DELTACO"
  2279. #define DEVICE "SH_P01"
  2280. // Buttons
  2281. #define BUTTON1_PIN 13
  2282. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2283. #define BUTTON1_RELAY 1
  2284. // Relays
  2285. #define RELAY1_PIN 12
  2286. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2287. // LEDs
  2288. #define LED1_PIN 5
  2289. #define LED1_PIN_INVERSE 1
  2290. #define LED1_MODE LED_MODE_FINDME
  2291. // ------------------------------------------------------------------------------
  2292. // DELTACO_SH_P03USB Wifi Smart Power Plug
  2293. // -----------------------------------------------------------------------------
  2294. #elif defined(DELTACO_SH_P03USB)
  2295. // Info
  2296. #define MANUFACTURER "DELTACO"
  2297. #define DEVICE "SH_P03USB"
  2298. // Buttons
  2299. #define BUTTON1_PIN 13
  2300. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
  2301. #define BUTTON1_RELAY 2
  2302. // Relays
  2303. #define RELAY1_PIN 15 // USB power
  2304. #define RELAY2_PIN 12 // power plug 1
  2305. #define RELAY3_PIN 14 // power plug 2
  2306. #define RELAY4_PIN 5 // power plug 3
  2307. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2308. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2309. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  2310. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  2311. // LEDs
  2312. #define LED1_PIN 0 // power led
  2313. #define LED1_PIN_INVERSE 1
  2314. #define LED1_MODE LED_MODE_FINDME
  2315. // ------------------------------------------------------------------------------
  2316. // Fornorm Wi-Fi USB Extension Socket (ZLD-34EU)
  2317. // https://www.aliexpress.com/item/Fornorm-WiFi-Extension-Socket-with-Surge-Protector-Smart-Power-Strip-3-Outlets-and-4-USB-Charging/32849743948.html
  2318. // Also: Estink Wifi Power Strip
  2319. // -----------------------------------------------------------------------------
  2320. #elif defined(FORNORM_ZLD_34EU)
  2321. // Info
  2322. #define MANUFACTURER "FORNORM"
  2323. #define DEVICE "ZLD_34EU"
  2324. // Disable UART noise since this board uses GPIO3
  2325. #define DEBUG_SERIAL_SUPPORT 0
  2326. // Buttons
  2327. #define BUTTON1_PIN 16
  2328. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2329. #define BUTTON1_RELAY 4
  2330. // Relays
  2331. #define RELAY1_PIN 14 // USB power
  2332. #define RELAY2_PIN 13 // power plug 1
  2333. #define RELAY3_PIN 4 // power plug 2
  2334. #define RELAY4_PIN 15 // power plug 3
  2335. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2336. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2337. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  2338. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  2339. // LEDs
  2340. #define LED1_PIN 0 // power led
  2341. #define LED2_PIN 12 // power plug 1
  2342. #define LED3_PIN 3 // power plug 2
  2343. #define LED4_PIN 5 // power plug 3
  2344. #define LED1_PIN_INVERSE 1
  2345. #define LED2_PIN_INVERSE 1
  2346. #define LED3_PIN_INVERSE 1
  2347. #define LED4_PIN_INVERSE 1
  2348. #define LED1_MODE LED_MODE_FINDME
  2349. #define LED2_MODE LED_MODE_FOLLOW
  2350. #define LED3_MODE LED_MODE_FOLLOW
  2351. #define LED4_MODE LED_MODE_FOLLOW
  2352. #define LED2_RELAY 2
  2353. #define LED3_RELAY 3
  2354. #define LED4_RELAY 4
  2355. // -----------------------------------------------------------------------------
  2356. // Bruno Horta's OnOfre
  2357. // https://www.bhonofre.pt/
  2358. // https://github.com/brunohorta82/BH_OnOfre/
  2359. // -----------------------------------------------------------------------------
  2360. #elif defined(BH_ONOFRE)
  2361. // Info
  2362. #define MANUFACTURER "BH"
  2363. #define DEVICE "ONOFRE"
  2364. // Buttons
  2365. #define BUTTON1_PIN 12
  2366. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
  2367. #define BUTTON1_RELAY 1
  2368. #define BUTTON2_PIN 13
  2369. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
  2370. #define BUTTON2_RELAY 2
  2371. // Relays
  2372. #define RELAY1_PIN 4
  2373. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2374. #define RELAY2_PIN 5
  2375. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2376. // -----------------------------------------------------------------------------
  2377. // BlitzWolf SHP2 and SHP6
  2378. // Also several boards under different names uing a power chip labelled BL0937 or HJL-01
  2379. // * Blitzwolf (https://www.amazon.es/Inteligente-Temporización-Dispositivos-Cualquier-BlitzWolf/dp/B07BMQP142)
  2380. // * HomeCube (https://www.amazon.de/Steckdose-Homecube-intelligente-Verbrauchsanzeige-funktioniert/dp/B076Q2LKHG)
  2381. // * Coosa (https://www.amazon.com/COOSA-Monitoring-Function-Campatible-Assiatant/dp/B0788W9TDR)
  2382. // * Gosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5)
  2383. // * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC)
  2384. // * DIY Tech Smart Home (https://www.amazon.es/gp/product/B07HHKXYS9)
  2385. // -----------------------------------------------------------------------------
  2386. #elif defined(BLITZWOLF_BWSHPX)
  2387. // Info
  2388. #define MANUFACTURER "BLITZWOLF"
  2389. #define DEVICE "BWSHPX"
  2390. // Buttons
  2391. #define BUTTON1_PIN 13
  2392. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2393. #define BUTTON1_RELAY 1
  2394. // Relays
  2395. #define RELAY1_PIN 15
  2396. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2397. // LEDs
  2398. #define LED1_PIN 2
  2399. #define LED1_PIN_INVERSE 1
  2400. #define LED2_PIN 0
  2401. #define LED2_PIN_INVERSE 1
  2402. #define LED2_MODE LED_MODE_FINDME
  2403. #define LED2_RELAY 1
  2404. // HJL01 / BL0937
  2405. #ifndef HLW8012_SUPPORT
  2406. #define HLW8012_SUPPORT 1
  2407. #endif
  2408. #define HLW8012_SEL_PIN 12
  2409. #define HLW8012_CF1_PIN 14
  2410. #define HLW8012_CF_PIN 5
  2411. #define HLW8012_SEL_CURRENT LOW
  2412. #define HLW8012_CURRENT_RATIO 25740
  2413. #define HLW8012_VOLTAGE_RATIO 313400
  2414. #define HLW8012_POWER_RATIO 3414290
  2415. #define HLW8012_INTERRUPT_ON FALLING
  2416. // -----------------------------------------------------------------------------
  2417. // Same as the above but new board version marked V2.3
  2418. // BlitzWolf SHP2 V2.3
  2419. // Gosund SP1 V2.3
  2420. // -----------------------------------------------------------------------------
  2421. #elif defined(BLITZWOLF_BWSHPX_V23)
  2422. // Info
  2423. #define MANUFACTURER "BLITZWOLF"
  2424. #define DEVICE "BWSHPX_V23"
  2425. // Buttons
  2426. #define BUTTON1_PIN 3
  2427. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  2428. #define BUTTON1_RELAY 1
  2429. // Relays
  2430. #define RELAY1_PIN 14
  2431. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2432. // LEDs
  2433. #define LED1_PIN 1
  2434. #define LED1_PIN_INVERSE 1
  2435. #define LED2_PIN 13
  2436. #define LED2_PIN_INVERSE 1
  2437. #define LED2_MODE LED_MODE_FINDME
  2438. #define LED2_RELAY 1
  2439. // HJL01 / BL0937
  2440. #ifndef HLW8012_SUPPORT
  2441. #define HLW8012_SUPPORT 1
  2442. #endif
  2443. #define HLW8012_SEL_PIN 12
  2444. #define HLW8012_CF1_PIN 5
  2445. #define HLW8012_CF_PIN 4
  2446. #define HLW8012_SEL_CURRENT LOW
  2447. #define HLW8012_CURRENT_RATIO 25740
  2448. #define HLW8012_VOLTAGE_RATIO 313400
  2449. #define HLW8012_POWER_RATIO 3414290
  2450. #define HLW8012_INTERRUPT_ON FALLING
  2451. // BUTTON1 and LED1 are using Serial pins
  2452. #define DEBUG_SERIAL_SUPPORT 0
  2453. // -----------------------------------------------------------------------------
  2454. // Similar to both devices above but also with switchable USB ports
  2455. // and other sensor (CSE7766).
  2456. // the pin layout is different to the above two versions
  2457. // BlitzWolf SHP5
  2458. // -----------------------------------------------------------------------------
  2459. #elif defined(BLITZWOLF_BWSHP5)
  2460. // Info
  2461. #define MANUFACTURER "BLITZWOLF"
  2462. #define DEVICE "BWSHP5"
  2463. // Buttons
  2464. #define BUTTON1_PIN 16
  2465. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2466. #define BUTTON1_RELAY 1
  2467. // Relays
  2468. // Power plug
  2469. #define RELAY1_PIN 14
  2470. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2471. // USB
  2472. #define RELAY2_PIN 5
  2473. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2474. // LEDs
  2475. #define LED1_PIN 2
  2476. #define LED1_PIN_INVERSE 1
  2477. #define LED2_PIN 0
  2478. #define LED2_PIN_INVERSE 1
  2479. #define LED2_MODE LED_MODE_FINDME
  2480. #define LED2_RELAY 1
  2481. // Disable UART noise
  2482. #define DEBUG_SERIAL_SUPPORT 0
  2483. // CSE7766
  2484. #ifndef CSE7766_SUPPORT
  2485. #define CSE7766_SUPPORT 1
  2486. #endif
  2487. #define CSE7766_RX_PIN 3
  2488. // -----------------------------------------------------------------------------
  2489. // Teckin SP21
  2490. // -----------------------------------------------------------------------------
  2491. #elif defined(TECKIN_SP21)
  2492. // Info
  2493. #define MANUFACTURER "TECKIN"
  2494. #define DEVICE "SP21"
  2495. // Buttons
  2496. #define BUTTON1_PIN 13
  2497. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2498. #define BUTTON1_RELAY 1
  2499. // Relays
  2500. #define RELAY1_PIN 15
  2501. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2502. // LEDs
  2503. #define LED1_PIN 2
  2504. #define LED1_PIN_INVERSE 1
  2505. // -----------------------------------------------------------------------------
  2506. // Teckin SP22 v1.4 - v1.6
  2507. // -----------------------------------------------------------------------------
  2508. #elif defined(TECKIN_SP22_V14)
  2509. // Info
  2510. #define MANUFACTURER "TECKIN"
  2511. #define DEVICE "SP22_V14"
  2512. // Buttons
  2513. #define BUTTON1_PIN 1
  2514. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2515. #define BUTTON1_RELAY 1
  2516. // Relays
  2517. #define RELAY1_PIN 14
  2518. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2519. // LEDs
  2520. #define LED1_PIN 3
  2521. #define LED1_PIN_INVERSE 1
  2522. #define LED2_PIN 13
  2523. #define LED2_PIN_INVERSE 1
  2524. #define LED2_MODE LED_MODE_FINDME
  2525. #define LED2_RELAY 1
  2526. // HJL01 / BL0937
  2527. #ifndef HLW8012_SUPPORT
  2528. #define HLW8012_SUPPORT 1
  2529. #endif
  2530. #define HLW8012_SEL_PIN 12
  2531. #define HLW8012_CF1_PIN 5
  2532. #define HLW8012_CF_PIN 4
  2533. #define HLW8012_SEL_CURRENT LOW
  2534. #define HLW8012_CURRENT_RATIO 20730
  2535. #define HLW8012_VOLTAGE_RATIO 264935
  2536. #define HLW8012_POWER_RATIO 2533110
  2537. #define HLW8012_INTERRUPT_ON FALLING
  2538. // BUTTON1 and LED1 are using Serial pins
  2539. #define DEBUG_SERIAL_SUPPORT 0
  2540. // -----------------------------------------------------------------------------
  2541. // Teckin SP22 v1.4 - v1.6
  2542. //
  2543. // NB Notes suggest that energy monitoring is removed from later versions
  2544. // -----------------------------------------------------------------------------
  2545. #elif defined(TECKIN_SP23_V13)
  2546. // Info .. NB Newer versions apparently lack energy monitor
  2547. // The board revision is not indicated externally
  2548. #define MANUFACTURER "TECKIN"
  2549. #define DEVICE "SP23_V13"
  2550. // Buttons
  2551. #define BUTTON1_PIN 13
  2552. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2553. #define BUTTON1_RELAY 1
  2554. // Relays
  2555. #define RELAY1_PIN 15
  2556. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2557. // LEDs
  2558. #define LED1_PIN 4
  2559. #define LED1_PIN_INVERSE 1
  2560. #define LED2_PIN 2
  2561. #define LED2_PIN_INVERSE 0
  2562. #define LED2_MODE LED_MODE_FINDME
  2563. #define LED2_RELAY 1
  2564. // HJL01 / BL0937
  2565. #ifndef HLW8012_SUPPORT
  2566. #define HLW8012_SUPPORT 1
  2567. #endif
  2568. #define HLW8012_SEL_PIN 12
  2569. #define HLW8012_CF1_PIN 14
  2570. #define HLW8012_CF_PIN 5
  2571. #define HLW8012_SEL_CURRENT LOW
  2572. #define HLW8012_CURRENT_RATIO 23324
  2573. #define HLW8012_VOLTAGE_RATIO 324305
  2574. #define HLW8012_POWER_RATIO 3580841
  2575. #define HLW8012_INTERRUPT_ON FALLING
  2576. // -----------------------------------------------------------------------------
  2577. // The Gosund WP3 is based on ESP8285, so 1 MB internal flash (DOUT required)
  2578. // The module has no-connect: TX, RX, RST, AD, GPIO5, (and GPIO0,
  2579. // GPIO2 via test points on the back of the module)
  2580. // and these are wired to devices:
  2581. // GPIO4: /BTN
  2582. // GPIO12: /LED red
  2583. // GPIO13: /LED blue
  2584. // GPIO14: RELAY
  2585. // -----------------------------------------------------------------------------
  2586. #elif defined(GOSUND_WP3)
  2587. // Info
  2588. #define MANUFACTURER "GOSUND"
  2589. #define DEVICE "WP3"
  2590. // Buttons
  2591. #define BUTTON1_PIN 4
  2592. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2593. #define BUTTON1_RELAY 1
  2594. // the defaults are reasonable, but you can change them as desired
  2595. //#define BUTTON1_PRESS BUTTON_ACTION_NONE
  2596. //#define BUTTON1_CLICK BUTTON_ACTION_TOGGLE
  2597. //#define BUTTON1_DBLCLICK BUTTON_ACTION_AP
  2598. //#define BUTTON1_LNGCLICK BUTTON_ACTION_RESET
  2599. //#define BUTTON1_LNGLNGCLICK BUTTON_ACTION_FACTORY
  2600. // Relays
  2601. #define RELAY1_PIN 14
  2602. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2603. // LEDs
  2604. // LED1 (red) indicates on/off state; you could use LED_MODE_FOLLOW_INVERSE
  2605. // so that the LED lights the button when 'off' so it can be found easily.
  2606. #define LED1_PIN 12
  2607. #define LED1_PIN_INVERSE 1
  2608. #define LED1_MODE LED_MODE_FOLLOW
  2609. #define LED1_RELAY 1
  2610. // LED2 (blue) indicates wifi activity
  2611. #define LED2_PIN 13
  2612. #define LED2_PIN_INVERSE 1
  2613. #define LED2_MODE LED_MODE_WIFI
  2614. // -----------------------------------------------------------------------------
  2615. // Several boards under different names uing a power chip labelled BL0937 or HJL-01
  2616. // Also model number KS-602S
  2617. // -----------------------------------------------------------------------------
  2618. #elif defined(GOSUND_WS1)
  2619. // Info
  2620. #define MANUFACTURER "GOSUND"
  2621. #define DEVICE "WS1"
  2622. // Buttons
  2623. #define BUTTON1_PIN 0
  2624. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2625. #define BUTTON1_RELAY 1
  2626. // Relays
  2627. #define RELAY1_PIN 14
  2628. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2629. // LEDs
  2630. #define LED1_PIN 1
  2631. #define LED1_PIN_INVERSE 1
  2632. // LED1 is using TX pin
  2633. #define DEBUG_SERIAL_SUPPORT 0
  2634. // ----------------------------------------------------------------------------------------
  2635. // Power socket 16A similar to BLITZWOLF_BWSHPX but button pin differs
  2636. // IMPORTANT, This template is for hardware version SP111_A_Wifi_Ver1.1 (as printed on the PCB)
  2637. // hhttps://www.amazon.de/-/en/Smallest-Consumption-Measuring-Function-Compatible/dp/B07PSMF47W
  2638. // ----------------------------------------------------------------------------------------
  2639. #elif defined(GOSUND_SP111)
  2640. // Info
  2641. #define MANUFACTURER "GOSUND"
  2642. #define DEVICE "SP111"
  2643. // Buttons
  2644. #define BUTTON1_PIN 13
  2645. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2646. #define BUTTON1_RELAY 1
  2647. // Relays
  2648. #define RELAY1_PIN 15
  2649. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2650. // LEDs
  2651. #define LED1_PIN 2
  2652. #define LED1_PIN_INVERSE 1
  2653. #define LED2_PIN 0
  2654. #define LED2_PIN_INVERSE 1
  2655. #define LED2_MODE LED_MODE_FINDME
  2656. #define LED2_RELAY 1
  2657. // HJL01 / BL0937
  2658. #ifndef HLW8012_SUPPORT
  2659. #define HLW8012_SUPPORT 1
  2660. #endif
  2661. #define HLW8012_SEL_PIN 12
  2662. #define HLW8012_CF1_PIN 4
  2663. #define HLW8012_CF_PIN 5
  2664. #define HLW8012_SEL_CURRENT LOW
  2665. #define HLW8012_CURRENT_RATIO 25740
  2666. #define HLW8012_VOLTAGE_RATIO 313400
  2667. #define HLW8012_POWER_RATIO 3414290
  2668. #define HLW8012_INTERRUPT_ON FALLING
  2669. // ----------------------------------------------------------------------------------------
  2670. // Power strip 15A - 3 Sockets + 3 USB ports
  2671. // This device uses just one digital button (main one). All other three buttons are connected
  2672. // to the ADC pin via resistors with different values. This approach is known under the name of
  2673. // "Resistor Ladder" - https://en.wikipedia.org/wiki/Resistor_ladder
  2674. // https://www.amazon.de/-/en/gp/product/B085XXCPRD
  2675. // ----------------------------------------------------------------------------------------
  2676. #elif defined(GOSUND_P1)
  2677. // Info
  2678. #define MANUFACTURER "GOSUND"
  2679. #define DEVICE "P1"
  2680. //Enable this to view buttons analog level.
  2681. //Or, use adc terminal command
  2682. //#define ANALOG_SUPPORT 1
  2683. // Disable UART noise
  2684. #define DEBUG_SERIAL_SUPPORT 0
  2685. // Buttons
  2686. #define BUTTON_PROVIDER_GPIO_SUPPORT 1
  2687. #define BUTTON_PROVIDER_ANALOG_SUPPORT 1
  2688. #define BUTTON1_PIN 16
  2689. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2690. #define BUTTON1_RELAY 4
  2691. #define BUTTON2_PIN 17
  2692. #define BUTTON2_RELAY 3
  2693. #define BUTTON2_PROVIDER BUTTON_PROVIDER_ANALOG
  2694. #define BUTTON2_ANALOG_LEVEL 220
  2695. #define BUTTON3_PIN 17
  2696. #define BUTTON3_RELAY 2
  2697. #define BUTTON3_PROVIDER BUTTON_PROVIDER_ANALOG
  2698. #define BUTTON3_ANALOG_LEVEL 470
  2699. #define BUTTON4_PIN 17
  2700. #define BUTTON4_RELAY 1
  2701. #define BUTTON4_PROVIDER BUTTON_PROVIDER_ANALOG
  2702. #define BUTTON4_ANALOG_LEVEL 730
  2703. // Relays
  2704. #define RELAY1_PIN 14
  2705. #define RELAY2_PIN 12
  2706. #define RELAY3_PIN 13
  2707. #define RELAY4_PIN 5
  2708. #define RELAY4_TYPE RELAY_TYPE_INVERSE
  2709. // LEDs
  2710. #define LED1_PIN 2
  2711. #define LED1_PIN_INVERSE 1
  2712. // CSE7766
  2713. #define CSE7766_SUPPORT 1
  2714. #define CSE7766_RX_PIN 3
  2715. // ----------------------------------------------------------------------------------------
  2716. // Homecube 16A is similar but some pins differ and it also has RGB LEDs
  2717. // https://www.amazon.de/gp/product/B07D7RVF56/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1
  2718. // ----------------------------------------------------------------------------------------
  2719. #elif defined(HOMECUBE_16A)
  2720. // Info
  2721. #define MANUFACTURER "HOMECUBE"
  2722. #define DEVICE "16A"
  2723. // Buttons
  2724. #define BUTTON1_PIN 13
  2725. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2726. #define BUTTON1_RELAY 1
  2727. // Relays
  2728. #define RELAY1_PIN 15
  2729. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2730. // LEDs
  2731. //LED Pin 4 - ESP8266 onboard LED
  2732. //Red LED: 0
  2733. //Green LED: 12
  2734. //Blue LED: 2
  2735. // Blue
  2736. #define LED1_PIN 2
  2737. #define LED1_PIN_INVERSE 0
  2738. // Green
  2739. #define LED2_PIN 12
  2740. #define LED2_PIN_INVERSE 1
  2741. #define LED2_MODE LED_MODE_RELAY
  2742. // Red
  2743. #define LED3_PIN 0
  2744. #define LED3_PIN_INVERSE 0
  2745. #define LED3_MODE LED_MODE_OFF
  2746. // HJL01 / BL0937
  2747. #ifndef HLW8012_SUPPORT
  2748. #define HLW8012_SUPPORT 1
  2749. #endif
  2750. #define HLW8012_SEL_PIN 16
  2751. #define HLW8012_CF1_PIN 14
  2752. #define HLW8012_CF_PIN 5
  2753. #define HLW8012_SEL_CURRENT LOW
  2754. #define HLW8012_CURRENT_RATIO 25740
  2755. #define HLW8012_VOLTAGE_RATIO 313400
  2756. #define HLW8012_POWER_RATIO 3414290
  2757. #define HLW8012_INTERRUPT_ON FALLING
  2758. // -----------------------------------------------------------------------------
  2759. // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01)
  2760. // https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5
  2761. // -----------------------------------------------------------------------------
  2762. #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI)
  2763. // Info
  2764. #define MANUFACTURER "VANZAVANZU"
  2765. #define DEVICE "SMART_WIFI_PLUG_MINI"
  2766. // Buttons
  2767. #define BUTTON1_PIN 13
  2768. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2769. #define BUTTON1_RELAY 1
  2770. // Relays
  2771. #define RELAY1_PIN 15
  2772. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2773. // LEDs
  2774. #define LED1_PIN 2
  2775. #define LED1_PIN_INVERSE 1
  2776. #define LED2_PIN 0
  2777. #define LED2_PIN_INVERSE 1
  2778. #define LED2_MODE LED_MODE_FINDME
  2779. #define LED2_RELAY 1
  2780. // Disable UART noise
  2781. #define DEBUG_SERIAL_SUPPORT 0
  2782. // HJL01 / BL0937
  2783. #ifndef HLW8012_SUPPORT
  2784. #define HLW8012_SUPPORT 1
  2785. #endif
  2786. #define HLW8012_SEL_PIN 3
  2787. #define HLW8012_CF1_PIN 14
  2788. #define HLW8012_CF_PIN 5
  2789. #define HLW8012_SEL_CURRENT LOW
  2790. #define HLW8012_CURRENT_RATIO 25740
  2791. #define HLW8012_VOLTAGE_RATIO 313400
  2792. #define HLW8012_POWER_RATIO 3414290
  2793. #define HLW8012_INTERRUPT_ON FALLING
  2794. // -----------------------------------------------------------------------------
  2795. #elif defined(GENERIC_AG_L4)
  2796. // Info
  2797. #define MANUFACTURER "GENERIC"
  2798. #define DEVICE "AG_L4"
  2799. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  2800. // button 1: "power" button
  2801. #define BUTTON1_PIN 4
  2802. #define BUTTON1_RELAY 1
  2803. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  2804. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2805. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  2806. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  2807. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  2808. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  2809. // button 2: "wifi" button
  2810. #define BUTTON2_PIN 2
  2811. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2812. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  2813. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  2814. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  2815. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  2816. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_NONE
  2817. // LEDs
  2818. #define LED1_PIN 5 // red status led
  2819. #define LED1_PIN_INVERSE 0
  2820. #define LED2_PIN 16 // master light power
  2821. #define LED2_PIN_INVERSE 1
  2822. #define LED2_MODE LED_MODE_RELAY
  2823. // Light
  2824. #define LIGHT_CHANNELS 3
  2825. #define LIGHT_CH1_PIN 14 // RED
  2826. #define LIGHT_CH2_PIN 13 // GREEN
  2827. #define LIGHT_CH3_PIN 12 // BLUE
  2828. // -----------------------------------------------------------------------------
  2829. #elif defined(GENERIC_AG_L4_V3)
  2830. // Info
  2831. #define MANUFACTURER "GENERIC"
  2832. #define DEVICE "AG_L4_V3"
  2833. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  2834. // button 1: "power" button
  2835. #define BUTTON1_PIN 13
  2836. #define BUTTON1_RELAY 1
  2837. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  2838. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2839. #define BUTTON1_CLICK BUTTON_ACTION_NONE
  2840. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  2841. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  2842. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_RESET
  2843. // button 2: "wifi" button
  2844. #define BUTTON2_PIN 2
  2845. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2846. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  2847. #define BUTTON2_CLICK BUTTON_ACTION_NONE
  2848. #define BUTTON2_DBLCLICK BUTTON_ACTION_NONE
  2849. #define BUTTON2_LNGCLICK BUTTON_ACTION_NONE
  2850. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_NONE
  2851. // LEDs
  2852. #define LED1_PIN 5 // red status led
  2853. #define LED1_PIN_INVERSE 0
  2854. #define LED2_PIN 16 // master light power
  2855. #define LED2_PIN_INVERSE 1
  2856. #define LED2_MODE LED_MODE_RELAY
  2857. // Light
  2858. #define LIGHT_CHANNELS 3
  2859. #define LIGHT_CH1_PIN 4 // RED
  2860. #define LIGHT_CH2_PIN 12 // GREEN
  2861. #define LIGHT_CH3_PIN 14 // BLUE
  2862. // -----------------------------------------------------------------------------
  2863. #elif defined(ALLTERCO_SHELLY1)
  2864. // Info
  2865. #define MANUFACTURER "ALLTERCO"
  2866. #define DEVICE "SHELLY1"
  2867. // Buttons
  2868. #define BUTTON1_PIN 5
  2869. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
  2870. #define BUTTON1_RELAY 1
  2871. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2872. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  2873. // Relays
  2874. #define RELAY1_PIN 4
  2875. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2876. #elif defined(ALLTERCO_SHELLY2)
  2877. // Info
  2878. #define MANUFACTURER "ALLTERCO"
  2879. #define DEVICE "SHELLY2"
  2880. // Buttons
  2881. #define BUTTON1_PIN 12
  2882. #define BUTTON1_RELAY 1
  2883. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
  2884. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2885. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  2886. #define BUTTON2_PIN 14
  2887. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
  2888. #define BUTTON2_RELAY 2
  2889. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  2890. #define BUTTON2_RELEASE BUTTON_ACTION_TOGGLE
  2891. // Relays
  2892. #define RELAY1_PIN 4
  2893. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2894. #define RELAY2_PIN 5
  2895. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2896. #elif defined(ALLTERCO_SHELLY1PM)
  2897. // Info
  2898. #define MANUFACTURER "ALLTERCO"
  2899. #define DEVICE "SHELLY1PM"
  2900. // Buttons
  2901. #define BUTTON1_PIN 4
  2902. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
  2903. #define BUTTON1_RELAY 1
  2904. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2905. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  2906. #define BUTTON2_PIN 2
  2907. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2908. #define BUTTON2_LNGCLICK BUTTON_ACTION_RESET
  2909. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_FACTORY
  2910. // Relays
  2911. #define RELAY1_PIN 15
  2912. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2913. // Light
  2914. #define LED1_PIN 0
  2915. #define LED1_PIN_INVERSE 1
  2916. // HJL01 / BL0937
  2917. #define HLW8012_SUPPORT 1
  2918. #define HLW8012_SEL_PIN 12
  2919. #define HLW8012_CF1_PIN 13
  2920. #define HLW8012_CF_PIN 5
  2921. #define HLW8012_SEL_CURRENT LOW
  2922. #define HLW8012_CURRENT_RATIO 25740
  2923. #define HLW8012_VOLTAGE_RATIO 313400
  2924. #define HLW8012_POWER_RATIO 3414290
  2925. #define HLW8012_INTERRUPT_ON FALLING
  2926. //Temperature
  2927. #define NTC_SUPPORT 1
  2928. #define SENSOR_SUPPORT 1
  2929. #define NTC_BETA 3350
  2930. #define NTC_R_UP 10000
  2931. #define NTC_R_DOWN 0
  2932. #define NTC_R0 8000
  2933. #elif defined(ALLTERCO_SHELLY25)
  2934. // Info
  2935. #define MANUFACTURER "ALLTERCO"
  2936. #define DEVICE "SHELLY25"
  2937. // Buttons
  2938. #define BUTTON1_PIN 13
  2939. #define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
  2940. #define BUTTON1_RELAY 1
  2941. #define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
  2942. #define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
  2943. #define BUTTON2_PIN 5
  2944. #define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
  2945. #define BUTTON2_RELAY 2
  2946. #define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
  2947. #define BUTTON2_RELEASE BUTTON_ACTION_TOGGLE
  2948. #define BUTTON3_PIN 2
  2949. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2950. #define BUTTON3_LNGCLICK BUTTON_ACTION_RESET
  2951. #define BUTTON3_LNGLNGCLICK BUTTON_ACTION_FACTORY
  2952. // Relays
  2953. #define RELAY1_PIN 4
  2954. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2955. #define RELAY2_PIN 15
  2956. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  2957. // Light
  2958. #define LED1_PIN 0
  2959. #define LED1_PIN_INVERSE 1
  2960. //Temperature
  2961. #define NTC_SUPPORT 1
  2962. #define SENSOR_SUPPORT 1
  2963. #define NTC_BETA 3350
  2964. #define NTC_R_UP 10000
  2965. #define NTC_R_DOWN 0
  2966. #define NTC_R0 8000
  2967. //Current
  2968. #define ADE7953_SUPPORT 1
  2969. #define I2C_SDA_PIN 12
  2970. #define I2C_SCL_PIN 14
  2971. // -----------------------------------------------------------------------------
  2972. // This device has teh same behaviour as the GOSUND WP3, but with different GPIO pin values
  2973. // GPIO equivalents extracted from https://templates.blakadder.com/aoycocr_X5P.html
  2974. #elif defined(AOYCOCR_X5P)
  2975. // Info
  2976. #define MANUFACTURER "AOYCOCR"
  2977. #define DEVICE "X5P"
  2978. // Buttons
  2979. #define BUTTON1_PIN 13
  2980. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  2981. #define BUTTON1_RELAY 1
  2982. // the defaults are reasonable, but you can change them as desired
  2983. //#define BUTTON1_PRESS BUTTON_ACTION_NONE
  2984. //#define BUTTON1_CLICK BUTTON_ACTION_TOGGLE
  2985. //#define BUTTON1_DBLCLICK BUTTON_ACTION_AP
  2986. //#define BUTTON1_LNGCLICK BUTTON_ACTION_RESET
  2987. //#define BUTTON1_LNGLNGCLICK BUTTON_ACTION_FACTORY
  2988. // Relays
  2989. #define RELAY1_PIN 15
  2990. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  2991. // LEDs
  2992. // LED1 (red) indicates on/off state; you could use LED_MODE_FOLLOW_INVERSE
  2993. // so that the LED lights the button when 'off' so it can be found easily.
  2994. #define LED1_PIN 0
  2995. #define LED1_PIN_INVERSE 1
  2996. #define LED1_MODE LED_MODE_FOLLOW
  2997. #define LED1_RELAY 1
  2998. // LED2 (blue) indicates wifi activity
  2999. #define LED2_PIN 2
  3000. #define LED2_PIN_INVERSE 1
  3001. #define LED2_MODE LED_MODE_WIFI
  3002. // -----------------------------------------------------------------------------
  3003. // also works with https://www.amazon.com/gp/product/B07TMY394G/
  3004. // see https://github.com/xoseperez/espurna/issues/2055
  3005. #elif defined(LOHAS_E27_9W)
  3006. // Info
  3007. #define MANUFACTURER "LOHAS"
  3008. #define DEVICE "E27_9W"
  3009. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  3010. // Light
  3011. #define LIGHT_CHANNELS 5
  3012. #define MY92XX_MODEL MY92XX_MODEL_MY9231
  3013. #define MY92XX_CHIPS 2
  3014. #define MY92XX_DI_PIN 13
  3015. #define MY92XX_DCKI_PIN 15
  3016. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  3017. #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1
  3018. // https://www.amazon.com/gp/product/B07T7W7ZMW
  3019. #elif defined(LOHAS_E26_A19)
  3020. // Info
  3021. #define MANUFACTURER "LOHAS"
  3022. #define DEVICE "E26_A19"
  3023. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3024. // Light
  3025. #define LIGHT_CHANNELS 5
  3026. #define LIGHT_CH1_PIN 5 // RED
  3027. #define LIGHT_CH2_PIN 4 // GREEN
  3028. #define LIGHT_CH3_PIN 13 // BLUE
  3029. #define LIGHT_CH4_PIN 14 // WHITE1
  3030. #define LIGHT_CH5_PIN 12 // WHITE1
  3031. // -----------------------------------------------------------------------------
  3032. #elif defined(TECKIN_SB53)
  3033. // Info
  3034. #define MANUFACTURER "TECKIN"
  3035. #define DEVICE "SB53"
  3036. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3037. // Light
  3038. #define LIGHT_CHANNELS 5
  3039. #define LIGHT_CH1_PIN 4 // RED
  3040. #define LIGHT_CH2_PIN 12 // GREEN
  3041. #define LIGHT_CH3_PIN 14 // BLUE
  3042. #define LIGHT_CH4_PIN 13 // WARM WHITE
  3043. #define LIGHT_CH5_PIN 5 // COLD WHITE
  3044. // -----------------------------------------------------------------------------
  3045. #elif defined(XIAOMI_SMART_DESK_LAMP)
  3046. // Info
  3047. #define MANUFACTURER "XIAOMI"
  3048. #define DEVICE "SMART_DESK_LAMP"
  3049. // Buttons
  3050. #define BUTTON1_PIN 2
  3051. #define BUTTON2_PIN 14
  3052. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
  3053. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
  3054. // This button doubles as switch here and as encoder mode switch below
  3055. // Clicking it (for less than 500ms) will turn the light on and off
  3056. // Double and Long clicks will not work as these are used to modify the encoder action
  3057. #define BUTTON1_RELAY 1
  3058. #define BUTTON_LNGCLICK_DELAY 500
  3059. #define BUTTON1_DBLCLICK BUTTON_ACTION_NONE
  3060. #define BUTTON1_LNGCLICK BUTTON_ACTION_NONE
  3061. #define BUTTON1_LNGLNGCLICK BUTTON_ACTION_NONE
  3062. // Hidden button will enter AP mode if dblclick and reset the device when long-long-clicked
  3063. #define BUTTON2_DBLCLICK BUTTON_ACTION_AP
  3064. #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_RESET
  3065. // Light
  3066. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3067. #define LIGHT_STEP 8
  3068. #define LIGHT_CHANNELS 2
  3069. #define LIGHT_CH1_PIN 5 // warm white
  3070. #define LIGHT_CH2_PIN 4 // cold white
  3071. // https://www.xiaomitoday.com/xiaomi-mijia-mjtd01yl-led-desk-lamp-review/
  3072. #define LIGHT_COLDWHITE_MIRED 153
  3073. #define LIGHT_WARMWHITE_MIRED 370
  3074. // Encoder
  3075. // If mode is ENCODER_MODE_RATIO, the value ratio between both channels is changed
  3076. // when the button is not pressed, and the overall brightness when pressed
  3077. // If mode is ENCODER_MODE_CHANNEL, the first channel value is changed
  3078. // when the button is not pressed, and the second channel when pressed
  3079. // If no ENCODERX_BUTTON_PIN defined it will only change the value of the first defined channel
  3080. #define ENCODER_SUPPORT 1
  3081. #define ENCODER1_PIN1 12
  3082. #define ENCODER1_PIN2 13
  3083. #define ENCODER1_BUTTON_PIN 2 // active low by default, with software pullup
  3084. #define ENCODER1_CHANNEL1 0 // please note this value is 0-based (LIGHT_CH1 above)
  3085. #define ENCODER1_CHANNEL2 1 // please note this value is 0-based (LIGHT_CH2 above)
  3086. #define ENCODER1_MODE ENCODER_MODE_RATIO
  3087. #elif defined(PHYX_ESP12_RGB)
  3088. // Info
  3089. #define MANUFACTURER "PHYX"
  3090. #define DEVICE "ESP12_RGB"
  3091. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3092. // Light
  3093. #define LIGHT_CHANNELS 3
  3094. #define LIGHT_CH1_PIN 4 // RED
  3095. #define LIGHT_CH2_PIN 14 // GREEN
  3096. #define LIGHT_CH3_PIN 12 // BLUE
  3097. // -----------------------------------------------------------------------------
  3098. // iWoole LED Table Lamp
  3099. // http://iwoole.com/newst-led-smart-night-light-7w-smart-table-light-rgbw-wifi-app-remote-control-110v-220v-us-eu-plug-smart-lamp-google-home-decore-p00022p1.html
  3100. // -----------------------------------------------------------------------------
  3101. #elif defined(IWOOLE_LED_TABLE_LAMP)
  3102. // Info
  3103. #define MANUFACTURER "IWOOLE"
  3104. #define DEVICE "LED_TABLE_LAMP"
  3105. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3106. // Light
  3107. #define LIGHT_CHANNELS 4
  3108. #define LIGHT_CH1_PIN 12 // RED
  3109. #define LIGHT_CH2_PIN 5 // GREEN
  3110. #define LIGHT_CH3_PIN 14 // BLUE
  3111. #define LIGHT_CH4_PIN 4 // WHITE
  3112. // -----------------------------------------------------------------------------
  3113. // Generic GU10
  3114. // https://www.ebay.com/itm/1-10PC-GU10-RGB-Smart-Bulb-Wireless-WiFi-App-Remote-Ctrl-Light-for-Alexa-Google/173724116351
  3115. // -----------------------------------------------------------------------------
  3116. #elif defined(GENERIC_GU10)
  3117. // Info
  3118. #define MANUFACTURER "GENERIC"
  3119. #define DEVICE "GU10"
  3120. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3121. // Light
  3122. #define LIGHT_CHANNELS 4
  3123. #define LIGHT_CH1_PIN 14 // RED
  3124. #define LIGHT_CH2_PIN 12 // GREEN
  3125. #define LIGHT_CH3_PIN 13 // BLUE
  3126. #define LIGHT_CH4_PIN 4 // WHITE
  3127. // -----------------------------------------------------------------------------
  3128. // Generic E14
  3129. // https://www.ebay.com/itm/LED-Bulb-Wifi-E14-4-5W-Candle-RGB-W-4in1-Dimmable-V-tac-Smart-VT-5114/163899840601
  3130. // -----------------------------------------------------------------------------
  3131. #elif defined(GENERIC_E14)
  3132. // Info
  3133. #define MANUFACTURER "GENERIC"
  3134. #define DEVICE "E14"
  3135. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3136. // Light
  3137. #define LIGHT_CHANNELS 4
  3138. #define LIGHT_CH1_PIN 4 // RED
  3139. #define LIGHT_CH2_PIN 12 // GREEN
  3140. #define LIGHT_CH3_PIN 14 // BLUE
  3141. #define LIGHT_CH4_PIN 5 // WHITE
  3142. // -----------------------------------------------------------------------------
  3143. // Deltaco white e14 (SH-LE14W) and e27 (SH-LE27W)
  3144. // -----------------------------------------------------------------------------
  3145. #elif defined(DELTACO_SH_LEXXW)
  3146. // Info
  3147. #define MANUFACTURER "DELTACO"
  3148. #define DEVICE "SH_LEXXW"
  3149. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3150. // Light
  3151. #define LIGHT_CHANNELS 2
  3152. #define LIGHT_CH1_PIN 12 // WARM WHITE
  3153. #define LIGHT_CH2_PIN 14 // COLD WHITE
  3154. // -----------------------------------------------------------------------------
  3155. // Deltaco rgbw e27 (SH-LE27RGB)
  3156. // -----------------------------------------------------------------------------
  3157. #elif defined(DELTACO_SH_LEXXRGB)
  3158. // Info
  3159. #define MANUFACTURER "DELTACO"
  3160. #define DEVICE "SH_LEXXRGB"
  3161. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3162. // Light
  3163. #define LIGHT_CHANNELS 5
  3164. #define LIGHT_CH1_PIN 5 // RED
  3165. #define LIGHT_CH2_PIN 4 // GREEN
  3166. #define LIGHT_CH3_PIN 13 // BLUE
  3167. #define LIGHT_CH4_PIN 14 // WARM WHITE
  3168. #define LIGHT_CH5_PIN 12 // COLD WHITE
  3169. // -----------------------------------------------------------------------------
  3170. // Nexete A19
  3171. // https://www.ebay.com/itm/Wifi-Smart-LED-light-Bulb-9W-60W-A19-850LM-RGBW-Dimmable-for-Alexa-Google-Home/283514779201
  3172. // -----------------------------------------------------------------------------
  3173. #elif defined(NEXETE_A19)
  3174. // Info
  3175. #define MANUFACTURER "NEXETE"
  3176. #define DEVICE "A19"
  3177. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3178. // Light
  3179. #define LIGHT_CHANNELS 4
  3180. #define LIGHT_CH1_PIN 12 // RED
  3181. #define LIGHT_CH2_PIN 15 // GREEN
  3182. #define LIGHT_CH3_PIN 14 // BLUE
  3183. #define LIGHT_CH4_PIN 5 // WHITE
  3184. // -----------------------------------------------------------------------------
  3185. // Lombex Lux Nova 2 Tunable White
  3186. // https://www.amazon.com/Lombex-Compatible-Equivalent-Dimmable-2700K-6500K/dp/B07B8K72PR
  3187. // -----------------------------------------------------------------------------
  3188. #elif defined(LOMBEX_LUX_NOVA2_TUNABLE_WHITE)
  3189. // Info
  3190. #define MANUFACTURER "LOMBEX"
  3191. #define DEVICE "LUX_NOVA2_TUNABLE_WHITE"
  3192. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  3193. // Light
  3194. #define LIGHT_CHANNELS 2
  3195. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  3196. #define MY92XX_CHIPS 1
  3197. #define MY92XX_DI_PIN 4
  3198. #define MY92XX_DCKI_PIN 5
  3199. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  3200. // No RGB on this bulb. Warm white on channel 0, cool white on channel 3
  3201. #define MY92XX_CH1 3
  3202. #define MY92XX_CH2 0
  3203. // -----------------------------------------------------------------------------
  3204. // Lombex Lux Nova 2 White and Color
  3205. // https://www.amazon.com/Lombex-Compatible-Equivalent-Dimmable-2700K-6500K/dp/B07B8K72PR
  3206. // -----------------------------------------------------------------------------
  3207. #elif defined(LOMBEX_LUX_NOVA2_WHITE_COLOR)
  3208. // Info
  3209. #define MANUFACTURER "LOMBEX"
  3210. #define DEVICE "LUX_NOVA2_WHITE_COLOR"
  3211. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  3212. // Light
  3213. #define LIGHT_CHANNELS 4
  3214. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  3215. #define MY92XX_CHIPS 1
  3216. #define MY92XX_DI_PIN 4
  3217. #define MY92XX_DCKI_PIN 5
  3218. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  3219. // RGB on channels 0/1/2, either cool or warm white on channel 3
  3220. // The bulb *should* have cool leds, but could also have warm leds as a common defect
  3221. // -----------------------------------------------------------------------------
  3222. // Bestek Smart Plug with 2 USB ports
  3223. // https://www.bestekcorp.com/bestek-smart-plug-works-with-amazon-alexa-google-assistant-and-ifttt-with-2-usb
  3224. // -----------------------------------------------------------------------------
  3225. #elif defined(BESTEK_MRJ1011)
  3226. // Info
  3227. #define MANUFACTURER "BESTEK"
  3228. #define DEVICE "MRJ1011"
  3229. // Buttons
  3230. #define BUTTON1_PIN 13
  3231. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  3232. #define BUTTON1_RELAY 1
  3233. // Relay
  3234. #define RELAY1_PIN 12
  3235. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3236. // LED
  3237. #define LED1_PIN 4
  3238. #define LED1_PIN_INVERSE 1
  3239. // -----------------------------------------------------------------------------
  3240. // GBLIFE RGBW SOCKET
  3241. // -----------------------------------------------------------------------------
  3242. #elif defined(GBLIFE_RGBW_SOCKET)
  3243. // Info
  3244. #define MANUFACTURER "GBLIFE"
  3245. #define DEVICE "RGBW_SOCKET"
  3246. // Buttons
  3247. #define BUTTON1_PIN 13
  3248. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3249. #define BUTTON1_RELAY 1
  3250. // Relays
  3251. #define RELAY1_PIN 15
  3252. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3253. // Light RGBW
  3254. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3255. #define LIGHT_CHANNELS 4
  3256. #define LIGHT_CH1_PIN 5 // RED
  3257. #define LIGHT_CH2_PIN 14 // GREEN
  3258. #define LIGHT_CH3_PIN 12 // BLUE
  3259. #define LIGHT_CH4_PIN 4 // WHITE
  3260. // ----------------------------------------------------------------------------------------
  3261. // Smart life Mini Smart Socket is similar Homecube 16A but some GPIOs differ
  3262. // https://www.ebay.de/itm/Smart-Steckdose-WIFI-WLAN-Amazon-Alexa-Fernbedienung-Home-Socket-Zeitschaltuh-DE/123352026749?hash=item1cb85a8e7d:g:IasAAOSwk6dbj390
  3263. // Also labeled NETVIP
  3264. // https://www.amazon.es/Inteligente-NETVIP-Inal%C3%A1mbrico-Interruptor-Funciona/dp/B07KH8YWS5
  3265. // ----------------------------------------------------------------------------------------
  3266. #elif defined(SMARTLIFE_MINI_SMART_SOCKET)
  3267. // Info
  3268. #define MANUFACTURER "SMARTLIFE"
  3269. #define DEVICE "MINI_SMART_SOCKET"
  3270. // Buttons
  3271. #define BUTTON1_PIN 13
  3272. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3273. #define BUTTON1_RELAY 1
  3274. // Relays
  3275. #define RELAY1_PIN 15
  3276. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3277. // LEDs
  3278. //Red LED: 0
  3279. //Green LED: 4
  3280. //Blue LED: 2
  3281. // Light
  3282. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3283. #define LIGHT_CHANNELS 3
  3284. #define LIGHT_CH1_PIN 0 // RED
  3285. #define LIGHT_CH2_PIN 4 // GREEN
  3286. #define LIGHT_CH3_PIN 2 // BLUE
  3287. // HJL01 / BL0937
  3288. #ifndef HLW8012_SUPPORT
  3289. #define HLW8012_SUPPORT 1
  3290. #endif
  3291. #define HLW8012_SEL_PIN 12
  3292. #define HLW8012_CF1_PIN 14
  3293. #define HLW8012_CF_PIN 5
  3294. #define HLW8012_SEL_CURRENT LOW
  3295. #define HLW8012_CURRENT_RATIO 25740
  3296. #define HLW8012_VOLTAGE_RATIO 313400
  3297. #define HLW8012_POWER_RATIO 3414290
  3298. #define HLW8012_INTERRUPT_ON FALLING
  3299. // ----------------------------------------------------------------------------------------
  3300. // Hama WiFi Steckdose (00176533)
  3301. // https://at.hama.com/00176533/hama-wifi-steckdose-3500w-16a
  3302. // ----------------------------------------------------------------------------------------
  3303. #elif defined(HAMA_WIFI_STECKDOSE_00176533)
  3304. // Info
  3305. #define MANUFACTURER "HAMA"
  3306. #define DEVICE "WIFI_STECKDOSE_00176533"
  3307. // Buttons
  3308. #define BUTTON1_PIN 13
  3309. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  3310. #define BUTTON1_RELAY 1
  3311. // Relays
  3312. #define RELAY1_PIN 12
  3313. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3314. // LEDs
  3315. #define LED1_PIN 4
  3316. #define LED1_PIN_INVERSE 1
  3317. // -----------------------------------------------------------------------------
  3318. // Oxaoxe NX-SP202
  3319. // Digoo NX-SP202 (not tested)
  3320. // Digoo DG-SP202 (not tested)
  3321. // https://github.com/xoseperez/espurna/issues/1502
  3322. // -----------------------------------------------------------------------------
  3323. #elif defined(DIGOO_NX_SP202)
  3324. // Info
  3325. #define MANUFACTURER "DIGOO"
  3326. #define DEVICE "NX_SP202"
  3327. // Buttons
  3328. #define BUTTON1_PIN 0
  3329. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3330. #define BUTTON1_RELAY 1
  3331. #define BUTTON2_PIN 16
  3332. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3333. #define BUTTON2_RELAY 2
  3334. // Relays
  3335. #define RELAY1_PIN 15
  3336. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3337. #define RELAY2_PIN 14
  3338. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  3339. // LEDs
  3340. #define LED1_PIN 13
  3341. #define LED1_PIN_INVERSE 1
  3342. // HJL01 / BL0937
  3343. #ifndef HLW8012_SUPPORT
  3344. #define HLW8012_SUPPORT 1
  3345. #endif
  3346. #define HLW8012_SEL_PIN 12
  3347. #define HLW8012_CF1_PIN 5
  3348. #define HLW8012_CF_PIN 4
  3349. #define HLW8012_SEL_CURRENT LOW
  3350. #define HLW8012_CURRENT_RATIO 23296
  3351. #define HLW8012_VOLTAGE_RATIO 310085
  3352. #define HLW8012_POWER_RATIO 3368471
  3353. #define HLW8012_INTERRUPT_ON FALLING
  3354. // -----------------------------------------------------------------------------
  3355. // Foxel's LightFox dual
  3356. // https://github.com/foxel/esp-dual-rf-switch
  3357. // -----------------------------------------------------------------------------
  3358. #elif defined(FOXEL_LIGHTFOX_DUAL)
  3359. // Info
  3360. #define MANUFACTURER "FOXEL"
  3361. #define DEVICE "LIGHTFOX_DUAL"
  3362. #define SERIAL_BAUDRATE 19200
  3363. // Relays
  3364. #define RELAY_PROVIDER_DUAL_SUPPORT 1
  3365. #define RELAY1_PROVIDER RELAY_PROVIDER_DUAL
  3366. #define RELAY2_PROVIDER RELAY_PROVIDER_DUAL
  3367. // No need to include generic GPIO support
  3368. // "Buttons" are attached to a secondary MCU and RELAY_PROVIDER_DUAL handles that
  3369. #define BUTTON_PROVIDER_GPIO_SUPPORT 0
  3370. // Conflicts with relay operation
  3371. #define DEBUG_SERIAL_SUPPORT 0
  3372. // -----------------------------------------------------------------------------
  3373. // Teckin SP20
  3374. // -----------------------------------------------------------------------------
  3375. #elif defined(TECKIN_SP20)
  3376. // Info
  3377. #define MANUFACTURER "TECKIN"
  3378. #define DEVICE "SP20"
  3379. // Buttons
  3380. #define BUTTON1_PIN 13
  3381. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3382. #define BUTTON1_RELAY 1
  3383. // Relays
  3384. #define RELAY1_PIN 4
  3385. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3386. // LEDs
  3387. #define LED1_PIN 2
  3388. #define LED1_PIN_INVERSE 1
  3389. #define LED2_PIN 0
  3390. #define LED2_PIN_INVERSE 1
  3391. #define LED2_MODE LED_MODE_FINDME
  3392. #define LED2_RELAY 0
  3393. // HJL01 / BL0937
  3394. #ifndef HLW8012_SUPPORT
  3395. #define HLW8012_SUPPORT 1
  3396. #endif
  3397. #define HLW8012_SEL_PIN 12
  3398. #define HLW8012_CF1_PIN 14
  3399. #define HLW8012_CF_PIN 5
  3400. #define HLW8012_SEL_CURRENT LOW
  3401. #define HLW8012_CURRENT_RATIO 25740
  3402. #define HLW8012_VOLTAGE_RATIO 313400
  3403. #define HLW8012_POWER_RATIO 3414290
  3404. #define HLW8012_INTERRUPT_ON FALLING
  3405. // -----------------------------------------------------------------------------
  3406. // Charging Essentials / LITESUN LA-WF3
  3407. // -----------------------------------------------------------------------------
  3408. #elif defined(LITESUN_LA_WF3)
  3409. // Info
  3410. #define MANUFACTURER "LITESUN"
  3411. #define DEVICE "LA_WF3"
  3412. // Buttons
  3413. #define BUTTON1_PIN 13
  3414. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3415. #define BUTTON1_RELAY 1
  3416. // Relays
  3417. #define RELAY1_PIN 12
  3418. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3419. // LEDs
  3420. #define LED1_PIN 4 // 4 blue led
  3421. #define LED1_MODE LED_MODE_WIFI
  3422. #define LED1_PIN_INVERSE 1
  3423. #define LED2_PIN 5 // 5 red led
  3424. #define LED2_MODE LED_MODE_RELAY
  3425. #define LED2_PIN_INVERSE 1
  3426. // -----------------------------------------------------------------------------
  3427. // PSH
  3428. // -----------------------------------------------------------------------------
  3429. #elif defined(PSH_WIFI_PLUG)
  3430. // Info
  3431. #define MANUFACTURER "PSH"
  3432. #define DEVICE "WIFI_PLUG"
  3433. // Relays
  3434. #define RELAY1_PIN 2
  3435. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3436. // LEDs
  3437. #define LED1_PIN 0
  3438. #define LED1_PIN_INVERSE 0
  3439. #elif defined(PSH_RGBW_CONTROLLER)
  3440. // Info
  3441. #define MANUFACTURER "PSH"
  3442. #define DEVICE "RGBW_CONTROLLER"
  3443. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3444. // LEDs
  3445. #define LED1_PIN 13
  3446. #define LED1_PIN_INVERSE 1
  3447. // Light
  3448. #define LIGHT_CHANNELS 4
  3449. #define LIGHT_CH1_PIN 5 // RED
  3450. #define LIGHT_CH2_PIN 4 // GREEN
  3451. #define LIGHT_CH3_PIN 12 // BLUE
  3452. #define LIGHT_CH4_PIN 14 // WHITE1
  3453. #elif defined(PSH_WIFI_SENSOR)
  3454. // Info
  3455. #define MANUFACTURER "PSH"
  3456. #define DEVICE "WIFI_SENSOR"
  3457. // DHT12 Sensor
  3458. #define DHT_SUPPORT 1
  3459. #define DHT_PIN 14
  3460. #define DHT_TYPE DHT_CHIP_DHT12
  3461. // LDR Sensor
  3462. #define LDR_SUPPORT 1
  3463. #define LDR_TYPE LDR_GL5528
  3464. #define LDR_ON_GROUND false
  3465. #define LDR_RESISTOR 10000
  3466. #elif defined(JINVOO_VALVE_SM_AW713)
  3467. // Reflashing from original Tuya firmware
  3468. // to thirdparty firmware like espurna by:
  3469. // https://github.com/ct-Open-Source/tuya-convert
  3470. // Info
  3471. #define MANUFACTURER "JINVOO"
  3472. #define DEVICE "VALVE_SM_AW713"
  3473. // Buttons
  3474. #define BUTTON1_PIN 13
  3475. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3476. #define BUTTON1_RELAY 1
  3477. // Relays
  3478. #define RELAY1_PIN 12
  3479. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3480. // LED
  3481. #define LED1_PIN 5 // 5 red led
  3482. #define LED1_PIN_INVERSE 0
  3483. #define LED1_RELAY 1
  3484. #define LED1_MODE LED_MODE_RELAY
  3485. #define LED2_PIN 4 // 4 blue led
  3486. #define LED2_PIN_INVERSE 0
  3487. #define LED2_RELAY 1
  3488. #define LED2_MODE LED_MODE_FINDME_WIFI
  3489. #elif defined(TUYA_GENERIC_DIMMER)
  3490. #define MANUFACTURER "TUYA"
  3491. #define DEVICE "GENERIC_DIMMER"
  3492. #define TUYA_SUPPORT 1
  3493. #define LIGHT_PROVIDER LIGHT_PROVIDER_CUSTOM
  3494. #define LED1_GPIO 14
  3495. #define TUYA_CH_STATE_DPID 1
  3496. #define TUYA_CH1_DPID 2
  3497. #define DEBUG_SERIAL_SUPPORT 0
  3498. // -----------------------------------------------------------------------------
  3499. // Etekcity ESW01-USA
  3500. // https://www.amazon.com/Etekcity-Voltson-Outlet-Monitoring-Required/dp/B01M3MYIFS
  3501. // -----------------------------------------------------------------------------
  3502. #elif defined(ETEKCITY_ESW01_USA)
  3503. // Info
  3504. #define MANUFACTURER "ETEKCITY"
  3505. #define DEVICE "ESW01_USA"
  3506. // Buttons
  3507. #define BUTTON1_PIN 14
  3508. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3509. #define BUTTON1_RELAY 1
  3510. // Relays
  3511. #define RELAY1_PIN 4
  3512. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3513. // LEDs
  3514. // Blue
  3515. #define LED1_PIN 5
  3516. #define LED1_MODE LED_MODE_WIFI
  3517. // Yellow
  3518. #define LED2_PIN 16
  3519. #define LED2_MODE LED_MODE_FOLLOW
  3520. #define LED2_RELAY 1
  3521. // HLW8012
  3522. #ifndef HLW8012_SUPPORT
  3523. #define HLW8012_SUPPORT 1
  3524. #endif
  3525. #define HLW8012_SEL_PIN 15
  3526. #define HLW8012_CF1_PIN 12
  3527. #define HLW8012_CF_PIN 13
  3528. #define HLW8012_SEL_CURRENT HIGH // SEL pin to HIGH to measure current
  3529. #define HLW8012_CURRENT_R 0.001 // Current resistor
  3530. #define HLW8012_VOLTAGE_R_UP ( 4 * 470000 ) // Upstream voltage resistor
  3531. #define HLW8012_VOLTAGE_R_DOWN ( 1000 ) // Downstream voltage resistor
  3532. #define HLW8012_INTERRUPT_ON CHANGE
  3533. // -----------------------------------------------------------------------------
  3534. // FS UAP1
  3535. // http://frank-schuetz.de/index.php/fhem/13-hoermann-torantrieb-mit-espeasy-in-fhem-einbinden
  3536. #elif defined(FS_UAP1)
  3537. // Info
  3538. #define MANUFACTURER "FS"
  3539. #define DEVICE "UAP1"
  3540. // Inputs
  3541. #define DIGITAL1_PIN 4
  3542. #define DIGITAL2_PIN 5
  3543. // Relays
  3544. #define RELAY1_PIN 12
  3545. #define RELAY2_PIN 13
  3546. #define RELAY3_PIN 14
  3547. #define RELAY4_PIN 15
  3548. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3549. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  3550. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  3551. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  3552. // LEDs
  3553. #define LED1_PIN 2
  3554. // Disable UART noise
  3555. #define DEBUG_SERIAL_SUPPORT 0
  3556. // -----------------------------------------------------------------------------
  3557. // TFLAG NX-SM100 & NX-SM200
  3558. // -----------------------------------------------------------------------------
  3559. #elif defined(TFLAG_NX_SMX00)
  3560. // Info
  3561. #define MANUFACTURER "TFLAG"
  3562. #define DEVICE "NX_SMX00"
  3563. // Buttons
  3564. #define BUTTON1_PIN 13
  3565. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3566. #define BUTTON1_RELAY 1
  3567. // Relays
  3568. #define RELAY1_PIN 12
  3569. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3570. // LEDs
  3571. #define LED1_PIN 0
  3572. #define LED1_PIN_INVERSE 1
  3573. #define LED1_MODE LED_MODE_FOLLOW_INVERSE
  3574. #define LED1_RELAY 1
  3575. #define LED2_PIN 15
  3576. #define LED2_PIN_INVERSE 1
  3577. #define LED2_MODE LED_MODE_WIFI
  3578. // HJL01 / BL0937
  3579. #ifndef HLW8012_SUPPORT
  3580. #define HLW8012_SUPPORT 1
  3581. #endif
  3582. #define HLW8012_SEL_PIN 16
  3583. #define HLW8012_CF1_PIN 14
  3584. #define HLW8012_CF_PIN 5
  3585. #define HLW8012_SEL_CURRENT LOW
  3586. #define HLW8012_CURRENT_RATIO 632
  3587. #define HLW8012_VOLTAGE_RATIO 313400
  3588. #define HLW8012_POWER_RATIO 3711185
  3589. #define HLW8012_INTERRUPT_ON FALLING
  3590. // -----------------------------------------------------------------------------
  3591. // MUVIT_IO_MIOBULB001
  3592. // -----------------------------------------------------------------------------
  3593. #elif defined(MUVIT_IO_MIOBULB001)
  3594. // Info
  3595. #define MANUFACTURER "MUVIT_IO"
  3596. #define DEVICE "MIOBULB001"
  3597. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3598. // Light
  3599. #define LIGHT_CHANNELS 4
  3600. #define LIGHT_CH1_PIN 14 // RED
  3601. #define LIGHT_CH2_PIN 12 // GREEN
  3602. #define LIGHT_CH3_PIN 13 // BLUE
  3603. #define LIGHT_CH4_PIN 4 // WHITE
  3604. // -----------------------------------------------------------------------------
  3605. // Hykker Power Plug (Smart Home Series) available in Jerónimo Martins Polska (Biedronka)
  3606. // https://www.hykker.com/akcesoria/gniazdo-wi-fi-z-licznikiem-energii/
  3607. // Reflashing from original Tuya firmware
  3608. // to thirdparty firmware like espurna by:
  3609. // https://github.com/ct-Open-Source/tuya-convert
  3610. // -----------------------------------------------------------------------------
  3611. #elif defined(HYKKER_SMART_HOME_POWER_PLUG)
  3612. // Info
  3613. #define MANUFACTURER "HYKKER"
  3614. #define DEVICE "SMART_HOME_POWER_PLUG"
  3615. // Buttons
  3616. #define BUTTON1_PIN 0
  3617. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3618. #define BUTTON1_RELAY 1
  3619. // Relays
  3620. #define RELAY1_PIN 14
  3621. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3622. // LED
  3623. // Red
  3624. #define LED1_PIN 13
  3625. #define LED1_MODE LED_MODE_WIFI
  3626. #define LED1_PIN_INVERSE 1
  3627. // Blue connected to relay
  3628. // HLW8012
  3629. #ifndef HLW8012_SUPPORT
  3630. #define HLW8012_SUPPORT 1
  3631. #endif
  3632. #define HLW8012_SEL_PIN 12
  3633. #define HLW8012_CF1_PIN 5
  3634. #define HLW8012_CF_PIN 4
  3635. #define HLW8012_SEL_CURRENT LOW
  3636. #define HLW8012_CURRENT_RATIO 25740
  3637. #define HLW8012_VOLTAGE_RATIO 282060
  3638. #define HLW8012_POWER_RATIO 3414290
  3639. #define HLW8012_INTERRUPT_ON FALLING
  3640. // -----------------------------------------------------------------------------
  3641. // Kogan Smarter Home Plug with Energy Meter (Australia)
  3642. // Product code: KASPEMHA
  3643. // https://www.kogan.com/au/buy/kogan-smarterhome-smart-plug-energy-meter/
  3644. // Reflashing from original Tuya firmware
  3645. // to thirdparty firmware like espurna by:
  3646. // https://github.com/ct-Open-Source/tuya-convert
  3647. // -----------------------------------------------------------------------------
  3648. #elif defined(KOGAN_SMARTER_HOME_PLUG_W_POW)
  3649. // Info
  3650. #define MANUFACTURER "KOGAN"
  3651. #define DEVICE "SMARTER_HOME_PLUG_W_POW"
  3652. // Buttons
  3653. #define BUTTON1_PIN 0
  3654. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
  3655. #define BUTTON1_RELAY 1
  3656. // Relays
  3657. #define RELAY1_PIN 14
  3658. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3659. // LED
  3660. // Red
  3661. #define LED1_PIN 13
  3662. #define LED1_MODE LED_MODE_WIFI
  3663. #define LED1_PIN_INVERSE 1
  3664. // Blue connected to relay
  3665. // HLW8012
  3666. #ifndef HLW8012_SUPPORT
  3667. #define HLW8012_SUPPORT 1
  3668. #endif
  3669. #define HLW8012_SEL_PIN 12
  3670. #define HLW8012_CF1_PIN 5
  3671. #define HLW8012_CF_PIN 4
  3672. #define HLW8012_SEL_CURRENT LOW
  3673. #define HLW8012_CURRENT_RATIO 25740
  3674. #define HLW8012_VOLTAGE_RATIO 282060
  3675. #define HLW8012_POWER_RATIO 3414290
  3676. #define HLW8012_INTERRUPT_ON FALLING
  3677. // -----------------------------------------------------------------------------
  3678. // KINGART_CURTAIN_SWITCH
  3679. // -----------------------------------------------------------------------------
  3680. #elif defined(KINGART_CURTAIN_SWITCH)
  3681. // Info
  3682. #define MANUFACTURER "KINGART"
  3683. #define DEVICE "CURTAIN_SWITCH"
  3684. #define CURTAIN_SUPPORT 1
  3685. // LEDs
  3686. #define LED1_PIN 13
  3687. #define LED1_PIN_INVERSE 1
  3688. // KINGART module handles the UART, can't print any debug messages
  3689. #define KINGART_CURTAIN_SUPPORT 1
  3690. #define DEBUG_SERIAL_SUPPORT 0
  3691. // -----------------------------------------------------------------------------
  3692. // LSC Smart LED Light Strip (Smart CXonnect Series) available ACTION (Germany)
  3693. // https://www.action.com/de-de/p/lsc-smart-connect-intelligenter-multicolor-led-strip-/
  3694. // Reflashing from original Tuya firmware
  3695. // to thirdparty firmware like espurna by:
  3696. // https://github.com/ct-Open-Source/tuya-convert
  3697. // -----------------------------------------------------------------------------
  3698. #elif defined(LSC_SMART_LED_LIGHT_STRIP)
  3699. // Info
  3700. #define MANUFACTURER "LSC"
  3701. #define DEVICE "SMART_LED_LIGHT_STRIP"
  3702. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3703. // Light RGBW
  3704. #define LIGHT_CHANNELS 4
  3705. #define LIGHT_CH1_PIN 4 // RED
  3706. #define LIGHT_CH2_PIN 12 // GREEN
  3707. #define LIGHT_CH3_PIN 14 // BLUE
  3708. #define LIGHT_CH4_PIN 13 // WHITE
  3709. // #define LIGHT_CH5_PIN 5 // CW (not connected, but circuit supports it)
  3710. // IR
  3711. #define IR_SUPPORT 1
  3712. #define IR_RX_PIN 0
  3713. #define IR_BUTTON_SET 5
  3714. // -----------------------------------------------------------------------------
  3715. // eHomeDIY WT02
  3716. // https://github.com/eHomeDIY/WT02-hardware
  3717. // -----------------------------------------------------------------------------
  3718. #elif defined(EHOMEDIY_WT02)
  3719. // Info
  3720. #define MANUFACTURER "EHOMEDIY"
  3721. #define DEVICE "WT02"
  3722. #define I2C_SDA_PIN 0
  3723. #define I2C_SCL_PIN 2
  3724. #define BMX280_SUPPORT 1
  3725. // #define SI7021_SUPPORT 1
  3726. // -----------------------------------------------------------------------------
  3727. // eHomeDIY WT03
  3728. // https://github.com/eHomeDIY/WT03-hardware
  3729. // -----------------------------------------------------------------------------
  3730. #elif defined(EHOMEDIY_WT03)
  3731. // Info
  3732. #define MANUFACTURER "EHOMEDIY"
  3733. #define DEVICE "WT03"
  3734. #define I2C_SDA_PIN 2
  3735. #define I2C_SCL_PIN 0
  3736. #define BMX280_SUPPORT 1
  3737. // #define SI7021_SUPPORT 1
  3738. // -----------------------------------------------------------------------------
  3739. // Linksprite R4
  3740. // http://linksprite.com/wiki/index.php?title=LinkNode_R4:_Arduino-compatible_WiFi_relay_controller
  3741. // -----------------------------------------------------------------------------
  3742. #elif defined(LINKSPRITE_LINKNODE_R4)
  3743. // Info
  3744. #define MANUFACTURER "LINKSPRITE"
  3745. #define DEVICE "LINKNODE_R4"
  3746. // Relays
  3747. #define RELAY1_PIN 12
  3748. #define RELAY2_PIN 13
  3749. #define RELAY3_PIN 14
  3750. #define RELAY4_PIN 16
  3751. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3752. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  3753. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  3754. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  3755. // -----------------------------------------------------------------------------
  3756. // NEDIS WIFIP310FWT Wi-Fi Smart Extension Socket
  3757. // 3x Schuko Type F, 4x USB, 16 A
  3758. // https://nedis.com/en-us/product/smart-living/smart-home/energy/550672299/wi-fi-smart-extension-socket-3x-schuko-type-f-4x-usb-16-a
  3759. // -----------------------------------------------------------------------------
  3760. #elif defined(NEDIS_WIFIP310FWT)
  3761. // Info
  3762. #define MANUFACTURER "NEDIS"
  3763. #define DEVICE "WIFIP310FWT"
  3764. // Based on the reporter, this product uses GPIO1 and 3 for the button
  3765. // and onboard LED, so hardware serial should be disabled...
  3766. #define DEBUG_SERIAL_SUPPORT 0
  3767. // Buttons
  3768. #define BUTTON1_PIN 3
  3769. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3770. // Relays
  3771. #define RELAY1_PIN 5
  3772. #define RELAY2_PIN 4
  3773. #define RELAY3_PIN 13
  3774. #define RELAY4_PIN 14
  3775. // LEDs
  3776. #define LED1_PIN 1
  3777. #define LED1_PIN_INVERSE 1
  3778. // -----------------------------------------------------------------------------
  3779. // Arlec Smart PC190HA Plug
  3780. // https://templates.blakadder.com/arlec_PC190HA.html
  3781. // -----------------------------------------------------------------------------
  3782. #elif defined(ARLEC_PC190HA)
  3783. // Info
  3784. #define MANUFACTURER "ARLEC"
  3785. #define DEVICE "PC190HA"
  3786. // Buttons
  3787. #define BUTTON1_PIN 14
  3788. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3789. #define BUTTON1_RELAY 1
  3790. // Relays
  3791. #define RELAY1_PIN 12
  3792. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  3793. // LEDs
  3794. #define LED1_PIN 4 // blue LED
  3795. #define LED1_PIN_INVERSE 1
  3796. #define LED2_PIN 13 // red LED
  3797. #define LED2_PIN_INVERSE 1
  3798. // -----------------------------------------------------------------------------
  3799. // Arlec Smart PB89HA Power Strip
  3800. // https://templates.blakadder.com/arlec_PB89HA.html
  3801. // -----------------------------------------------------------------------------
  3802. #elif defined(ARLEC_PB89HA)
  3803. // Info
  3804. #define MANUFACTURER "ARLEC"
  3805. #define DEVICE "PB89HA"
  3806. // Buttons
  3807. #define BUTTON1_PIN 3
  3808. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3809. // Relays
  3810. #define RELAY1_PIN 5
  3811. #define RELAY2_PIN 4
  3812. #define RELAY3_PIN 13
  3813. #define RELAY4_PIN 12
  3814. // LEDs
  3815. #define LED1_PIN 1
  3816. #define LED1_PIN_INVERSE 1
  3817. // -----------------------------------------------------------------------------
  3818. // Prodino WIFI
  3819. // https://kmpelectronics.eu/products/prodino-wifi-v1/
  3820. // -----------------------------------------------------------------------------
  3821. #elif defined(PRODINO_WIFI)
  3822. // Info
  3823. #define MANUFACTURER "PRODINO"
  3824. #define DEVICE "WIFI"
  3825. // MCP23S08
  3826. #define MCP23S08_SUPPORT 1
  3827. // Relays
  3828. #define RELAY1_PIN 4
  3829. #define RELAY1_PIN_TYPE GPIO_TYPE_MCP23S08
  3830. #define RELAY2_PIN 5
  3831. #define RELAY2_PIN_TYPE GPIO_TYPE_MCP23S08
  3832. #define RELAY3_PIN 6
  3833. #define RELAY3_PIN_TYPE GPIO_TYPE_MCP23S08
  3834. #define RELAY4_PIN 7
  3835. #define RELAY4_PIN_TYPE GPIO_TYPE_MCP23S08
  3836. // Buttons
  3837. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3838. #define BUTTON1_PIN 0
  3839. #define BUTTON1_PIN_TYPE GPIO_TYPE_MCP23S08
  3840. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3841. #define BUTTON2_PIN 1
  3842. #define BUTTON2_PIN_TYPE GPIO_TYPE_MCP23S08
  3843. #define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3844. #define BUTTON3_PIN 2
  3845. #define BUTTON3_PIN_TYPE GPIO_TYPE_MCP23S08
  3846. #define BUTTON4_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  3847. #define BUTTON4_PIN 3
  3848. #define BUTTON4_PIN_TYPE GPIO_TYPE_MCP23S08
  3849. #define BUTTON1_RELAY 1
  3850. #define BUTTON2_RELAY 2
  3851. #define BUTTON3_RELAY 3
  3852. #define BUTTON4_RELAY 4
  3853. // LEDs
  3854. #define LED1_PIN 2
  3855. #define LED1_PIN_INVERSE 1
  3856. // -----------------------------------------------------------------------------
  3857. // Fcmila E27 7W RGB+W Bulb
  3858. // https://www.aliexpress.com/item/32925895199.html
  3859. // -----------------------------------------------------------------------------
  3860. #elif defined(FCMILA_E27_7W_RGBW)
  3861. // Info
  3862. #define MANUFACTURER "FCMILA"
  3863. #define DEVICE "E27_7W_RGBW"
  3864. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3865. // Light
  3866. #define LIGHT_CHANNELS 4
  3867. #define LIGHT_CH1_PIN 4 // RED
  3868. #define LIGHT_CH2_PIN 12 // GREEN
  3869. #define LIGHT_CH3_PIN 14 // BLUE
  3870. #define LIGHT_CH4_PIN 5 // WHITE
  3871. // -----------------------------------------------------------------------------
  3872. // Benexmart 5W GU5.3 (MR16) RGBWW
  3873. // https://www.aliexpress.com/item/4001245365644.html
  3874. // -----------------------------------------------------------------------------
  3875. #elif defined(BENEXMART_GU53_RGBWW)
  3876. // Info
  3877. #define MANUFACTURER "BENEXMART"
  3878. #define DEVICE "GU53_RGBWW"
  3879. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3880. // Light
  3881. #define LIGHT_CHANNELS 5
  3882. #define LIGHT_CH1_PIN 4 // RED
  3883. #define LIGHT_CH2_PIN 12 // GREEN
  3884. #define LIGHT_CH3_PIN 14 // BLUE
  3885. #define LIGHT_CH4_PIN 5 // WARM WHITE
  3886. #define LIGHT_CH5_PIN 13 // COLD WHITE
  3887. // LSC E27 10W White Bulb with TYLC6E ESP8266 module
  3888. // https://www.action.com/de-at/p/lsc-smart-connect-intelligente-led-lampe/
  3889. // -----------------------------------------------------------------------------
  3890. #elif defined(LSC_E27_10W_WHITE)
  3891. // Info
  3892. #define MANUFACTURER "LSC"
  3893. #define DEVICE "E27_10W_WHITE"
  3894. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  3895. // Light
  3896. #define LIGHT_CHANNELS 2
  3897. #define LIGHT_CH1_PIN 5 // WARM WHITE LED PWM PIN
  3898. #define LIGHT_CH1_INVERSE 0
  3899. #define LIGHT_CH2_PIN 4 // COLD WHITE LED PWM PIN
  3900. #define LIGHT_CH2_INVERSE 0
  3901. #else
  3902. #error "UNSUPPORTED HARDWARE!!"
  3903. #endif