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.

1183 lines
34 KiB

7 years ago
7 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 4 relays)
  15. // RELAY#_TYPE: Relay can be RELAY_TYPE_NORMAL, RELAY_TYPE_INVERSE or RELAY_TYPE_LATCHED
  16. // RELAY#_LED: LED number that will be bind to the n-th relay (1-based)
  17. // LED#_PIN: GPIO for the n-th LED (1-based, up to 4 LEDs)
  18. // LED#_PIN_INVERSE: LED has inversed logic (lit when pulled down)
  19. //
  20. // Besides, other hardware specific information should be stated here
  21. // -----------------------------------------------------------------------------
  22. // Development boards
  23. // -----------------------------------------------------------------------------
  24. #if defined(NODEMCU_LOLIN)
  25. // Info
  26. #define MANUFACTURER "NODEMCU"
  27. #define DEVICE "LOLIN"
  28. // Buttons
  29. #define BUTTON1_PIN 0
  30. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  31. #define BUTTON1_RELAY 1
  32. // Relays
  33. #define RELAY1_PIN 12
  34. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  35. // LEDs
  36. #define LED1_PIN 2
  37. #define LED1_PIN_INVERSE 1
  38. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  39. // Info
  40. #define MANUFACTURER "WEMOS"
  41. #define DEVICE "D1_MINI_RELAYSHIELD"
  42. // Buttons
  43. // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems
  44. #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND,
  45. // it's the same as using a Wemos one button shield
  46. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  47. #define BUTTON1_RELAY 1
  48. // Relays
  49. #define RELAY1_PIN 5
  50. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  51. // LEDs
  52. #define LED1_PIN 2
  53. #define LED1_PIN_INVERSE 1
  54. // Buttons
  55. // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems
  56. #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND,
  57. // it's the same as using a Wemos one button shield
  58. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  59. #define BUTTON1_RELAY 1
  60. // -----------------------------------------------------------------------------
  61. // ESPurna
  62. // -----------------------------------------------------------------------------
  63. #elif defined(TINKERMAN_ESPURNA_H06)
  64. // Info
  65. #define MANUFACTURER "TINKERMAN"
  66. #define DEVICE "ESPURNA_H06"
  67. // Buttons
  68. #define BUTTON1_PIN 4
  69. #define BUTTON1_RELAY 1
  70. #ifdef USE_TOUCH_BUTTON
  71. // Touch button
  72. #define BUTTON1_MODE BUTTON_PUSHBUTTON
  73. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  74. #define BUTTON1_CLICK BUTTON_MODE_NONE
  75. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  76. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  77. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
  78. #else
  79. // Normal pushbutton
  80. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  81. #endif
  82. // Relays
  83. #define RELAY1_PIN 12
  84. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  85. // LEDs
  86. #define LED1_PIN 5
  87. #define LED1_PIN_INVERSE 0
  88. // HLW8012
  89. #define POWER_PROVIDER POWER_PROVIDER_HLW8012
  90. #define HLW8012_SEL_PIN 2
  91. #define HLW8012_CF1_PIN 13
  92. #define HLW8012_CF_PIN 14
  93. #elif defined(TINKERMAN_ESPURNA_H07)
  94. // Info
  95. #define MANUFACTURER "TINKERMAN"
  96. #define DEVICE "ESPURNA_H07"
  97. // Buttons
  98. #define BUTTON1_PIN 4
  99. #define BUTTON1_RELAY 1
  100. #ifdef USE_TOUCH_BUTTON
  101. // Touch button
  102. #define BUTTON1_MODE BUTTON_PUSHBUTTON
  103. #define BUTTON1_PRESS BUTTON_MODE_TOGGLE
  104. #define BUTTON1_CLICK BUTTON_MODE_NONE
  105. #define BUTTON1_DBLCLICK BUTTON_MODE_NONE
  106. #define BUTTON1_LNGCLICK BUTTON_MODE_NONE
  107. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
  108. #else
  109. // Normal pushbutton
  110. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  111. #endif
  112. // Relays
  113. #define RELAY1_PIN 12
  114. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  115. // LEDs
  116. #define LED1_PIN 2
  117. #define LED1_PIN_INVERSE 0
  118. // HLW8012
  119. #define POWER_PROVIDER POWER_PROVIDER_HLW8012
  120. #define HLW8012_SEL_PIN 5
  121. #define HLW8012_CF1_PIN 13
  122. #define HLW8012_CF_PIN 14
  123. // -----------------------------------------------------------------------------
  124. // Itead Studio boards
  125. // -----------------------------------------------------------------------------
  126. #elif defined(ITEAD_SONOFF_BASIC)
  127. // Info
  128. #define MANUFACTURER "ITEAD"
  129. #define DEVICE "SONOFF_BASIC"
  130. // Buttons
  131. #define BUTTON1_PIN 0
  132. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  133. #define BUTTON1_RELAY 1
  134. // Relays
  135. #define RELAY1_PIN 12
  136. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  137. // LEDs
  138. #define LED1_PIN 13
  139. #define LED1_PIN_INVERSE 1
  140. #elif defined(ITEAD_SONOFF_RF)
  141. // Info
  142. #define MANUFACTURER "ITEAD"
  143. #define DEVICE "SONOFF_RF"
  144. // Buttons
  145. #define BUTTON1_PIN 0
  146. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  147. #define BUTTON1_RELAY 1
  148. // Relays
  149. #define RELAY1_PIN 12
  150. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  151. // LEDs
  152. #define LED1_PIN 13
  153. #define LED1_PIN_INVERSE 1
  154. #elif defined(ITEAD_SONOFF_TH)
  155. // Info
  156. #define MANUFACTURER "ITEAD"
  157. #define DEVICE "SONOFF_TH"
  158. // Buttons
  159. #define BUTTON1_PIN 0
  160. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  161. #define BUTTON1_RELAY 1
  162. // Relays
  163. #define RELAY1_PIN 12
  164. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  165. // LEDs
  166. #define LED1_PIN 13
  167. #define LED1_PIN_INVERSE 1
  168. #elif defined(ITEAD_SONOFF_SV)
  169. // Info
  170. #define MANUFACTURER "ITEAD"
  171. #define DEVICE "SONOFF_SV"
  172. // Buttons
  173. #define BUTTON1_PIN 0
  174. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  175. #define BUTTON1_RELAY 1
  176. // Relays
  177. #define RELAY1_PIN 12
  178. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  179. // LEDs
  180. #define LED1_PIN 13
  181. #define LED1_PIN_INVERSE 1
  182. #elif defined(ITEAD_SLAMPHER)
  183. // Info
  184. #define MANUFACTURER "ITEAD"
  185. #define DEVICE "SLAMPHER"
  186. // Buttons
  187. #define BUTTON1_PIN 0
  188. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  189. #define BUTTON1_RELAY 1
  190. // Relays
  191. #define RELAY1_PIN 12
  192. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  193. // LEDs
  194. #define LED1_PIN 13
  195. #define LED1_PIN_INVERSE 1
  196. #elif defined(ITEAD_S20)
  197. // Info
  198. #define MANUFACTURER "ITEAD"
  199. #define DEVICE "S20"
  200. // Buttons
  201. #define BUTTON1_PIN 0
  202. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  203. #define BUTTON1_RELAY 1
  204. // Relays
  205. #define RELAY1_PIN 12
  206. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  207. // LEDs
  208. #define LED1_PIN 13
  209. #define LED1_PIN_INVERSE 1
  210. #elif defined(ITEAD_SONOFF_TOUCH)
  211. // Info
  212. #define MANUFACTURER "ITEAD"
  213. #define DEVICE "SONOFF_TOUCH"
  214. // Buttons
  215. #define BUTTON1_PIN 0
  216. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  217. #define BUTTON1_RELAY 1
  218. // Relays
  219. #define RELAY1_PIN 12
  220. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  221. // LEDs
  222. #define LED1_PIN 13
  223. #define LED1_PIN_INVERSE 1
  224. #elif defined(ITEAD_SONOFF_POW)
  225. // Info
  226. #define MANUFACTURER "ITEAD"
  227. #define DEVICE "SONOFF_POW"
  228. // Buttons
  229. #define BUTTON1_PIN 0
  230. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  231. #define BUTTON1_RELAY 1
  232. // Relays
  233. #define RELAY1_PIN 12
  234. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  235. // LEDs
  236. #define LED1_PIN 15
  237. #define LED1_PIN_INVERSE 0
  238. // HLW8012
  239. #define POWER_PROVIDER POWER_PROVIDER_HLW8012
  240. #define HLW8012_SEL_PIN 5
  241. #define HLW8012_CF1_PIN 13
  242. #define HLW8012_CF_PIN 14
  243. #elif defined(ITEAD_SONOFF_DUAL)
  244. // Info
  245. #define MANUFACTURER "ITEAD"
  246. #define DEVICE "SONOFF_DUAL"
  247. #define SERIAL_BAUDRATE 19230
  248. #define RELAY_PROVIDER RELAY_PROVIDER_DUAL
  249. #define DUMMY_RELAY_COUNT 2
  250. #define DEBUG_SERIAL_SUPPORT 0
  251. #define TERMINAL_SUPPORT 0
  252. // Buttons
  253. #define BUTTON3_RELAY 1
  254. // LEDs
  255. #define LED1_PIN 13
  256. #define LED1_PIN_INVERSE 1
  257. #elif defined(ITEAD_SONOFF_4CH)
  258. // Info
  259. #define MANUFACTURER "ITEAD"
  260. #define DEVICE "SONOFF_4CH"
  261. // Buttons
  262. #define BUTTON1_PIN 0
  263. #define BUTTON2_PIN 9
  264. #define BUTTON3_PIN 10
  265. #define BUTTON4_PIN 14
  266. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  267. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  268. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  269. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  270. #define BUTTON1_RELAY 1
  271. #define BUTTON2_RELAY 2
  272. #define BUTTON3_RELAY 3
  273. #define BUTTON4_RELAY 4
  274. // Relays
  275. #define RELAY1_PIN 12
  276. #define RELAY2_PIN 5
  277. #define RELAY3_PIN 4
  278. #define RELAY4_PIN 15
  279. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  280. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  281. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  282. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  283. // LEDs
  284. #define LED1_PIN 13
  285. #define LED1_PIN_INVERSE 1
  286. #elif defined(ITEAD_SONOFF_4CH_PRO)
  287. // Info
  288. #define MANUFACTURER "ITEAD"
  289. #define DEVICE "SONOFF_4CH_PRO"
  290. // Buttons
  291. #define BUTTON1_PIN 0
  292. #define BUTTON2_PIN 9
  293. #define BUTTON3_PIN 10
  294. #define BUTTON4_PIN 14
  295. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  296. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  297. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  298. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  299. #define BUTTON1_RELAY 1
  300. #define BUTTON2_RELAY 2
  301. #define BUTTON3_RELAY 3
  302. #define BUTTON4_RELAY 4
  303. // Relays
  304. #define RELAY1_PIN 12
  305. #define RELAY2_PIN 5
  306. #define RELAY3_PIN 4
  307. #define RELAY4_PIN 15
  308. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  309. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  310. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  311. #define RELAY4_TYPE RELAY_TYPE_NORMAL
  312. // LEDs
  313. #define LED1_PIN 13
  314. #define LED1_PIN_INVERSE 1
  315. #elif defined(ITEAD_1CH_INCHING)
  316. // The inching functionality is managed by a misterious IC in the board.
  317. // You cannot control the inching button and functionality from the ESP8266
  318. // Besides, enabling the inching functionality using the hardware button
  319. // will result in the relay switching on and off continuously.
  320. // Fortunately the unkown IC keeps memory of the hardware inching status
  321. // so you can just disable it and forget. The inching LED must be lit.
  322. // You can still use the pulse options from the web interface
  323. // without problem.
  324. // Info
  325. #define MANUFACTURER "ITEAD"
  326. #define DEVICE "1CH_INCHING"
  327. // Buttons
  328. #define BUTTON1_PIN 0
  329. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  330. #define BUTTON1_RELAY 1
  331. // Relays
  332. #define RELAY1_PIN 12
  333. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  334. // LEDs
  335. #define LED1_PIN 13
  336. #define LED1_PIN_INVERSE 1
  337. #elif defined(ITEAD_MOTOR)
  338. // Info
  339. #define MANUFACTURER "ITEAD"
  340. #define DEVICE "MOTOR"
  341. // Buttons
  342. #define BUTTON1_PIN 0
  343. #define BUTTON1_RELAY 1
  344. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  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_BNSZ01)
  352. // Info
  353. #define MANUFACTURER "ITEAD"
  354. #define DEVICE "BNSZ01"
  355. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  356. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  357. #define DUMMY_RELAY_COUNT 1
  358. // LEDs
  359. #define LED1_PIN 13
  360. #define LED1_PIN_INVERSE 1
  361. // Channels
  362. #define LIGHT_CH1_PIN 12
  363. #define LIGHT_CH1_INVERSE 0
  364. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  365. // Info
  366. #define MANUFACTURER "ITEAD"
  367. #define DEVICE "SONOFF_RFBRIDGE"
  368. #define SERIAL_BAUDRATE 19200
  369. #define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE
  370. #ifndef DUMMY_RELAY_COUNT
  371. #define DUMMY_RELAY_COUNT 6
  372. #endif
  373. #define TERMINAL_SUPPORT 0
  374. #define TRACK_RELAY_STATUS 0
  375. // Buttons
  376. #define BUTTON1_PIN 0
  377. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  378. // LEDs
  379. #define LED1_PIN 13
  380. #define LED1_PIN_INVERSE 1
  381. #elif defined(ITEAD_SONOFF_B1)
  382. // Info
  383. #define MANUFACTURER "ITEAD"
  384. #define DEVICE "SONOFF_B1"
  385. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  386. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
  387. #define DUMMY_RELAY_COUNT 1
  388. #define MY9291_DI_PIN 12
  389. #define MY9291_DCKI_PIN 14
  390. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  391. #define MY9291_CHANNELS 5
  392. #elif defined(ITEAD_SONOFF_LED)
  393. // Info
  394. #define MANUFACTURER "ITEAD"
  395. #define DEVICE "SONOFF_LED"
  396. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  397. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  398. #define DUMMY_RELAY_COUNT 1
  399. // LEDs
  400. #define LED1_PIN 13
  401. #define LED1_PIN_INVERSE 1
  402. // Channels
  403. #define LIGHT_CH1_PIN 12 // Cold white
  404. #define LIGHT_CH2_PIN 14 // Warm white
  405. #define LIGHT_CH1_INVERSE 0
  406. #define LIGHT_CH2_INVERSE 0
  407. #elif defined(ITEAD_SONOFF_T1_1CH)
  408. // Info
  409. #define MANUFACTURER "ITEAD"
  410. #define DEVICE "SONOFF_T1_1CH"
  411. // Buttons
  412. #define BUTTON1_PIN 9
  413. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  414. #define BUTTON1_RELAY 1
  415. // Relays
  416. #define RELAY1_PIN 5
  417. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  418. // LEDs
  419. #define LED1_PIN 13
  420. #define LED1_PIN_INVERSE 1
  421. #elif defined(ITEAD_SONOFF_T1_2CH)
  422. // Info
  423. #define MANUFACTURER "ITEAD"
  424. #define DEVICE "SONOFF_T1_2CH"
  425. // Buttons
  426. #define BUTTON1_PIN 0
  427. #define BUTTON2_PIN 10
  428. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  429. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  430. #define BUTTON1_RELAY 1
  431. #define BUTTON2_RELAY 2
  432. // Relays
  433. #define RELAY1_PIN 12
  434. #define RELAY2_PIN 4
  435. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  436. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  437. // LEDs
  438. #define LED1_PIN 13
  439. #define LED1_PIN_INVERSE 1
  440. #elif defined(ITEAD_SONOFF_T1_3CH)
  441. // Info
  442. #define MANUFACTURER "ITEAD"
  443. #define DEVICE "SONOFF_T1_3CH"
  444. // Buttons
  445. #define BUTTON1_PIN 0
  446. #define BUTTON2_PIN 9
  447. #define BUTTON3_PIN 10
  448. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  449. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  450. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  451. #define BUTTON1_RELAY 1
  452. #define BUTTON2_RELAY 2
  453. #define BUTTON3_RELAY 3
  454. // Relays
  455. #define RELAY1_PIN 12
  456. #define RELAY2_PIN 5
  457. #define RELAY3_PIN 4
  458. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  459. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  460. #define RELAY3_TYPE RELAY_TYPE_NORMAL
  461. // LEDs
  462. #define LED1_PIN 13
  463. #define LED1_PIN_INVERSE 1
  464. // -----------------------------------------------------------------------------
  465. // Electrodragon boards
  466. // -----------------------------------------------------------------------------
  467. #elif defined(ELECTRODRAGON_WIFI_IOT)
  468. // Info
  469. #define MANUFACTURER "ELECTRODRAGON"
  470. #define DEVICE "WIFI_IOT"
  471. // Buttons
  472. #define BUTTON1_PIN 0
  473. #define BUTTON2_PIN 2
  474. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  475. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  476. #define BUTTON1_RELAY 1
  477. #define BUTTON2_RELAY 2
  478. // Relays
  479. #define RELAY1_PIN 12
  480. #define RELAY2_PIN 13
  481. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  482. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  483. // LEDs
  484. #define LED1_PIN 16
  485. #define LED1_PIN_INVERSE 0
  486. // -----------------------------------------------------------------------------
  487. // WorkChoice ecoPlug
  488. // -----------------------------------------------------------------------------
  489. #elif defined(WORKCHOICE_ECOPLUG)
  490. // Info
  491. #define MANUFACTURER "WORKCHOICE"
  492. #define DEVICE "ECOPLUG"
  493. // Buttons
  494. #define BUTTON1_PIN 13
  495. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  496. #define BUTTON1_RELAY 1
  497. // Relays
  498. #define RELAY1_PIN 15
  499. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  500. // LEDs
  501. #define LED1_PIN 2
  502. #define LED1_PIN_INVERSE 0
  503. // -----------------------------------------------------------------------------
  504. // AI Thinker
  505. // -----------------------------------------------------------------------------
  506. #elif defined(AITHINKER_AI_LIGHT)
  507. // Info
  508. #define MANUFACTURER "AITHINKER"
  509. #define DEVICE "AI_LIGHT"
  510. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  511. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
  512. #define DUMMY_RELAY_COUNT 1
  513. #define MY9291_DI_PIN 13
  514. #define MY9291_DCKI_PIN 15
  515. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  516. #define MY9291_CHANNELS 4
  517. // -----------------------------------------------------------------------------
  518. // LED Controller
  519. // -----------------------------------------------------------------------------
  520. #elif defined(MAGICHOME_LED_CONTROLLER)
  521. // Info
  522. #define MANUFACTURER "MAGICHOME"
  523. #define DEVICE "LED_CONTROLLER"
  524. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  525. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  526. #define DUMMY_RELAY_COUNT 1
  527. // LEDs
  528. #define LED1_PIN 2
  529. #define LED1_PIN_INVERSE 1
  530. // Channels
  531. #define LIGHT_CH1_PIN 14 // RED
  532. #define LIGHT_CH2_PIN 5 // GREEN
  533. #define LIGHT_CH3_PIN 12 // BLUE
  534. #define LIGHT_CH4_PIN 13 // WHITE
  535. #define LIGHT_CH1_INVERSE 0
  536. #define LIGHT_CH2_INVERSE 0
  537. #define LIGHT_CH3_INVERSE 0
  538. #define LIGHT_CH4_INVERSE 0
  539. #elif defined(MAGICHOME_LED_CONTROLLER_2_0)
  540. // Info
  541. #define MANUFACTURER "MAGICHOME"
  542. #define DEVICE "LED_CONTROLLER_2_0"
  543. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  544. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  545. #define DUMMY_RELAY_COUNT 1
  546. // Channels
  547. #define LIGHT_CH1_PIN 5 // RED
  548. #define LIGHT_CH2_PIN 12 // GREEN
  549. #define LIGHT_CH3_PIN 13 // BLUE
  550. #define LIGHT_CH4_PIN 15 // WHITE
  551. #define LIGHT_CH1_INVERSE 0
  552. #define LIGHT_CH2_INVERSE 0
  553. #define LIGHT_CH3_INVERSE 0
  554. #define LIGHT_CH4_INVERSE 0
  555. // -----------------------------------------------------------------------------
  556. // HUACANXING H801
  557. // -----------------------------------------------------------------------------
  558. #elif defined(HUACANXING_H801)
  559. // Info
  560. #define MANUFACTURER "HUACANXING"
  561. #define DEVICE "H801"
  562. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  563. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  564. #define DUMMY_RELAY_COUNT 1
  565. // LEDs
  566. #define LED1_PIN 5
  567. #define LED1_PIN_INVERSE 1
  568. // Channels
  569. #define LIGHT_CH1_PIN 15 // RED
  570. #define LIGHT_CH2_PIN 13 // GREEN
  571. #define LIGHT_CH3_PIN 12 // BLUE
  572. #define LIGHT_CH4_PIN 14 // WHITE1
  573. #define LIGHT_CH5_PIN 4 // WHITE2
  574. #define LIGHT_CH1_INVERSE 0
  575. #define LIGHT_CH2_INVERSE 0
  576. #define LIGHT_CH3_INVERSE 0
  577. #define LIGHT_CH4_INVERSE 0
  578. #define LIGHT_CH5_INVERSE 0
  579. // -----------------------------------------------------------------------------
  580. // Jan Goedeke Wifi Relay
  581. // https://github.com/JanGoe/esp8266-wifi-relay
  582. // -----------------------------------------------------------------------------
  583. #elif defined(JANGOE_WIFI_RELAY_NC)
  584. // Info
  585. #define MANUFACTURER "JANGOE"
  586. #define DEVICE "WIFI_RELAY_NC"
  587. // Buttons
  588. #define BUTTON1_PIN 12
  589. #define BUTTON2_PIN 13
  590. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  591. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  592. #define BUTTON1_RELAY 1
  593. #define BUTTON2_RELAY 2
  594. // Relays
  595. #define RELAY1_PIN 2
  596. #define RELAY2_PIN 14
  597. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  598. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  599. #elif defined(JANGOE_WIFI_RELAY_NO)
  600. // Info
  601. #define MANUFACTURER "JANGOE"
  602. #define DEVICE "WIFI_RELAY_NO"
  603. // Buttons
  604. #define BUTTON1_PIN 12
  605. #define BUTTON2_PIN 13
  606. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  607. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  608. #define BUTTON1_RELAY 1
  609. #define BUTTON2_RELAY 2
  610. // Relays
  611. #define RELAY1_PIN 2
  612. #define RELAY2_PIN 14
  613. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  614. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  615. // -----------------------------------------------------------------------------
  616. // Jorge García Wifi+Relays Board Kit
  617. // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
  618. // https://github.com/jorgegarciadev/wifikit
  619. // -----------------------------------------------------------------------------
  620. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  621. // Info
  622. #define MANUFACTURER "JORGEGARCIA"
  623. #define DEVICE "WIFI_RELAYS"
  624. // Relays
  625. #define RELAY1_PIN 0
  626. #define RELAY2_PIN 2
  627. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  628. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  629. // -----------------------------------------------------------------------------
  630. // WiFi MQTT Relay / Thermostat
  631. // -----------------------------------------------------------------------------
  632. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  633. // Info
  634. #define MANUFACTURER "OPENENERGYMONITOR"
  635. #define DEVICE "MQTT_RELAY"
  636. // Buttons
  637. #define BUTTON1_PIN 0
  638. #define BUTTON1_RELAY 1
  639. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  640. // Relays
  641. #define RELAY1_PIN 12
  642. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  643. // LEDs
  644. #define LED1_PIN 16
  645. #define LED1_PIN_INVERSE 0
  646. // -----------------------------------------------------------------------------
  647. // WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap
  648. // 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
  649. // 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
  650. // -----------------------------------------------------------------------------
  651. #elif defined(WION_50055)
  652. // Currently untested, does not support energy monitoring
  653. // Info
  654. #define MANUFACTURER "WION"
  655. #define DEVICE "50055"
  656. // Buttons
  657. #define BUTTON1_PIN 13
  658. #define BUTTON1_RELAY 1
  659. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  660. // Relays
  661. #define RELAY1_PIN 15
  662. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  663. // LEDs
  664. #define LED1_PIN 2
  665. #define LED1_PIN_INVERSE 0
  666. // -----------------------------------------------------------------------------
  667. // EX-Store Wifi Relay v3.1
  668. // https://ex-store.de/ESP8266-WiFi-Relay-V31
  669. // -----------------------------------------------------------------------------
  670. #elif defined(EXS_WIFI_RELAY_V31)
  671. // Untested
  672. // Info
  673. #define MANUFACTURER "EXS"
  674. #define DEVICE "WIFI_RELAY_V31"
  675. // Buttons
  676. #define BUTTON1_PIN 0
  677. #define BUTTON1_RELAY 1
  678. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  679. // Relays
  680. #define RELAY1_PIN 13
  681. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  682. #define RELAY1_RESET_PIN 12
  683. // -----------------------------------------------------------------------------
  684. // HUACANXING H802
  685. // -----------------------------------------------------------------------------
  686. #elif defined(HUACANXING_H802)
  687. // Info
  688. #define MANUFACTURER "HUACANXING"
  689. #define DEVICE "H802"
  690. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  691. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  692. #define DUMMY_RELAY_COUNT 1
  693. // Channels
  694. #define LIGHT_CH1_PIN 12 // RED
  695. #define LIGHT_CH2_PIN 14 // GREEN
  696. #define LIGHT_CH3_PIN 13 // BLUE
  697. #define LIGHT_CH4_PIN 15 // WHITE
  698. #define LIGHT_CH1_INVERSE 0
  699. #define LIGHT_CH2_INVERSE 0
  700. #define LIGHT_CH3_INVERSE 0
  701. #define LIGHT_CH4_INVERSE 0
  702. // -----------------------------------------------------------------------------
  703. // V9261F
  704. // -----------------------------------------------------------------------------
  705. #elif defined(GENERIC_V9261F)
  706. // Info
  707. #define MANUFACTURER "GENERIC"
  708. #define DEVICE "V9261F"
  709. // V9261F
  710. #define POWER_PROVIDER POWER_PROVIDER_V9261F
  711. #define V9261F_PIN 2
  712. #define V9261F_PIN_INVERSE 1
  713. // -----------------------------------------------------------------------------
  714. // ECH1560
  715. // -----------------------------------------------------------------------------
  716. #elif defined(GENERIC_ECH1560)
  717. // Info
  718. #define MANUFACTURER "GENERIC"
  719. #define DEVICE "ECH1560"
  720. // ECH1560
  721. #define POWER_PROVIDER POWER_PROVIDER_ECH1560
  722. #define ECH1560_CLK_PIN 4
  723. #define ECH1560_MISO_PIN 5
  724. #define ECH1560_INVERTED 0
  725. // -----------------------------------------------------------------------------
  726. // ESPLive
  727. // https://github.com/ManCaveMade/ESP-Live
  728. // -----------------------------------------------------------------------------
  729. #elif defined(MANCAVEMADE_ESPLIVE)
  730. // Info
  731. #define MANUFACTURER "MANCAVEMADE"
  732. #define DEVICE "ESPLIVE"
  733. // Buttons
  734. #define BUTTON1_PIN 4
  735. #define BUTTON2_PIN 5
  736. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  737. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  738. #define BUTTON1_RELAY 1
  739. #define BUTTON2_RELAY 2
  740. // Relays
  741. #define RELAY1_PIN 12
  742. #define RELAY2_PIN 13
  743. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  744. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  745. // DB18B20
  746. #define DS18B20_SUPPORT 1
  747. #define DS18B20_PIN 2
  748. #define DS18B20_UPDATE_INTERVAL 5000
  749. #define DS18B20_UPDATE_ON_CHANGE 1.0
  750. // QuinLED
  751. // - http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html/
  752. // -----------------------------------------------------------------------------
  753. #elif defined(INTERMITTECH_QUINLED)
  754. // Info
  755. #define MANUFACTURER "INTERMITTECH"
  756. #define DEVICE "QUINLED"
  757. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  758. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  759. #define DUMMY_RELAY_COUNT 1
  760. // LEDs
  761. #define LED1_PIN 5
  762. #define LED1_PIN_INVERSE 1
  763. // Channels
  764. #define LIGHT_CH1_PIN 0
  765. #define LIGHT_CH2_PIN 2
  766. #define LIGHT_CH1_INVERSE 0
  767. #define LIGHT_CH2_INVERSE 0
  768. // -----------------------------------------------------------------------------
  769. // Unknown hardware
  770. // -----------------------------------------------------------------------------
  771. #else
  772. #error "UNSUPPORTED HARDWARE!"
  773. #endif
  774. // -----------------------------------------------------------------------------
  775. // Default values
  776. // -----------------------------------------------------------------------------
  777. #ifndef BUTTON1_PRESS
  778. #define BUTTON1_PRESS BUTTON_MODE_NONE
  779. #endif
  780. #ifndef BUTTON2_PRESS
  781. #define BUTTON2_PRESS BUTTON_MODE_NONE
  782. #endif
  783. #ifndef BUTTON3_PRESS
  784. #define BUTTON3_PRESS BUTTON_MODE_NONE
  785. #endif
  786. #ifndef BUTTON4_PRESS
  787. #define BUTTON4_PRESS BUTTON_MODE_NONE
  788. #endif
  789. #ifndef BUTTON1_CLICK
  790. #define BUTTON1_CLICK BUTTON_MODE_TOGGLE
  791. #endif
  792. #ifndef BUTTON2_CLICK
  793. #define BUTTON2_CLICK BUTTON_MODE_TOGGLE
  794. #endif
  795. #ifndef BUTTON3_CLICK
  796. #define BUTTON3_CLICK BUTTON_MODE_TOGGLE
  797. #endif
  798. #ifndef BUTTON4_CLICK
  799. #define BUTTON4_CLICK BUTTON_MODE_TOGGLE
  800. #endif
  801. #ifndef BUTTON1_DBLCLICK
  802. #define BUTTON1_DBLCLICK BUTTON_MODE_AP
  803. #endif
  804. #ifndef BUTTON2_DBLCLICK
  805. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  806. #endif
  807. #ifndef BUTTON3_DBLCLICK
  808. #define BUTTON3_DBLCLICK BUTTON_MODE_NONE
  809. #endif
  810. #ifndef BUTTON4_DBLCLICK
  811. #define BUTTON4_DBLCLICK BUTTON_MODE_NONE
  812. #endif
  813. #ifndef BUTTON1_LNGCLICK
  814. #define BUTTON1_LNGCLICK BUTTON_MODE_RESET
  815. #endif
  816. #ifndef BUTTON2_LNGCLICK
  817. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  818. #endif
  819. #ifndef BUTTON3_LNGCLICK
  820. #define BUTTON3_LNGCLICK BUTTON_MODE_NONE
  821. #endif
  822. #ifndef BUTTON4_LNGCLICK
  823. #define BUTTON4_LNGCLICK BUTTON_MODE_NONE
  824. #endif
  825. #ifndef BUTTON1_LNGLNGCLICK
  826. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_FACTORY
  827. #endif
  828. #ifndef BUTTON2_LNGLNGCLICK
  829. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
  830. #endif
  831. #ifndef BUTTON3_LNGLNGCLICK
  832. #define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE
  833. #endif
  834. #ifndef BUTTON4_LNGLNGCLICK
  835. #define BUTTON4_LNGLNGCLICK BUTTON_MODE_NONE
  836. #endif
  837. #ifndef BUTTON1_RELAY
  838. #define BUTTON1_RELAY 0
  839. #endif
  840. #ifndef BUTTON2_RELAY
  841. #define BUTTON2_RELAY 0
  842. #endif
  843. #ifndef BUTTON3_RELAY
  844. #define BUTTON3_RELAY 0
  845. #endif
  846. #ifndef BUTTON4_RELAY
  847. #define BUTTON4_RELAY 0
  848. #endif
  849. #ifndef RELAY1_RESET_PIN
  850. #define RELAY1_RESET_PIN 0
  851. #endif
  852. #ifndef RELAY2_RESET_PIN
  853. #define RELAY2_RESET_PIN 0
  854. #endif
  855. #ifndef RELAY3_RESET_PIN
  856. #define RELAY3_RESET_PIN 0
  857. #endif
  858. #ifndef RELAY4_RESET_PIN
  859. #define RELAY4_RESET_PIN 0
  860. #endif
  861. #ifndef RELAY1_DELAY_ON
  862. #define RELAY1_DELAY_ON 0
  863. #endif
  864. #ifndef RELAY2_DELAY_ON
  865. #define RELAY2_DELAY_ON 0
  866. #endif
  867. #ifndef RELAY3_DELAY_ON
  868. #define RELAY3_DELAY_ON 0
  869. #endif
  870. #ifndef RELAY4_DELAY_ON
  871. #define RELAY4_DELAY_ON 0
  872. #endif
  873. #ifndef RELAY1_DELAY_OFF
  874. #define RELAY1_DELAY_OFF 0
  875. #endif
  876. #ifndef RELAY2_DELAY_OFF
  877. #define RELAY2_DELAY_OFF 0
  878. #endif
  879. #ifndef RELAY3_DELAY_OFF
  880. #define RELAY3_DELAY_OFF 0
  881. #endif
  882. #ifndef RELAY4_DELAY_OFF
  883. #define RELAY4_DELAY_OFF 0
  884. #endif
  885. #ifndef RELAY1_LED
  886. #define RELAY1_LED 0
  887. #endif
  888. #ifndef RELAY2_LED
  889. #define RELAY2_LED 0
  890. #endif
  891. #ifndef RELAY3_LED
  892. #define RELAY3_LED 0
  893. #endif
  894. #ifndef RELAY4_LED
  895. #define RELAY4_LED 0
  896. #endif
  897. // Needed for ESP8285 boards under Windows using PlatformIO (?)
  898. #ifndef BUTTON_PUSHBUTTON
  899. #define BUTTON_PUSHBUTTON 0
  900. #define BUTTON_SWITCH 1
  901. #define BUTTON_DEFAULT_HIGH 2
  902. #define BUTTON_SET_PULLUP 4
  903. #endif
  904. // Does the board track the relay status?
  905. #ifndef TRACK_RELAY_STATUS
  906. #define TRACK_RELAY_STATUS 1
  907. #endif
  908. // Serial baudrate
  909. #ifndef SERIAL_BAUDRATE
  910. #define SERIAL_BAUDRATE 115200
  911. #endif
  912. // Relay providers
  913. #ifndef RELAY_PROVIDER
  914. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  915. #endif
  916. // Light provider
  917. #ifndef LIGHT_PROVIDER
  918. #define LIGHT_PROVIDER LIGHT_PROVIDER_NONE
  919. #endif