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.

5010 lines
162 KiB

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