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.

2240 lines
69 KiB

7 years ago
7 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
6 years ago
  1. // -----------------------------------------------------------------------------
  2. // Configuration HELP
  3. // -----------------------------------------------------------------------------
  4. //
  5. // MANUFACTURER: Name of the manufacturer of the board ("string")
  6. // DEVICE: Name of the device ("string")
  7. // BUTTON#_PIN: GPIO for the n-th button (1-based, up to 4 buttons)
  8. // BUTTON#_RELAY: Relay number that will be bind to the n-th button (1-based)
  9. // BUTTON#_MODE: A mask of options (BUTTON_PUSHBUTTON and BUTTON_SWITCH cannot be together)
  10. // - BUTTON_PUSHBUTTON: button event is fired when released
  11. // - BUTTON_SWITCH: button event is fired when pressed or released
  12. // - BUTTON_DEFAULT_HIGH: there is a pull up in place
  13. // - BUTTON_SET_PULLUP: set pullup by software
  14. // RELAY#_PIN: GPIO for the n-th relay (1-based, up to 8 relays)
  15. // RELAY#_TYPE: Relay can be RELAY_TYPE_NORMAL, RELAY_TYPE_INVERSE, RELAY_TYPE_LATCHED or RELAY_TYPE_LATCHED_INVERSE
  16. // LED#_PIN: GPIO for the n-th LED (1-based, up to 8 LEDs)
  17. // LED#_PIN_INVERSE: LED has inversed logic (lit when pulled down)
  18. // LED#_MODE: Check general.h for LED_MODE_%
  19. // LED#_RELAY: Linked relay (1-based)
  20. //
  21. // Besides, other hardware specific information should be stated here
  22. // -----------------------------------------------------------------------------
  23. // ESPurna Core
  24. // -----------------------------------------------------------------------------
  25. #if defined(ESPURNA_CORE)
  26. // This is a special device targeted to generate a light-weight binary image
  27. // meant to be able to do two-step-updates:
  28. // https://github.com/xoseperez/espurna/wiki/TwoStepUpdates
  29. // Info
  30. #define MANUFACTURER "ESPRESSIF"
  31. #define DEVICE "ESPURNA_CORE"
  32. // Disable non-core modules
  33. #define ALEXA_SUPPORT 0
  34. #define BROKER_SUPPORT 0
  35. #define DOMOTICZ_SUPPORT 0
  36. #define HOMEASSISTANT_SUPPORT 0
  37. #define I2C_SUPPORT 0
  38. #define MQTT_SUPPORT 0
  39. #define NTP_SUPPORT 0
  40. #define SCHEDULER_SUPPORT 0
  41. #define SENSOR_SUPPORT 0
  42. #define THINGSPEAK_SUPPORT 0
  43. #define WEB_SUPPORT 0
  44. // -----------------------------------------------------------------------------
  45. // Development boards
  46. // -----------------------------------------------------------------------------
  47. #elif defined(NODEMCU_LOLIN)
  48. // Info
  49. #define MANUFACTURER "NODEMCU"
  50. #define DEVICE "LOLIN"
  51. // Buttons
  52. #define BUTTON1_PIN 0
  53. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  54. #define BUTTON1_RELAY 1
  55. // Relays
  56. #define RELAY1_PIN 12
  57. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  58. // LEDs
  59. #define LED1_PIN 2
  60. #define LED1_PIN_INVERSE 1
  61. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  62. // Info
  63. #define MANUFACTURER "WEMOS"
  64. #define DEVICE "D1_MINI_RELAYSHIELD"
  65. // Buttons
  66. // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems
  67. #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND,
  68. // it's the same as using a Wemos one button shield
  69. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  70. #define BUTTON1_RELAY 1
  71. // Relays
  72. #define RELAY1_PIN 5
  73. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  74. // LEDs
  75. #define LED1_PIN 2
  76. #define LED1_PIN_INVERSE 1
  77. // When Wemos relay shield is connected GPIO5 (D1) is used for relay,
  78. // so I2C must be remapped to other pins
  79. #define I2C_SDA_PIN 12 // D6
  80. #define I2C_SCL_PIN 14 // D5
  81. #elif defined(WEMOS_D1_TARPUNA_SHIELD)
  82. // Info
  83. #define MANUFACTURER "WEMOS"
  84. #define DEVICE "D1_TARPUNA_SHIELD"
  85. // -----------------------------------------------------------------------------
  86. // ESPurna
  87. // -----------------------------------------------------------------------------
  88. #elif defined(TINKERMAN_ESPURNA_H06)
  89. // Info
  90. #define MANUFACTURER "TINKERMAN"
  91. #define DEVICE "ESPURNA_H06"
  92. // Buttons
  93. #define BUTTON1_PIN 4
  94. #define BUTTON1_RELAY 1
  95. // Normal pushbutton
  96. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  97. // Relays
  98. #define RELAY1_PIN 12
  99. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  100. // LEDs
  101. #define LED1_PIN 2
  102. #define LED1_PIN_INVERSE 1
  103. // HLW8012
  104. #ifndef HLW8012_SUPPORT
  105. #define HLW8012_SUPPORT 1
  106. #endif
  107. #define HLW8012_SEL_PIN 2
  108. #define HLW8012_CF1_PIN 13
  109. #define HLW8012_CF_PIN 14
  110. #elif defined(TINKERMAN_ESPURNA_H08)
  111. // Info
  112. #define MANUFACTURER "TINKERMAN"
  113. #define DEVICE "ESPURNA_H08"
  114. // Buttons
  115. #define BUTTON1_PIN 4
  116. #define BUTTON1_RELAY 1
  117. // Normal pushbutton
  118. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  119. // Relays
  120. #define RELAY1_PIN 12
  121. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  122. // LEDs
  123. #define LED1_PIN 2
  124. #define LED1_PIN_INVERSE 0
  125. // HLW8012
  126. #ifndef HLW8012_SUPPORT
  127. #define HLW8012_SUPPORT 1
  128. #endif
  129. #define HLW8012_SEL_PIN 5
  130. #define HLW8012_CF1_PIN 13
  131. #define HLW8012_CF_PIN 14
  132. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  133. // Info
  134. #define MANUFACTURER "TINKERMAN"
  135. #define DEVICE "ESPURNA_SWITCH"
  136. // Buttons
  137. #define BUTTON1_PIN 4
  138. #define BUTTON1_RELAY 1
  139. // Touch button
  140. #define BUTTON1_MODE BUTTON_PUSHBUTTON
  141. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  142. #define BUTTON1_CLICK BUTTON_MODE_NONE
  143. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  144. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  145. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
  146. // LEDs
  147. #define LED1_PIN 2
  148. #define LED1_PIN_INVERSE 0
  149. // Relays
  150. #define RELAY1_PIN 12
  151. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  152. // -----------------------------------------------------------------------------
  153. // Itead Studio boards
  154. // -----------------------------------------------------------------------------
  155. #elif defined(ITEAD_SONOFF_BASIC)
  156. // Info
  157. #define MANUFACTURER "ITEAD"
  158. #define DEVICE "SONOFF_BASIC"
  159. // Buttons
  160. #define BUTTON1_PIN 0
  161. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  162. #define BUTTON1_RELAY 1
  163. #define BUTTON2_PIN 14
  164. #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  165. #define BUTTON2_RELAY 1
  166. // Relays
  167. #define RELAY1_PIN 12
  168. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  169. // LEDs
  170. #define LED1_PIN 13
  171. #define LED1_PIN_INVERSE 1
  172. #elif defined(ITEAD_SONOFF_RF)
  173. // Info
  174. #define MANUFACTURER "ITEAD"
  175. #define DEVICE "SONOFF_RF"
  176. // Buttons
  177. #define BUTTON1_PIN 0
  178. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  179. #define BUTTON1_RELAY 1
  180. #define BUTTON2_PIN 14
  181. #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  182. #define BUTTON2_RELAY 1
  183. // Relays
  184. #define RELAY1_PIN 12
  185. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  186. // LEDs
  187. #define LED1_PIN 13
  188. #define LED1_PIN_INVERSE 1
  189. #elif defined(ITEAD_SONOFF_TH)
  190. // Info
  191. #define MANUFACTURER "ITEAD"
  192. #define DEVICE "SONOFF_TH"
  193. // Buttons
  194. #define BUTTON1_PIN 0
  195. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  196. #define BUTTON1_RELAY 1
  197. // Relays
  198. #define RELAY1_PIN 12
  199. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  200. // LEDs
  201. #define LED1_PIN 13
  202. #define LED1_PIN_INVERSE 1
  203. // Jack is connected to GPIO14 (and with a small hack to GPIO4)
  204. #ifndef DALLAS_SUPPORT
  205. #define DALLAS_SUPPORT 1
  206. #endif
  207. #define DALLAS_PIN 14
  208. #ifndef DHT_SUPPORT
  209. #define DHT_SUPPORT 1
  210. #endif
  211. #define DHT_PIN 14
  212. //#define I2C_SDA_PIN 4
  213. //#define I2C_SCL_PIN 14
  214. #elif defined(ITEAD_SONOFF_SV)
  215. // Info
  216. #define MANUFACTURER "ITEAD"
  217. #define DEVICE "SONOFF_SV"
  218. // Buttons
  219. #define BUTTON1_PIN 0
  220. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  221. #define BUTTON1_RELAY 1
  222. // Relays
  223. #define RELAY1_PIN 12
  224. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  225. // LEDs
  226. #define LED1_PIN 13
  227. #define LED1_PIN_INVERSE 1
  228. #elif defined(ITEAD_SLAMPHER)
  229. // Info
  230. #define MANUFACTURER "ITEAD"
  231. #define DEVICE "SLAMPHER"
  232. // Buttons
  233. #define BUTTON1_PIN 0
  234. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  235. #define BUTTON1_RELAY 1
  236. // Relays
  237. #define RELAY1_PIN 12
  238. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  239. // LEDs
  240. #define LED1_PIN 13
  241. #define LED1_PIN_INVERSE 1
  242. #elif defined(ITEAD_S20)
  243. // Info
  244. #define MANUFACTURER "ITEAD"
  245. #define DEVICE "S20"
  246. // Buttons
  247. #define BUTTON1_PIN 0
  248. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  249. #define BUTTON1_RELAY 1
  250. // Relays
  251. #define RELAY1_PIN 12
  252. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  253. // LEDs
  254. #define LED1_PIN 13
  255. #define LED1_PIN_INVERSE 1
  256. #elif defined(ITEAD_SONOFF_TOUCH)
  257. // Info
  258. #define MANUFACTURER "ITEAD"
  259. #define DEVICE "SONOFF_TOUCH"
  260. // Buttons
  261. #define BUTTON1_PIN 0
  262. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  263. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  264. #define BUTTON1_CLICK BUTTON_MODE_NONE
  265. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  266. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  267. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET
  268. #define BUTTON1_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_POW)
  276. // Info
  277. #define MANUFACTURER "ITEAD"
  278. #define DEVICE "SONOFF_POW"
  279. // Buttons
  280. #define BUTTON1_PIN 0
  281. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  282. #define BUTTON1_RELAY 1
  283. // Relays
  284. #define RELAY1_PIN 12
  285. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  286. // LEDs
  287. #define LED1_PIN 15
  288. #define LED1_PIN_INVERSE 0
  289. // HLW8012
  290. #ifndef HLW8012_SUPPORT
  291. #define HLW8012_SUPPORT 1
  292. #endif
  293. #define HLW8012_SEL_PIN 5
  294. #define HLW8012_CF1_PIN 13
  295. #define HLW8012_CF_PIN 14
  296. #elif defined(ITEAD_SONOFF_POW_R2)
  297. // Info
  298. #define MANUFACTURER "ITEAD"
  299. #define DEVICE "SONOFF_POW_R2"
  300. // Buttons
  301. #define BUTTON1_PIN 0
  302. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  303. #define BUTTON1_RELAY 1
  304. // Relays
  305. #define RELAY1_PIN 12
  306. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  307. // LEDs
  308. #define LED1_PIN 15
  309. #define LED1_PIN_INVERSE 0
  310. // CSE7766
  311. #ifndef CSE7766_SUPPORT
  312. #define CSE7766_SUPPORT 1
  313. #endif
  314. #define CSE7766_PIN 1
  315. #elif defined(ITEAD_SONOFF_DUAL)
  316. // Info
  317. #define MANUFACTURER "ITEAD"
  318. #define DEVICE "SONOFF_DUAL"
  319. #define SERIAL_BAUDRATE 19230
  320. #define RELAY_PROVIDER RELAY_PROVIDER_DUAL
  321. #define DUMMY_RELAY_COUNT 2
  322. #define DEBUG_SERIAL_SUPPORT 0
  323. // Buttons
  324. #define BUTTON3_RELAY 1
  325. // LEDs
  326. #define LED1_PIN 13
  327. #define LED1_PIN_INVERSE 1
  328. #elif defined(ITEAD_SONOFF_DUAL_R2)
  329. #define MANUFACTURER "ITEAD"
  330. #define DEVICE "SONOFF_DUAL_R2"
  331. // Buttons
  332. #define BUTTON1_PIN 0 // Button 0 on header
  333. #define BUTTON2_PIN 9 // Button 1 on header
  334. #define BUTTON3_PIN 10 // Physical button
  335. #define BUTTON1_RELAY 1
  336. #define BUTTON2_RELAY 2
  337. #define BUTTON3_RELAY 1
  338. #define BUTTON1_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  339. #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  340. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  341. // Relays
  342. #define RELAY1_PIN 12
  343. #define RELAY2_PIN 5
  344. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  345. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  346. // LEDs
  347. #define LED1_PIN 13
  348. #define LED1_PIN_INVERSE 1
  349. #elif defined(ITEAD_SONOFF_4CH)
  350. // Info
  351. #define MANUFACTURER "ITEAD"
  352. #define DEVICE "SONOFF_4CH"
  353. // Buttons
  354. #define BUTTON1_PIN 0
  355. #define BUTTON2_PIN 9
  356. #define BUTTON3_PIN 10
  357. #define BUTTON4_PIN 14
  358. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  359. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  360. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  361. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  362. #define BUTTON1_RELAY 1
  363. #define BUTTON2_RELAY 2
  364. #define BUTTON3_RELAY 3
  365. #define BUTTON4_RELAY 4
  366. // Relays
  367. #define RELAY1_PIN 12
  368. #define RELAY2_PIN 5
  369. #define RELAY3_PIN 4
  370. #define RELAY4_PIN 15
  371. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  372. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  373. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  374. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  375. // LEDs
  376. #define LED1_PIN 13
  377. #define LED1_PIN_INVERSE 1
  378. #elif defined(ITEAD_SONOFF_4CH_PRO)
  379. // Info
  380. #define MANUFACTURER "ITEAD"
  381. #define DEVICE "SONOFF_4CH_PRO"
  382. // Buttons
  383. #define BUTTON1_PIN 0
  384. #define BUTTON2_PIN 9
  385. #define BUTTON3_PIN 10
  386. #define BUTTON4_PIN 14
  387. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  388. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  389. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  390. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  391. #define BUTTON1_RELAY 1
  392. #define BUTTON2_RELAY 2
  393. #define BUTTON3_RELAY 3
  394. #define BUTTON4_RELAY 4
  395. // Sonoff 4CH Pro uses a secondary STM32 microcontroller to handle
  396. // buttons and relays, but it also forwards button presses to the ESP8285.
  397. // This allows ESPurna to handle button presses -almost- the same way
  398. // as with other devices except:
  399. // * Double click seems to break/disable the button on the STM32 side
  400. // * With S6 switch to 1 (self-locking and inching modes) everything's OK
  401. // * With S6 switch to 0 (interlock mode) if there is a relay ON
  402. // and you click on another relay button, the STM32 sends a "press"
  403. // event for the button of the first relay (to turn it OFF) but it
  404. // does not send a "release" event. It's like it's holding the
  405. // button down since you can see it is still LOW.
  406. // Whatever reason the result is that it may actually perform a
  407. // long click or long-long click.
  408. // The configuration below make the button toggle the relay on press events
  409. // and disables any possibly harmful combination with S6 set to 0.
  410. // If you are sure you will only use S6 to 1 you can comment the
  411. // BUTTON1_LNGCLICK and BUTTON1_LNGLNGCLICK options below to recover the
  412. // reset mode and factory reset functionalities, or link other actions like
  413. // AP mode in the commented line below.
  414. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  415. #define BUTTON1_CLICK BUTTON_MODE_NONE
  416. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  417. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  418. //#define BUTTON1_LNGCLICK BUTTON_MODE_AP
  419. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
  420. #define BUTTON2_PRESS BUTTON_MODE_TOGGLE
  421. #define BUTTON2_CLICK BUTTON_MODE_NONE
  422. #define BUTTON3_PRESS BUTTON_MODE_TOGGLE
  423. #define BUTTON3_CLICK BUTTON_MODE_NONE
  424. #define BUTTON4_PRESS BUTTON_MODE_TOGGLE
  425. #define BUTTON4_CLICK BUTTON_MODE_NONE
  426. // Relays
  427. #define RELAY1_PIN 12
  428. #define RELAY2_PIN 5
  429. #define RELAY3_PIN 4
  430. #define RELAY4_PIN 15
  431. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  432. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  433. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  434. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  435. // LEDs
  436. #define LED1_PIN 13
  437. #define LED1_PIN_INVERSE 1
  438. #elif defined(ITEAD_1CH_INCHING)
  439. // The inching functionality is managed by a misterious IC in the board.
  440. // You cannot control the inching button and functionality from the ESP8266
  441. // Besides, enabling the inching functionality using the hardware button
  442. // will result in the relay switching on and off continuously.
  443. // Fortunately the unkown IC keeps memory of the hardware inching status
  444. // so you can just disable it and forget. The inching LED must be lit.
  445. // You can still use the pulse options from the web interface
  446. // without problem.
  447. // Info
  448. #define MANUFACTURER "ITEAD"
  449. #define DEVICE "1CH_INCHING"
  450. // Buttons
  451. #define BUTTON1_PIN 0
  452. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  453. #define BUTTON1_RELAY 1
  454. // Relays
  455. #define RELAY1_PIN 12
  456. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  457. // LEDs
  458. #define LED1_PIN 13
  459. #define LED1_PIN_INVERSE 1
  460. #elif defined(ITEAD_MOTOR)
  461. // Info
  462. #define MANUFACTURER "ITEAD"
  463. #define DEVICE "MOTOR"
  464. // Buttons
  465. #define BUTTON1_PIN 0
  466. #define BUTTON1_RELAY 1
  467. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  468. // Relays
  469. #define RELAY1_PIN 12
  470. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  471. // LEDs
  472. #define LED1_PIN 13
  473. #define LED1_PIN_INVERSE 1
  474. #elif defined(ITEAD_BNSZ01)
  475. // Info
  476. #define MANUFACTURER "ITEAD"
  477. #define DEVICE "BNSZ01"
  478. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  479. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  480. #define DUMMY_RELAY_COUNT 1
  481. // LEDs
  482. #define LED1_PIN 13
  483. #define LED1_PIN_INVERSE 1
  484. // Light
  485. #define LIGHT_CHANNELS 1
  486. #define LIGHT_CH1_PIN 12
  487. #define LIGHT_CH1_INVERSE 0
  488. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  489. // Info
  490. #define MANUFACTURER "ITEAD"
  491. #define DEVICE "SONOFF_RFBRIDGE"
  492. #define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE
  493. // Number of virtual switches
  494. #ifndef DUMMY_RELAY_COUNT
  495. #define DUMMY_RELAY_COUNT 8
  496. #endif
  497. // Buttons
  498. #define BUTTON1_PIN 0
  499. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  500. // LEDs
  501. #define LED1_PIN 13
  502. #define LED1_PIN_INVERSE 1
  503. // RFB Direct hack thanks to @wildwiz
  504. // https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack
  505. #ifndef RFB_DIRECT
  506. #define RFB_DIRECT 0
  507. #endif
  508. #ifndef RFB_RX_PIN
  509. #define RFB_RX_PIN 4 // GPIO for RX when RFB_DIRECT
  510. #endif
  511. #ifndef RFB_TX_PIN
  512. #define RFB_TX_PIN 5 // GPIO for TX when RFB_DIRECT
  513. #endif
  514. // When using un-modified harware, ESPurna communicates with the secondary
  515. // MCU EFM8BB1 via UART at 19200 bps so we need to change the speed of
  516. // the port and remove UART noise on serial line
  517. #if not RFB_DIRECT
  518. #define SERIAL_BAUDRATE 19200
  519. #define DEBUG_SERIAL_SUPPORT 0
  520. #endif
  521. #elif defined(ITEAD_SONOFF_B1)
  522. // Info
  523. #define MANUFACTURER "ITEAD"
  524. #define DEVICE "SONOFF_B1"
  525. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  526. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  527. #define DUMMY_RELAY_COUNT 1
  528. // Light
  529. #define LIGHT_CHANNELS 5
  530. #define MY92XX_MODEL MY92XX_MODEL_MY9231
  531. #define MY92XX_CHIPS 2
  532. #define MY92XX_DI_PIN 12
  533. #define MY92XX_DCKI_PIN 14
  534. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  535. #define MY92XX_MAPPING 4, 3, 5, 0, 1
  536. #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1
  537. #elif defined(ITEAD_SONOFF_LED)
  538. // Info
  539. #define MANUFACTURER "ITEAD"
  540. #define DEVICE "SONOFF_LED"
  541. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  542. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  543. #define DUMMY_RELAY_COUNT 1
  544. // LEDs
  545. #define LED1_PIN 13
  546. #define LED1_PIN_INVERSE 1
  547. // Light
  548. #define LIGHT_CHANNELS 2
  549. #define LIGHT_CH1_PIN 12 // Cold white
  550. #define LIGHT_CH2_PIN 14 // Warm white
  551. #define LIGHT_CH1_INVERSE 0
  552. #define LIGHT_CH2_INVERSE 0
  553. #elif defined(ITEAD_SONOFF_T1_1CH)
  554. // Info
  555. #define MANUFACTURER "ITEAD"
  556. #define DEVICE "SONOFF_T1_1CH"
  557. // Buttons
  558. #define BUTTON1_PIN 0
  559. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  560. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  561. #define BUTTON1_CLICK BUTTON_MODE_NONE
  562. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  563. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  564. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET
  565. #define BUTTON1_RELAY 1
  566. // Relays
  567. #define RELAY1_PIN 12
  568. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  569. // LEDs
  570. #define LED1_PIN 13
  571. #define LED1_PIN_INVERSE 1
  572. #elif defined(ITEAD_SONOFF_T1_2CH)
  573. // Info
  574. #define MANUFACTURER "ITEAD"
  575. #define DEVICE "SONOFF_T1_2CH"
  576. // Buttons
  577. #define BUTTON1_PIN 0
  578. #define BUTTON2_PIN 9
  579. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  580. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  581. #define BUTTON1_CLICK BUTTON_MODE_NONE
  582. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  583. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  584. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET
  585. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  586. #define BUTTON2_PRESS BUTTON_MODE_TOGGLE
  587. #define BUTTON2_CLICK BUTTON_MODE_NONE
  588. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  589. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  590. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_RESET
  591. #define BUTTON1_RELAY 1
  592. #define BUTTON2_RELAY 2
  593. // Relays
  594. #define RELAY1_PIN 12
  595. #define RELAY2_PIN 5
  596. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  597. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  598. // LEDs
  599. #define LED1_PIN 13
  600. #define LED1_PIN_INVERSE 1
  601. #elif defined(ITEAD_SONOFF_T1_3CH)
  602. // Info
  603. #define MANUFACTURER "ITEAD"
  604. #define DEVICE "SONOFF_T1_3CH"
  605. // Buttons
  606. #define BUTTON1_PIN 0
  607. #define BUTTON2_PIN 9
  608. #define BUTTON3_PIN 10
  609. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  610. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  611. #define BUTTON1_CLICK BUTTON_MODE_NONE
  612. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  613. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  614. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET
  615. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  616. #define BUTTON2_PRESS BUTTON_MODE_TOGGLE
  617. #define BUTTON2_CLICK BUTTON_MODE_NONE
  618. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  619. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  620. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_RESET
  621. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  622. #define BUTTON3_PRESS BUTTON_MODE_TOGGLE
  623. #define BUTTON3_CLICK BUTTON_MODE_NONE
  624. #define BUTTON3_DBLCLICK BUTTON_MODE_NONE
  625. #define BUTTON3_LNGCLICK BUTTON_MODE_NONE
  626. #define BUTTON3_LNGLNGCLICK BUTTON_MODE_RESET
  627. #define BUTTON1_RELAY 1
  628. #define BUTTON2_RELAY 2
  629. #define BUTTON3_RELAY 3
  630. // Relays
  631. #define RELAY1_PIN 12
  632. #define RELAY2_PIN 5
  633. #define RELAY3_PIN 4
  634. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  635. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  636. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  637. // LEDs
  638. #define LED1_PIN 13
  639. #define LED1_PIN_INVERSE 1
  640. #elif defined(ITEAD_SONOFF_S31)
  641. // Info
  642. #define MANUFACTURER "ITEAD"
  643. #define DEVICE "SONOFF_S31"
  644. // Buttons
  645. #define BUTTON1_PIN 0
  646. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  647. #define BUTTON1_RELAY 1
  648. // Relays
  649. #define RELAY1_PIN 12
  650. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  651. // LEDs
  652. #define LED1_PIN 13
  653. #define LED1_PIN_INVERSE 1
  654. // Disable UART noise
  655. #define DEBUG_SERIAL_SUPPORT 0
  656. // CSE7766
  657. #define CSE7766_SUPPORT 1
  658. #define CSE7766_PIN 1
  659. // -----------------------------------------------------------------------------
  660. // YJZK
  661. // -----------------------------------------------------------------------------
  662. #elif defined(YJZK_SWITCH_2CH)
  663. // Info
  664. #define MANUFACTURER "YJZK"
  665. #define DEVICE "SWITCH_2CH"
  666. // Buttons
  667. #define BUTTON1_PIN 0
  668. #define BUTTON2_PIN 9
  669. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  670. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  671. #define BUTTON1_RELAY 1
  672. #define BUTTON2_RELAY 2
  673. // Relays
  674. #define RELAY1_PIN 12
  675. #define RELAY2_PIN 5
  676. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  677. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  678. // LEDs
  679. #define LED1_PIN 13
  680. #define LED1_PIN_INVERSE 0
  681. // -----------------------------------------------------------------------------
  682. // Electrodragon boards
  683. // -----------------------------------------------------------------------------
  684. #elif defined(ELECTRODRAGON_WIFI_IOT)
  685. // Info
  686. #define MANUFACTURER "ELECTRODRAGON"
  687. #define DEVICE "WIFI_IOT"
  688. // Buttons
  689. #define BUTTON1_PIN 0
  690. #define BUTTON2_PIN 2
  691. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  692. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  693. #define BUTTON1_RELAY 1
  694. #define BUTTON2_RELAY 2
  695. // Relays
  696. #define RELAY1_PIN 12
  697. #define RELAY2_PIN 13
  698. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  699. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  700. // LEDs
  701. #define LED1_PIN 16
  702. #define LED1_PIN_INVERSE 0
  703. // -----------------------------------------------------------------------------
  704. // WorkChoice ecoPlug
  705. // -----------------------------------------------------------------------------
  706. #elif defined(WORKCHOICE_ECOPLUG)
  707. // Info
  708. #define MANUFACTURER "WORKCHOICE"
  709. #define DEVICE "ECOPLUG"
  710. // Buttons
  711. #define BUTTON1_PIN 13
  712. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  713. #define BUTTON1_RELAY 1
  714. // Relays
  715. #define RELAY1_PIN 15
  716. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  717. // LEDs
  718. #define LED1_PIN 2
  719. #define LED1_PIN_INVERSE 0
  720. // -----------------------------------------------------------------------------
  721. // AI Thinker
  722. // -----------------------------------------------------------------------------
  723. #elif defined(AITHINKER_AI_LIGHT)
  724. // Info
  725. #define MANUFACTURER "AITHINKER"
  726. #define DEVICE "AI_LIGHT"
  727. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  728. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  729. #define DUMMY_RELAY_COUNT 1
  730. // Light
  731. #define LIGHT_CHANNELS 4
  732. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  733. #define MY92XX_CHIPS 1
  734. #define MY92XX_DI_PIN 13
  735. #define MY92XX_DCKI_PIN 15
  736. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  737. #define MY92XX_MAPPING 0, 1, 2, 3
  738. // -----------------------------------------------------------------------------
  739. // LED Controller
  740. // -----------------------------------------------------------------------------
  741. #elif defined(MAGICHOME_LED_CONTROLLER)
  742. // Info
  743. #define MANUFACTURER "MAGICHOME"
  744. #define DEVICE "LED_CONTROLLER"
  745. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  746. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  747. #define DUMMY_RELAY_COUNT 1
  748. // LEDs
  749. #define LED1_PIN 2
  750. #define LED1_PIN_INVERSE 1
  751. // Light
  752. #define LIGHT_CHANNELS 4
  753. #define LIGHT_CH1_PIN 14 // RED
  754. #define LIGHT_CH2_PIN 5 // GREEN
  755. #define LIGHT_CH3_PIN 12 // BLUE
  756. #define LIGHT_CH4_PIN 13 // WHITE
  757. #define LIGHT_CH1_INVERSE 0
  758. #define LIGHT_CH2_INVERSE 0
  759. #define LIGHT_CH3_INVERSE 0
  760. #define LIGHT_CH4_INVERSE 0
  761. // IR
  762. #define IR_SUPPORT 1
  763. #define IR_PIN 4
  764. #define IR_BUTTON_SET 1
  765. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  766. // Info
  767. #define MANUFACTURER "MAGICHOME"
  768. #define DEVICE "LED_CONTROLLER_20"
  769. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  770. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  771. #define DUMMY_RELAY_COUNT 1
  772. // LEDs
  773. #define LED1_PIN 2
  774. #define LED1_PIN_INVERSE 1
  775. // Light
  776. #define LIGHT_CHANNELS 4
  777. #define LIGHT_CH1_PIN 5 // RED
  778. #define LIGHT_CH2_PIN 12 // GREEN
  779. #define LIGHT_CH3_PIN 13 // BLUE
  780. #define LIGHT_CH4_PIN 15 // WHITE
  781. #define LIGHT_CH1_INVERSE 0
  782. #define LIGHT_CH2_INVERSE 0
  783. #define LIGHT_CH3_INVERSE 0
  784. #define LIGHT_CH4_INVERSE 0
  785. // IR
  786. #define IR_SUPPORT 1
  787. #define IR_PIN 4
  788. #define IR_BUTTON_SET 1
  789. // -----------------------------------------------------------------------------
  790. // HUACANXING H801 & H802
  791. // -----------------------------------------------------------------------------
  792. #elif defined(HUACANXING_H801)
  793. // Info
  794. #define MANUFACTURER "HUACANXING"
  795. #define DEVICE "H801"
  796. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  797. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  798. #define DUMMY_RELAY_COUNT 1
  799. #define DEBUG_PORT Serial1
  800. #define SERIAL_RX_ENABLED 1
  801. // LEDs
  802. #define LED1_PIN 5
  803. #define LED1_PIN_INVERSE 1
  804. // Light
  805. #define LIGHT_CHANNELS 5
  806. #define LIGHT_CH1_PIN 15 // RED
  807. #define LIGHT_CH2_PIN 13 // GREEN
  808. #define LIGHT_CH3_PIN 12 // BLUE
  809. #define LIGHT_CH4_PIN 14 // WHITE1
  810. #define LIGHT_CH5_PIN 4 // WHITE2
  811. #define LIGHT_CH1_INVERSE 0
  812. #define LIGHT_CH2_INVERSE 0
  813. #define LIGHT_CH3_INVERSE 0
  814. #define LIGHT_CH4_INVERSE 0
  815. #define LIGHT_CH5_INVERSE 0
  816. #elif defined(HUACANXING_H802)
  817. // Info
  818. #define MANUFACTURER "HUACANXING"
  819. #define DEVICE "H802"
  820. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  821. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  822. #define DUMMY_RELAY_COUNT 1
  823. #define DEBUG_PORT Serial1
  824. #define SERIAL_RX_ENABLED 1
  825. // Light
  826. #define LIGHT_CHANNELS 4
  827. #define LIGHT_CH1_PIN 12 // RED
  828. #define LIGHT_CH2_PIN 14 // GREEN
  829. #define LIGHT_CH3_PIN 13 // BLUE
  830. #define LIGHT_CH4_PIN 15 // WHITE
  831. #define LIGHT_CH1_INVERSE 0
  832. #define LIGHT_CH2_INVERSE 0
  833. #define LIGHT_CH3_INVERSE 0
  834. #define LIGHT_CH4_INVERSE 0
  835. // -----------------------------------------------------------------------------
  836. // Jan Goedeke Wifi Relay
  837. // https://github.com/JanGoe/esp8266-wifi-relay
  838. // -----------------------------------------------------------------------------
  839. #elif defined(JANGOE_WIFI_RELAY_NC)
  840. // Info
  841. #define MANUFACTURER "JANGOE"
  842. #define DEVICE "WIFI_RELAY_NC"
  843. // Buttons
  844. #define BUTTON1_PIN 12
  845. #define BUTTON2_PIN 13
  846. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  847. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  848. #define BUTTON1_RELAY 1
  849. #define BUTTON2_RELAY 2
  850. // Relays
  851. #define RELAY1_PIN 2
  852. #define RELAY2_PIN 14
  853. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  854. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  855. #elif defined(JANGOE_WIFI_RELAY_NO)
  856. // Info
  857. #define MANUFACTURER "JANGOE"
  858. #define DEVICE "WIFI_RELAY_NO"
  859. // Buttons
  860. #define BUTTON1_PIN 12
  861. #define BUTTON2_PIN 13
  862. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  863. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  864. #define BUTTON1_RELAY 1
  865. #define BUTTON2_RELAY 2
  866. // Relays
  867. #define RELAY1_PIN 2
  868. #define RELAY2_PIN 14
  869. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  870. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  871. // -----------------------------------------------------------------------------
  872. // Jorge García Wifi+Relays Board Kit
  873. // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
  874. // https://github.com/jorgegarciadev/wifikit
  875. // -----------------------------------------------------------------------------
  876. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  877. // Info
  878. #define MANUFACTURER "JORGEGARCIA"
  879. #define DEVICE "WIFI_RELAYS"
  880. // Relays
  881. #define RELAY1_PIN 0
  882. #define RELAY2_PIN 2
  883. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  884. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  885. // -----------------------------------------------------------------------------
  886. // WiFi MQTT Relay / Thermostat
  887. // -----------------------------------------------------------------------------
  888. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  889. // Info
  890. #define MANUFACTURER "OPENENERGYMONITOR"
  891. #define DEVICE "MQTT_RELAY"
  892. // Buttons
  893. #define BUTTON1_PIN 0
  894. #define BUTTON1_RELAY 1
  895. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  896. // Relays
  897. #define RELAY1_PIN 12
  898. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  899. // LEDs
  900. #define LED1_PIN 16
  901. #define LED1_PIN_INVERSE 0
  902. // -----------------------------------------------------------------------------
  903. // WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap
  904. // 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
  905. // 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
  906. // -----------------------------------------------------------------------------
  907. #elif defined(WION_50055)
  908. // Currently untested, does not support energy monitoring
  909. // Info
  910. #define MANUFACTURER "WION"
  911. #define DEVICE "50055"
  912. // Buttons
  913. #define BUTTON1_PIN 13
  914. #define BUTTON1_RELAY 1
  915. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  916. // Relays
  917. #define RELAY1_PIN 15
  918. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  919. // LEDs
  920. #define LED1_PIN 2
  921. #define LED1_PIN_INVERSE 0
  922. // -----------------------------------------------------------------------------
  923. // EX-Store Wifi Relay v3.1
  924. // https://ex-store.de/ESP8266-WiFi-Relay-V31
  925. // -----------------------------------------------------------------------------
  926. #elif defined(EXS_WIFI_RELAY_V31)
  927. // Untested
  928. // Info
  929. #define MANUFACTURER "EXS"
  930. #define DEVICE "WIFI_RELAY_V31"
  931. // Buttons
  932. #define BUTTON1_PIN 0
  933. #define BUTTON1_RELAY 1
  934. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  935. // Relays
  936. #define RELAY1_PIN 13
  937. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  938. #define RELAY1_RESET_PIN 12
  939. // -----------------------------------------------------------------------------
  940. // V9261F
  941. // -----------------------------------------------------------------------------
  942. #elif defined(GENERIC_V9261F)
  943. // Info
  944. #define MANUFACTURER "GENERIC"
  945. #define DEVICE "V9261F"
  946. #define ALEXA_SUPPORT 0
  947. // V9261F
  948. #define V9261F_SUPPORT 1
  949. #define V9261F_PIN 2
  950. #define V9261F_PIN_INVERSE 1
  951. // -----------------------------------------------------------------------------
  952. // ECH1560
  953. // -----------------------------------------------------------------------------
  954. #elif defined(GENERIC_ECH1560)
  955. // Info
  956. #define MANUFACTURER "GENERIC"
  957. #define DEVICE "ECH1560"
  958. #define ALEXA_SUPPORT 0
  959. // ECH1560
  960. #define ECH1560_SUPPORT 1
  961. #define ECH1560_CLK_PIN 4
  962. #define ECH1560_MISO_PIN 5
  963. #define ECH1560_INVERTED 0
  964. // -----------------------------------------------------------------------------
  965. // ESPLive
  966. // https://github.com/ManCaveMade/ESP-Live
  967. // -----------------------------------------------------------------------------
  968. #elif defined(MANCAVEMADE_ESPLIVE)
  969. // Info
  970. #define MANUFACTURER "MANCAVEMADE"
  971. #define DEVICE "ESPLIVE"
  972. // Buttons
  973. #define BUTTON1_PIN 4
  974. #define BUTTON2_PIN 5
  975. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  976. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  977. #define BUTTON1_RELAY 1
  978. #define BUTTON2_RELAY 2
  979. // Relays
  980. #define RELAY1_PIN 12
  981. #define RELAY2_PIN 13
  982. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  983. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  984. // DS18B20
  985. #ifndef DALLAS_SUPPORT
  986. #define DALLAS_SUPPORT 1
  987. #endif
  988. #define DALLAS_PIN 2
  989. #define DALLAS_UPDATE_INTERVAL 5000
  990. #define TEMPERATURE_MIN_CHANGE 1.0
  991. // -----------------------------------------------------------------------------
  992. // QuinLED
  993. // http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html
  994. // -----------------------------------------------------------------------------
  995. #elif defined(INTERMITTECH_QUINLED)
  996. // Info
  997. #define MANUFACTURER "INTERMITTECH"
  998. #define DEVICE "QUINLED"
  999. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1000. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1001. #define DUMMY_RELAY_COUNT 1
  1002. // LEDs
  1003. #define LED1_PIN 5
  1004. #define LED1_PIN_INVERSE 1
  1005. // Light
  1006. #define LIGHT_CHANNELS 2
  1007. #define LIGHT_CH1_PIN 0
  1008. #define LIGHT_CH2_PIN 2
  1009. #define LIGHT_CH1_INVERSE 0
  1010. #define LIGHT_CH2_INVERSE 0
  1011. // -----------------------------------------------------------------------------
  1012. // Arilux AL-LC06
  1013. // -----------------------------------------------------------------------------
  1014. #elif defined(ARILUX_AL_LC01)
  1015. // Info
  1016. #define MANUFACTURER "ARILUX"
  1017. #define DEVICE "AL_LC01"
  1018. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1019. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1020. #define DUMMY_RELAY_COUNT 1
  1021. // Light
  1022. #define LIGHT_CHANNELS 3
  1023. #define LIGHT_CH1_PIN 5 // RED
  1024. #define LIGHT_CH2_PIN 12 // GREEN
  1025. #define LIGHT_CH3_PIN 13 // BLUE
  1026. #define LIGHT_CH1_INVERSE 0
  1027. #define LIGHT_CH2_INVERSE 0
  1028. #define LIGHT_CH3_INVERSE 0
  1029. #elif defined(ARILUX_AL_LC02)
  1030. // Info
  1031. #define MANUFACTURER "ARILUX"
  1032. #define DEVICE "AL_LC02"
  1033. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1034. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1035. #define DUMMY_RELAY_COUNT 1
  1036. // Light
  1037. #define LIGHT_CHANNELS 4
  1038. #define LIGHT_CH1_PIN 12 // RED
  1039. #define LIGHT_CH2_PIN 5 // GREEN
  1040. #define LIGHT_CH3_PIN 13 // BLUE
  1041. #define LIGHT_CH4_PIN 15 // WHITE1
  1042. #define LIGHT_CH1_INVERSE 0
  1043. #define LIGHT_CH2_INVERSE 0
  1044. #define LIGHT_CH3_INVERSE 0
  1045. #define LIGHT_CH4_INVERSE 0
  1046. #elif defined(ARILUX_AL_LC06)
  1047. // Info
  1048. #define MANUFACTURER "ARILUX"
  1049. #define DEVICE "AL_LC06"
  1050. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1051. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1052. #define DUMMY_RELAY_COUNT 1
  1053. // Light
  1054. #define LIGHT_CHANNELS 5
  1055. #define LIGHT_CH1_PIN 14 // RED
  1056. #define LIGHT_CH2_PIN 12 // GREEN
  1057. #define LIGHT_CH3_PIN 13 // BLUE
  1058. #define LIGHT_CH4_PIN 15 // WHITE1
  1059. #define LIGHT_CH5_PIN 5 // WHITE2
  1060. #define LIGHT_CH1_INVERSE 0
  1061. #define LIGHT_CH2_INVERSE 0
  1062. #define LIGHT_CH3_INVERSE 0
  1063. #define LIGHT_CH4_INVERSE 0
  1064. #define LIGHT_CH5_INVERSE 0
  1065. #elif defined(ARILUX_AL_LC11)
  1066. // Info
  1067. #define MANUFACTURER "ARILUX"
  1068. #define DEVICE "AL_LC11"
  1069. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1070. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1071. #define DUMMY_RELAY_COUNT 1
  1072. // Light
  1073. #define LIGHT_CHANNELS 5
  1074. #define LIGHT_CH1_PIN 5 // RED
  1075. #define LIGHT_CH2_PIN 4 // GREEN
  1076. #define LIGHT_CH3_PIN 14 // BLUE
  1077. #define LIGHT_CH4_PIN 13 // WHITE1
  1078. #define LIGHT_CH5_PIN 12 // WHITE1
  1079. #define LIGHT_CH1_INVERSE 0
  1080. #define LIGHT_CH2_INVERSE 0
  1081. #define LIGHT_CH3_INVERSE 0
  1082. #define LIGHT_CH4_INVERSE 0
  1083. #define LIGHT_CH5_INVERSE 0
  1084. #elif defined(ARILUX_E27)
  1085. // Info
  1086. #define MANUFACTURER "ARILUX"
  1087. #define DEVICE "E27"
  1088. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1089. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  1090. #define DUMMY_RELAY_COUNT 1
  1091. // Light
  1092. #define LIGHT_CHANNELS 4
  1093. #define MY92XX_MODEL MY92XX_MODEL_MY9291
  1094. #define MY92XX_CHIPS 1
  1095. #define MY92XX_DI_PIN 13
  1096. #define MY92XX_DCKI_PIN 15
  1097. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  1098. #define MY92XX_MAPPING 0, 1, 2, 3
  1099. // -----------------------------------------------------------------------------
  1100. // XENON SM-PW701U
  1101. // -----------------------------------------------------------------------------
  1102. #elif defined(XENON_SM_PW702U)
  1103. // Info
  1104. #define MANUFACTURER "XENON"
  1105. #define DEVICE "SM_PW702U"
  1106. // Buttons
  1107. #define BUTTON1_PIN 13
  1108. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1109. #define BUTTON1_RELAY 1
  1110. // Relays
  1111. #define RELAY1_PIN 12
  1112. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1113. // LEDs
  1114. #define LED1_PIN 4
  1115. #define LED1_PIN_INVERSE 1
  1116. // -----------------------------------------------------------------------------
  1117. // AUTHOMETION LYT8266
  1118. // https://authometion.com/shop/en/home/13-lyt8266.html
  1119. // -----------------------------------------------------------------------------
  1120. #elif defined(AUTHOMETION_LYT8266)
  1121. // Info
  1122. #define MANUFACTURER "AUTHOMETION"
  1123. #define DEVICE "LYT8266"
  1124. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1125. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1126. #define DUMMY_RELAY_COUNT 1
  1127. // Light
  1128. #define LIGHT_CHANNELS 4
  1129. #define LIGHT_CH1_PIN 13 // RED
  1130. #define LIGHT_CH2_PIN 12 // GREEN
  1131. #define LIGHT_CH3_PIN 14 // BLUE
  1132. #define LIGHT_CH4_PIN 2 // WHITE
  1133. #define LIGHT_CH1_INVERSE 0
  1134. #define LIGHT_CH2_INVERSE 0
  1135. #define LIGHT_CH3_INVERSE 0
  1136. #define LIGHT_CH4_INVERSE 0
  1137. #define LIGHT_ENABLE_PIN 15
  1138. #elif defined(GIZWITS_WITTY_CLOUD)
  1139. // Info
  1140. #define MANUFACTURER "GIZWITS"
  1141. #define DEVICE "WITTY_CLOUD"
  1142. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1143. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1144. #define DUMMY_RELAY_COUNT 1
  1145. // Buttons
  1146. #define BUTTON1_PIN 4
  1147. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1148. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  1149. #define BUTTON1_CLICK BUTTON_MODE_NONE
  1150. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  1151. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  1152. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET
  1153. #define ANALOG_SUPPORT 1
  1154. // LEDs
  1155. #define LED1_PIN 2 // BLUE build-in
  1156. #define LED1_PIN_INVERSE 1
  1157. // Light
  1158. #define LIGHT_CHANNELS 3
  1159. #define LIGHT_CH1_PIN 15 // RED
  1160. #define LIGHT_CH2_PIN 12 // GREEN
  1161. #define LIGHT_CH3_PIN 13 // BLUE
  1162. #define LIGHT_CH1_INVERSE 0
  1163. #define LIGHT_CH2_INVERSE 0
  1164. #define LIGHT_CH3_INVERSE 0
  1165. // -----------------------------------------------------------------------------
  1166. // KMC 70011
  1167. // https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B
  1168. // -----------------------------------------------------------------------------
  1169. #elif defined(KMC_70011)
  1170. // Info
  1171. #define MANUFACTURER "KMC"
  1172. #define DEVICE "70011"
  1173. // Buttons
  1174. #define BUTTON1_PIN 0
  1175. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1176. #define BUTTON1_RELAY 1
  1177. // Relays
  1178. #define RELAY1_PIN 14
  1179. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1180. // LEDs
  1181. #define LED1_PIN 13
  1182. #define LED1_PIN_INVERSE 0
  1183. // HLW8012
  1184. #ifndef HLW8012_SUPPORT
  1185. #define HLW8012_SUPPORT 1
  1186. #endif
  1187. #define HLW8012_SEL_PIN 12
  1188. #define HLW8012_CF1_PIN 5
  1189. #define HLW8012_CF_PIN 4
  1190. #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor
  1191. // -----------------------------------------------------------------------------
  1192. // Euromate (?) Wifi Stecker Shuko
  1193. // https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706
  1194. // Thanks to @Geitde
  1195. // -----------------------------------------------------------------------------
  1196. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  1197. // Info
  1198. #define MANUFACTURER "EUROMATE"
  1199. #define DEVICE "WIFI_STECKER_SCHUKO"
  1200. // Buttons
  1201. #define BUTTON1_PIN 14
  1202. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1203. #define BUTTON1_RELAY 1
  1204. // The relay in the device is not a bistable (latched) relay.
  1205. // The device is reported to have a flip-flop circuit to drive the relay
  1206. // So @Geitde hack is still the only possible
  1207. // Hack: drive GPIO12 low and use GPIO5 as normal relay pin:
  1208. #define RELAY1_PIN 5
  1209. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1210. #define LED2_PIN 12 /* DUMMY: exploit default off state for GPIO12=low */
  1211. #define LED2_PIN_INVERSE 0
  1212. // LEDs
  1213. #define LED1_PIN 4
  1214. #define LED1_PIN_INVERSE 0
  1215. // -----------------------------------------------------------------------------
  1216. // Generic 8CH
  1217. // -----------------------------------------------------------------------------
  1218. #elif defined(GENERIC_8CH)
  1219. // Info
  1220. #define MANUFACTURER "GENERIC"
  1221. #define DEVICE "8CH"
  1222. // Relays
  1223. #define RELAY1_PIN 0
  1224. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1225. #define RELAY2_PIN 2
  1226. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1227. #define RELAY3_PIN 4
  1228. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  1229. #define RELAY4_PIN 5
  1230. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  1231. #define RELAY5_PIN 12
  1232. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  1233. #define RELAY6_PIN 13
  1234. #define RELAY6_TYPE RELAY_TYPE_NORMAL
  1235. #define RELAY7_PIN 14
  1236. #define RELAY7_TYPE RELAY_TYPE_NORMAL
  1237. #define RELAY8_PIN 15
  1238. #define RELAY8_TYPE RELAY_TYPE_NORMAL
  1239. // -----------------------------------------------------------------------------
  1240. // STM RELAY
  1241. // -----------------------------------------------------------------------------
  1242. #elif defined(STM_RELAY)
  1243. // Info
  1244. #define MANUFACTURER "STM_RELAY"
  1245. #define DEVICE "2CH"
  1246. // Relays
  1247. #define DUMMY_RELAY_COUNT 2
  1248. #define RELAY_PROVIDER RELAY_PROVIDER_STM
  1249. // Remove UART noise on serial line
  1250. #define DEBUG_SERIAL_SUPPORT 0
  1251. // -----------------------------------------------------------------------------
  1252. // Tonbux Powerstrip02
  1253. // -----------------------------------------------------------------------------
  1254. #elif defined(TONBUX_POWERSTRIP02)
  1255. // Info
  1256. #define MANUFACTURER "TONBUX"
  1257. #define DEVICE "POWERSTRIP02"
  1258. // Buttons
  1259. #define BUTTON1_PIN 5
  1260. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1261. #define BUTTON1_RELAY 0
  1262. // Relays
  1263. #define RELAY1_PIN 4
  1264. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  1265. #define RELAY2_PIN 13
  1266. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  1267. #define RELAY3_PIN 12
  1268. #define RELAY3_TYPE RELAY_TYPE_INVERSE
  1269. #define RELAY4_PIN 14
  1270. #define RELAY4_TYPE RELAY_TYPE_INVERSE
  1271. // Not a relay. USB ports on/off
  1272. #define RELAY5_PIN 16
  1273. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  1274. // LEDs
  1275. #define LED1_PIN 0 // 1 blue led
  1276. #define LED1_PIN_INVERSE 1
  1277. #define LED2_PIN 3 // 3 red leds
  1278. #define LED2_PIN_INVERSE 1
  1279. // -----------------------------------------------------------------------------
  1280. // Lingan SWA1
  1281. // -----------------------------------------------------------------------------
  1282. #elif defined(LINGAN_SWA1)
  1283. // Info
  1284. #define MANUFACTURER "LINGAN"
  1285. #define DEVICE "SWA1"
  1286. // Buttons
  1287. #define BUTTON1_PIN 13
  1288. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1289. #define BUTTON1_RELAY 1
  1290. // Relays
  1291. #define RELAY1_PIN 5
  1292. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1293. // LEDs
  1294. #define LED1_PIN 4
  1295. #define LED1_PIN_INVERSE 1
  1296. // -----------------------------------------------------------------------------
  1297. // HEYGO HY02
  1298. // -----------------------------------------------------------------------------
  1299. #elif defined(HEYGO_HY02)
  1300. // Info
  1301. #define MANUFACTURER "HEYGO"
  1302. #define DEVICE "HY02"
  1303. // Buttons
  1304. #define BUTTON1_PIN 13
  1305. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1306. #define BUTTON1_RELAY 1
  1307. // Relays
  1308. #define RELAY1_PIN 12
  1309. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1310. // LEDs
  1311. #define LED1_PIN 4
  1312. #define LED1_PIN_INVERSE 0
  1313. // -----------------------------------------------------------------------------
  1314. // Maxcio W-US002S
  1315. // -----------------------------------------------------------------------------
  1316. #elif defined(MAXCIO_WUS002S)
  1317. // Info
  1318. #define MANUFACTURER "MAXCIO"
  1319. #define DEVICE "WUS002S"
  1320. // Buttons
  1321. #define BUTTON1_PIN 2
  1322. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1323. #define BUTTON1_RELAY 1
  1324. // Relays
  1325. #define RELAY1_PIN 13
  1326. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1327. // LEDs
  1328. #define LED1_PIN 3
  1329. #define LED1_PIN_INVERSE 0
  1330. // HLW8012
  1331. #ifndef HLW8012_SUPPORT
  1332. #define HLW8012_SUPPORT 1
  1333. #endif
  1334. #define HLW8012_SEL_PIN 12
  1335. #define HLW8012_CF1_PIN 5
  1336. #define HLW8012_CF_PIN 4
  1337. #define HLW8012_CURRENT_R 0.002 // Current resistor
  1338. #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor
  1339. // -----------------------------------------------------------------------------
  1340. // YiDian XS-SSA05
  1341. // -----------------------------------------------------------------------------
  1342. #elif defined(YIDIAN_XSSSA05)
  1343. // Info
  1344. #define MANUFACTURER "YIDIAN"
  1345. #define DEVICE "XSSSA05"
  1346. // Buttons
  1347. #define BUTTON1_PIN 13
  1348. #define BUTTON1_MODE BUTTON_PUSHBUTTON
  1349. #define BUTTON1_RELAY 1
  1350. // Relays
  1351. #define RELAY1_PIN 12
  1352. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1353. // LEDs
  1354. #define LED1_PIN 4
  1355. #define LED1_PIN_INVERSE 0
  1356. // HLW8012
  1357. #ifndef HLW8012_SUPPORT
  1358. #define HLW8012_SUPPORT 1
  1359. #endif
  1360. #define HLW8012_SEL_PIN 3
  1361. #define HLW8012_CF1_PIN 14
  1362. #define HLW8012_CF_PIN 5
  1363. #define HLW8012_CURRENT_R 0.001 // Current resistor
  1364. #define HLW8012_VOLTAGE_R_UP ( 2 * 1200000 ) // Upstream voltage resistor
  1365. // -----------------------------------------------------------------------------
  1366. // TONBUX XS-SSA06
  1367. // -----------------------------------------------------------------------------
  1368. #elif defined(TONBUX_XSSSA06)
  1369. // Info
  1370. #define MANUFACTURER "TONBUX"
  1371. #define DEVICE "XSSSA06"
  1372. // Buttons
  1373. #define BUTTON1_PIN 13
  1374. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1375. #define BUTTON1_RELAY 1
  1376. // Relays
  1377. #define RELAY1_PIN 15
  1378. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1379. // LEDs
  1380. #define LED1_PIN 0 // R - 8 rgb led ring
  1381. #define LED1_PIN_INVERSE 0
  1382. #define LED2_PIN 5 // G
  1383. #define LED2_PIN_INVERSE 0
  1384. #define LED3_PIN 2 // B
  1385. #define LED3_PIN_INVERSE 0
  1386. // -----------------------------------------------------------------------------
  1387. // GREEN ESP8266 RELAY MODULE
  1388. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266
  1389. // -----------------------------------------------------------------------------
  1390. #elif defined(GREEN_ESP8266RELAY)
  1391. // Info
  1392. #define MANUFACTURER "GREEN"
  1393. #define DEVICE "ESP8266RELAY"
  1394. // Buttons
  1395. // Not a button but input via Optocoupler
  1396. #define BUTTON1_PIN 5
  1397. #define BUTTON1_MODE BUTTON_PUSHBUTTON
  1398. #define BUTTON1_RELAY 1
  1399. // Relays
  1400. #define RELAY1_PIN 4
  1401. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1402. // LEDs
  1403. #define LED1_PIN 2
  1404. #define LED1_PIN_INVERSE 1
  1405. // -----------------------------------------------------------------------------
  1406. // Henrique Gravina ESPIKE
  1407. // https://github.com/Henriquegravina/Espike
  1408. // -----------------------------------------------------------------------------
  1409. #elif defined(IKE_ESPIKE)
  1410. #define MANUFACTURER "IKE"
  1411. #define DEVICE "ESPIKE"
  1412. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
  1413. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  1414. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  1415. #define BUTTON1_PIN 13
  1416. #define BUTTON1_RELAY 1
  1417. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1418. #define BUTTON2_PIN 12
  1419. #define BUTTON2_RELAY 2
  1420. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1421. #define BUTTON3_PIN 14
  1422. #define BUTTON3_RELAY 2
  1423. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1424. #define RELAY1_PIN 4
  1425. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1426. #define RELAY2_PIN 5
  1427. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1428. #define RELAY3_PIN 16
  1429. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  1430. #define LED1_PIN 2
  1431. #define LED1_PIN_INVERSE 1
  1432. // -----------------------------------------------------------------------------
  1433. // SWIFITCH
  1434. // https://github.com/ArnieX/swifitch
  1435. // -----------------------------------------------------------------------------
  1436. #elif defined(ARNIEX_SWIFITCH)
  1437. // Info
  1438. #define MANUFACTURER "ARNIEX"
  1439. #define DEVICE "SWIFITCH"
  1440. // Buttons
  1441. #define BUTTON1_PIN 4 // D2
  1442. #define BUTTON1_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
  1443. #define BUTTON1_RELAY 1
  1444. #define BUTTON1_PRESS BUTTON_MODE_NONE
  1445. #define BUTTON1_CLICK BUTTON_MODE_TOGGLE
  1446. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  1447. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  1448. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
  1449. // Relays
  1450. #define RELAY1_PIN 5 // D1
  1451. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  1452. // LEDs
  1453. #define LED1_PIN 12 // D6
  1454. #define LED1_PIN_INVERSE 1
  1455. // -----------------------------------------------------------------------------
  1456. // ESP-01S RELAY v4.0
  1457. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
  1458. // -----------------------------------------------------------------------------
  1459. #elif defined(GENERIC_ESP01S_RELAY_V40)
  1460. // Info
  1461. #define MANUFACTURER "GENERIC"
  1462. #define DEVICE "ESP01S_RELAY_40"
  1463. // Relays
  1464. #define RELAY1_PIN 0
  1465. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1466. // LEDs
  1467. #define LED1_PIN 2
  1468. #define LED1_PIN_INVERSE 0
  1469. // -----------------------------------------------------------------------------
  1470. // ESP-01S RGB LED v1.0 (some sold with ws2818)
  1471. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
  1472. // -----------------------------------------------------------------------------
  1473. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  1474. // Info
  1475. #define MANUFACTURER "GENERIC"
  1476. #define DEVICE "ESP01S_RGBLED_10"
  1477. // This board is sold as RGB LED module BUT it has on board 3 pin ph2.0 connector (VCC, GPIO2, GND)
  1478. // so, if you wish, you may connect LED, BUTTON, RELAY, SENSOR etc.
  1479. // Buttons
  1480. //#define BUTTON1_PIN 2
  1481. // Relays
  1482. //#define RELAY1_PIN 2
  1483. // LEDs
  1484. #define LED1_PIN 2
  1485. #define LED1_PIN_INVERSE 0
  1486. // -----------------------------------------------------------------------------
  1487. // ESP-01S DHT11 v1.0
  1488. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
  1489. // -----------------------------------------------------------------------------
  1490. #elif defined(GENERIC_ESP01S_DHT11_V10)
  1491. // Info
  1492. #define MANUFACTURER "GENERIC"
  1493. #define DEVICE "ESP01S_DHT11_10"
  1494. // DHT11
  1495. #ifndef DHT_SUPPORT
  1496. #define DHT_SUPPORT 1
  1497. #endif
  1498. #define DHT_PIN 2
  1499. // -----------------------------------------------------------------------------
  1500. // ESP-01S DS18B20 v1.0
  1501. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
  1502. // -----------------------------------------------------------------------------
  1503. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  1504. // Info
  1505. #define MANUFACTURER "GENERIC"
  1506. #define DEVICE "ESP01S_DS18B20_10"
  1507. // DB18B20
  1508. #ifndef DALLAS_SUPPORT
  1509. #define DALLAS_SUPPORT 1
  1510. #endif
  1511. #define DALLAS_PIN 2
  1512. // -----------------------------------------------------------------------------
  1513. // Heltec Touch Relay
  1514. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay
  1515. // -----------------------------------------------------------------------------
  1516. #elif defined(HELTEC_TOUCHRELAY)
  1517. // Info
  1518. #define MANUFACTURER "HELTEC"
  1519. #define DEVICE "TOUCH_RELAY"
  1520. // Buttons
  1521. #define BUTTON1_PIN 14
  1522. #define BUTTON1_RELAY 1
  1523. #define BUTTON1_MODE BUTTON_PUSHBUTTON
  1524. // Relays
  1525. #define RELAY1_PIN 12
  1526. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1527. // -----------------------------------------------------------------------------
  1528. // Zhilde ZLD-EU44-W
  1529. // http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html
  1530. // -----------------------------------------------------------------------------
  1531. #elif defined(ZHILDE_EU44_W)
  1532. // Info
  1533. #define MANUFACTURER "ZHILDE"
  1534. #define DEVICE "EU44_W"
  1535. // Based on the reporter, this product uses GPIO1 and 3 for the button
  1536. // and onboard LED, so hardware serial should be disabled...
  1537. #define DEBUG_SERIAL_SUPPORT 0
  1538. // Buttons
  1539. #define BUTTON1_PIN 3
  1540. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1541. // Relays
  1542. #define RELAY1_PIN 5
  1543. #define RELAY2_PIN 4
  1544. #define RELAY3_PIN 12
  1545. #define RELAY4_PIN 13
  1546. #define RELAY5_PIN 14
  1547. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1548. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1549. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  1550. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  1551. #define RELAY5_TYPE RELAY_TYPE_NORMAL
  1552. // LEDs
  1553. #define LED1_PIN 1
  1554. #define LED1_PIN_INVERSE 1
  1555. // -----------------------------------------------------------------------------
  1556. // Allnet 4duino ESP8266-UP-Relais
  1557. // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/
  1558. // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf
  1559. // -----------------------------------------------------------------------------
  1560. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  1561. // Info
  1562. #define MANUFACTURER "ALLNET"
  1563. #define DEVICE "4DUINO_IOT_WLAN_RELAIS"
  1564. // Relays
  1565. #define RELAY1_PIN 14
  1566. #define RELAY1_RESET_PIN 12
  1567. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  1568. // LEDs
  1569. #define LED1_PIN 0
  1570. #define LED1_PIN_INVERSE 1
  1571. // Buttons
  1572. //#define BUTTON1_PIN 0
  1573. //#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1574. // Using pins labelled as SDA & SCL as buttons
  1575. #define BUTTON2_PIN 4
  1576. #define BUTTON2_MODE BUTTON_PUSHBUTTON
  1577. #define BUTTON2_PRESS BUTTON_MODE_TOGGLE
  1578. #define BUTTON2_CLICK BUTTON_MODE_NONE
  1579. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  1580. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  1581. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
  1582. #define BUTTON3_PIN 5
  1583. #define BUTTON3_MODE BUTTON_PUSHBUTTON
  1584. // Using pins labelled as SDA & SCL for I2C
  1585. //#define I2C_SDA_PIN 4
  1586. //#define I2C_SCL_PIN 5
  1587. // -----------------------------------------------------------------------------
  1588. // Luani HVIO
  1589. // https://luani.de/projekte/esp8266-hvio/
  1590. // https://luani.de/blog/esp8266-230v-io-modul/
  1591. // -----------------------------------------------------------------------------
  1592. #elif defined(LUANI_HVIO)
  1593. // Info
  1594. #define MANUFACTURER "LUANI"
  1595. #define DEVICE "HVIO"
  1596. // Buttons
  1597. #define BUTTON1_PIN 12
  1598. #define BUTTON1_RELAY 1
  1599. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1600. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  1601. #define BUTTON2_PIN 13
  1602. #define BUTTON2_RELAY 2
  1603. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1604. // Relays
  1605. #define RELAY1_PIN 4
  1606. #define RELAY2_PIN 5
  1607. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1608. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1609. // LEDs
  1610. #define LED1_PIN 15
  1611. #define LED1_PIN_INVERSE 0
  1612. // -----------------------------------------------------------------------------
  1613. // TEST boards (do not use!!)
  1614. // -----------------------------------------------------------------------------
  1615. #elif defined(TRAVIS01)
  1616. // Info
  1617. #define MANUFACTURER "TravisCI"
  1618. #define DEVICE "Virtual board 01"
  1619. // Some buttons - pin 0
  1620. #define BUTTON1_PIN 0
  1621. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  1622. #define BUTTON1_RELAY 1
  1623. // Some relays - pin 1
  1624. #define RELAY1_PIN 1
  1625. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1626. // Some LEDs - pin 2
  1627. #define LED1_PIN 2
  1628. #define LED1_PIN_INVERSE 1
  1629. // A bit of I2C - pins 3,4
  1630. #define I2C_SDA_PIN 3
  1631. #define I2C_SCL_PIN 4
  1632. // And, as they say in "From Dusk till Dawn":
  1633. // This is a sensor blow out!
  1634. // Alright, we got white sensor, black sensor, spanish sensor, yellow sensor. We got hot sensor, cold sensor.
  1635. // We got wet sensor. We got smelly sensor. We got hairy sensor, bloody sensor. We got snapping sensor.
  1636. // We got silk sensor, velvet sensor, naugahyde sensor. We even got horse sensor, dog sensor, chicken sensor.
  1637. // C'mon, you want sensor, come on in sensor lovers!
  1638. // If we don’t got it, you don't want it!
  1639. #define AM2320_SUPPORT 1
  1640. #define BH1750_SUPPORT 1
  1641. #define BMX280_SUPPORT 1
  1642. #define SHT3X_I2C_SUPPORT 1
  1643. #define EMON_ADC121_SUPPORT 1
  1644. #define EMON_ADS1X15_SUPPORT 1
  1645. #define SHT3X_I2C_SUPPORT 1
  1646. #define SI7021_SUPPORT 1
  1647. // A bit of lights - pin 5
  1648. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1649. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  1650. #define DUMMY_RELAY_COUNT 1
  1651. #define LIGHT_CHANNELS 1
  1652. #define LIGHT_CH1_PIN 5
  1653. #define LIGHT_CH1_INVERSE 0
  1654. // A bit of HLW8012 - pins 6,7,8
  1655. #ifndef HLW8012_SUPPORT
  1656. #define HLW8012_SUPPORT 1
  1657. #endif
  1658. #define HLW8012_SEL_PIN 6
  1659. #define HLW8012_CF1_PIN 7
  1660. #define HLW8012_CF_PIN 8
  1661. // A bit of Dallas - pin 9
  1662. #ifndef DALLAS_SUPPORT
  1663. #define DALLAS_SUPPORT 1
  1664. #endif
  1665. #define DALLAS_PIN 9
  1666. // A bit of ECH1560 - pins 10,11, 12
  1667. #ifndef ECH1560_SUPPORT
  1668. #define ECH1560_SUPPORT 1
  1669. #endif
  1670. #define ECH1560_CLK_PIN 10
  1671. #define ECH1560_MISO_PIN 11
  1672. #define ECH1560_INVERTED 12
  1673. #elif defined(TRAVIS02)
  1674. // Relay provider dual
  1675. #define MANUFACTURER "TravisCI"
  1676. #define DEVICE "Virtual board 02"
  1677. // A bit of CSE7766 - pin 1
  1678. #ifndef CSE7766_SUPPORT
  1679. #define CSE7766_SUPPORT 1
  1680. #endif
  1681. #define CSE7766_PIN 1
  1682. // Relay type dual - pins 2,3
  1683. #define RELAY_PROVIDER RELAY_PROVIDER_DUAL
  1684. #define RELAY1_PIN 2
  1685. #define RELAY2_PIN 3
  1686. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  1687. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  1688. // IR - pin 4
  1689. #define IR_SUPPORT 1
  1690. #define IR_PIN 4
  1691. #define IR_BUTTON_SET 1
  1692. // A bit of DHT - pin 5
  1693. #ifndef DHT_SUPPORT
  1694. #define DHT_SUPPORT 1
  1695. #endif
  1696. #define DHT_PIN 5
  1697. // A bit of TMP3X (analog)
  1698. #define TMP3X_SUPPORT 1
  1699. // A bit of EVENTS - pin 10
  1700. #define EVENTS_SUPPORT 1
  1701. #define EVENTS_PIN 6
  1702. // HC-RS04
  1703. #define HCSR04_SUPPORT 1
  1704. #define HCSR04_TRIGGER 7
  1705. #define HCSR04_ECHO 8
  1706. // MHZ19
  1707. #define MHZ19_SUPPORT 1
  1708. #define MHZ19_RX_PIN 9
  1709. #define MHZ19_TX_PIN 10
  1710. // PZEM004T
  1711. #define PZEM004T_SUPPORT 0 // not working?
  1712. #define PZEM004T_RX_PIN 11
  1713. #define PZEM004T_TX_PIN 12
  1714. // V9261F
  1715. #define V9261F_SUPPORT 1
  1716. #define V9261F_PIN 13
  1717. // GUVAS12SD
  1718. #define GUVAS12SD_SUPPORT 1
  1719. #define GUVAS12SD_PIN 14
  1720. #elif defined(TRAVIS03)
  1721. // Relay provider light/my92XX
  1722. #define MANUFACTURER "TravisCI"
  1723. #define DEVICE "Virtual board 03"
  1724. // MY9231 Light - pins 1,2
  1725. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  1726. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
  1727. #define DUMMY_RELAY_COUNT 1
  1728. #define LIGHT_CHANNELS 5
  1729. #define MY92XX_MODEL MY92XX_MODEL_MY9231
  1730. #define MY92XX_CHIPS 2
  1731. #define MY92XX_DI_PIN 1
  1732. #define MY92XX_DCKI_PIN 2
  1733. #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
  1734. #define MY92XX_MAPPING 4, 3, 5, 0, 1
  1735. // A bit of Analog EMON (analog)
  1736. #ifndef EMON_ANALOG_SUPPORT
  1737. #define EMON_ANALOG_SUPPORT 1
  1738. #endif
  1739. #endif
  1740. // -----------------------------------------------------------------------------
  1741. // Check definitions
  1742. // -----------------------------------------------------------------------------
  1743. #if not defined(MANUFACTURER) || not defined(DEVICE)
  1744. #error "UNSUPPORTED HARDWARE!!"
  1745. #endif