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.

1163 lines
33 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. // -----------------------------------------------------------------------------
  540. // HUACANXING H801
  541. // -----------------------------------------------------------------------------
  542. #elif defined(HUACANXING_H801)
  543. // Info
  544. #define MANUFACTURER "HUACANXING"
  545. #define DEVICE "H801"
  546. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  547. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  548. #define DUMMY_RELAY_COUNT 1
  549. // LEDs
  550. #define LED1_PIN 5
  551. #define LED1_PIN_INVERSE 1
  552. // Channels
  553. #define LIGHT_CH1_PIN 15 // RED
  554. #define LIGHT_CH2_PIN 13 // GREEN
  555. #define LIGHT_CH3_PIN 12 // BLUE
  556. #define LIGHT_CH4_PIN 14 // WHITE1
  557. #define LIGHT_CH5_PIN 4 // WHITE2
  558. #define LIGHT_CH1_INVERSE 0
  559. #define LIGHT_CH2_INVERSE 0
  560. #define LIGHT_CH3_INVERSE 0
  561. #define LIGHT_CH4_INVERSE 0
  562. #define LIGHT_CH5_INVERSE 0
  563. // -----------------------------------------------------------------------------
  564. // Jan Goedeke Wifi Relay
  565. // https://github.com/JanGoe/esp8266-wifi-relay
  566. // -----------------------------------------------------------------------------
  567. #elif defined(JANGOE_WIFI_RELAY_NC)
  568. // Info
  569. #define MANUFACTURER "JANGOE"
  570. #define DEVICE "WIFI_RELAY_NC"
  571. // Buttons
  572. #define BUTTON1_PIN 12
  573. #define BUTTON2_PIN 13
  574. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  575. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  576. #define BUTTON1_RELAY 1
  577. #define BUTTON2_RELAY 2
  578. // Relays
  579. #define RELAY1_PIN 2
  580. #define RELAY2_PIN 14
  581. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  582. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  583. #elif defined(JANGOE_WIFI_RELAY_NO)
  584. // Info
  585. #define MANUFACTURER "JANGOE"
  586. #define DEVICE "WIFI_RELAY_NO"
  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_NORMAL
  598. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  599. // -----------------------------------------------------------------------------
  600. // Jorge García Wifi+Relays Board Kit
  601. // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
  602. // https://github.com/jorgegarciadev/wifikit
  603. // -----------------------------------------------------------------------------
  604. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  605. // Info
  606. #define MANUFACTURER "JORGEGARCIA"
  607. #define DEVICE "WIFI_RELAYS"
  608. // Relays
  609. #define RELAY1_PIN 0
  610. #define RELAY2_PIN 2
  611. #define RELAY1_TYPE RELAY_TYPE_INVERSE
  612. #define RELAY2_TYPE RELAY_TYPE_INVERSE
  613. // -----------------------------------------------------------------------------
  614. // WiFi MQTT Relay / Thermostat
  615. // -----------------------------------------------------------------------------
  616. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  617. // Info
  618. #define MANUFACTURER "OPENENERGYMONITOR"
  619. #define DEVICE "MQTT_RELAY"
  620. // Buttons
  621. #define BUTTON1_PIN 0
  622. #define BUTTON1_RELAY 1
  623. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  624. // Relays
  625. #define RELAY1_PIN 12
  626. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  627. // LEDs
  628. #define LED1_PIN 16
  629. #define LED1_PIN_INVERSE 0
  630. // -----------------------------------------------------------------------------
  631. // WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap
  632. // 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
  633. // 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
  634. // -----------------------------------------------------------------------------
  635. #elif defined(WION_50055)
  636. // Currently untested, does not support energy monitoring
  637. // Info
  638. #define MANUFACTURER "WION"
  639. #define DEVICE "50055"
  640. // Buttons
  641. #define BUTTON1_PIN 13
  642. #define BUTTON1_RELAY 1
  643. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  644. // Relays
  645. #define RELAY1_PIN 15
  646. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  647. // LEDs
  648. #define LED1_PIN 2
  649. #define LED1_PIN_INVERSE 0
  650. // -----------------------------------------------------------------------------
  651. // EX-Store Wifi Relay v3.1
  652. // https://ex-store.de/ESP8266-WiFi-Relay-V31
  653. // -----------------------------------------------------------------------------
  654. #elif defined(EXS_WIFI_RELAY_V31)
  655. // Untested
  656. // Info
  657. #define MANUFACTURER "EXS"
  658. #define DEVICE "WIFI_RELAY_V31"
  659. // Buttons
  660. #define BUTTON1_PIN 0
  661. #define BUTTON1_RELAY 1
  662. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  663. // Relays
  664. #define RELAY1_PIN 13
  665. #define RELAY1_TYPE RELAY_TYPE_LATCHED
  666. #define RELAY1_RESET_PIN 12
  667. // -----------------------------------------------------------------------------
  668. // HUACANXING H802
  669. // -----------------------------------------------------------------------------
  670. #elif defined(HUACANXING_H802)
  671. // Info
  672. #define MANUFACTURER "HUACANXING"
  673. #define DEVICE "H802"
  674. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  675. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  676. #define DUMMY_RELAY_COUNT 1
  677. // Channels
  678. #define LIGHT_CH1_PIN 12 // RED
  679. #define LIGHT_CH2_PIN 14 // GREEN
  680. #define LIGHT_CH3_PIN 13 // BLUE
  681. #define LIGHT_CH4_PIN 15 // WHITE
  682. #define LIGHT_CH1_INVERSE 0
  683. #define LIGHT_CH2_INVERSE 0
  684. #define LIGHT_CH3_INVERSE 0
  685. #define LIGHT_CH4_INVERSE 0
  686. // -----------------------------------------------------------------------------
  687. // V9261F
  688. // -----------------------------------------------------------------------------
  689. #elif defined(GENERIC_V9261F)
  690. // Info
  691. #define MANUFACTURER "GENERIC"
  692. #define DEVICE "V9261F"
  693. // V9261F
  694. #define POWER_PROVIDER POWER_PROVIDER_V9261F
  695. #define V9261F_PIN 2
  696. #define V9261F_PIN_INVERSE 1
  697. // -----------------------------------------------------------------------------
  698. // ECH1560
  699. // -----------------------------------------------------------------------------
  700. #elif defined(GENERIC_ECH1560)
  701. // Info
  702. #define MANUFACTURER "GENERIC"
  703. #define DEVICE "ECH1560"
  704. // ECH1560
  705. #define POWER_PROVIDER POWER_PROVIDER_ECH1560
  706. #define ECH1560_CLK_PIN 4
  707. #define ECH1560_MISO_PIN 5
  708. #define ECH1560_INVERTED 0
  709. // -----------------------------------------------------------------------------
  710. // ESPLive
  711. // https://github.com/ManCaveMade/ESP-Live
  712. // -----------------------------------------------------------------------------
  713. #elif defined(MANCAVEMADE_ESPLIVE)
  714. // Info
  715. #define MANUFACTURER "MANCAVEMADE"
  716. #define DEVICE "ESPLIVE"
  717. // Buttons
  718. #define BUTTON1_PIN 4
  719. #define BUTTON2_PIN 5
  720. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  721. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  722. #define BUTTON1_RELAY 1
  723. #define BUTTON2_RELAY 2
  724. // Relays
  725. #define RELAY1_PIN 12
  726. #define RELAY2_PIN 13
  727. #define RELAY1_TYPE RELAY_TYPE_NORMAL
  728. #define RELAY2_TYPE RELAY_TYPE_NORMAL
  729. // DB18B20
  730. #define DS18B20_SUPPORT 1
  731. #define DS18B20_PIN 2
  732. #define DS18B20_UPDATE_INTERVAL 5000
  733. #define DS18B20_UPDATE_ON_CHANGE 1.0
  734. // QuinLED
  735. // - http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html/
  736. // -----------------------------------------------------------------------------
  737. #elif defined(QUINLED)
  738. // Info
  739. #define MANUFACTURER "INTERMIT.TECH"
  740. #define DEVICE "QUINLED"
  741. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  742. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  743. #define DUMMY_RELAY_COUNT 1
  744. // LEDs
  745. #define LED1_PIN 5
  746. #define LED1_PIN_INVERSE 1
  747. // Channels
  748. #define LIGHT_CH1_PIN 0
  749. #define LIGHT_CH2_PIN 2
  750. #define LIGHT_CH1_INVERSE 0
  751. #define LIGHT_CH2_INVERSE 0
  752. // -----------------------------------------------------------------------------
  753. // Unknown hardware
  754. // -----------------------------------------------------------------------------
  755. #else
  756. #error "UNSUPPORTED HARDWARE!"
  757. #endif
  758. // -----------------------------------------------------------------------------
  759. // Default values
  760. // -----------------------------------------------------------------------------
  761. #ifndef BUTTON1_PRESS
  762. #define BUTTON1_PRESS BUTTON_MODE_NONE
  763. #endif
  764. #ifndef BUTTON2_PRESS
  765. #define BUTTON2_PRESS BUTTON_MODE_NONE
  766. #endif
  767. #ifndef BUTTON3_PRESS
  768. #define BUTTON3_PRESS BUTTON_MODE_NONE
  769. #endif
  770. #ifndef BUTTON4_PRESS
  771. #define BUTTON4_PRESS BUTTON_MODE_NONE
  772. #endif
  773. #ifndef BUTTON1_CLICK
  774. #define BUTTON1_CLICK BUTTON_MODE_TOGGLE
  775. #endif
  776. #ifndef BUTTON2_CLICK
  777. #define BUTTON2_CLICK BUTTON_MODE_TOGGLE
  778. #endif
  779. #ifndef BUTTON3_CLICK
  780. #define BUTTON3_CLICK BUTTON_MODE_TOGGLE
  781. #endif
  782. #ifndef BUTTON4_CLICK
  783. #define BUTTON4_CLICK BUTTON_MODE_TOGGLE
  784. #endif
  785. #ifndef BUTTON1_DBLCLICK
  786. #define BUTTON1_DBLCLICK BUTTON_MODE_AP
  787. #endif
  788. #ifndef BUTTON2_DBLCLICK
  789. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  790. #endif
  791. #ifndef BUTTON3_DBLCLICK
  792. #define BUTTON3_DBLCLICK BUTTON_MODE_NONE
  793. #endif
  794. #ifndef BUTTON4_DBLCLICK
  795. #define BUTTON4_DBLCLICK BUTTON_MODE_NONE
  796. #endif
  797. #ifndef BUTTON1_LNGCLICK
  798. #define BUTTON1_LNGCLICK BUTTON_MODE_RESET
  799. #endif
  800. #ifndef BUTTON2_LNGCLICK
  801. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  802. #endif
  803. #ifndef BUTTON3_LNGCLICK
  804. #define BUTTON3_LNGCLICK BUTTON_MODE_NONE
  805. #endif
  806. #ifndef BUTTON4_LNGCLICK
  807. #define BUTTON4_LNGCLICK BUTTON_MODE_NONE
  808. #endif
  809. #ifndef BUTTON1_LNGLNGCLICK
  810. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_FACTORY
  811. #endif
  812. #ifndef BUTTON2_LNGLNGCLICK
  813. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
  814. #endif
  815. #ifndef BUTTON3_LNGLNGCLICK
  816. #define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE
  817. #endif
  818. #ifndef BUTTON4_LNGLNGCLICK
  819. #define BUTTON4_LNGLNGCLICK BUTTON_MODE_NONE
  820. #endif
  821. #ifndef BUTTON1_RELAY
  822. #define BUTTON1_RELAY 0
  823. #endif
  824. #ifndef BUTTON2_RELAY
  825. #define BUTTON2_RELAY 0
  826. #endif
  827. #ifndef BUTTON3_RELAY
  828. #define BUTTON3_RELAY 0
  829. #endif
  830. #ifndef BUTTON4_RELAY
  831. #define BUTTON4_RELAY 0
  832. #endif
  833. #ifndef RELAY1_RESET_PIN
  834. #define RELAY1_RESET_PIN 0
  835. #endif
  836. #ifndef RELAY2_RESET_PIN
  837. #define RELAY2_RESET_PIN 0
  838. #endif
  839. #ifndef RELAY3_RESET_PIN
  840. #define RELAY3_RESET_PIN 0
  841. #endif
  842. #ifndef RELAY4_RESET_PIN
  843. #define RELAY4_RESET_PIN 0
  844. #endif
  845. #ifndef RELAY1_DELAY_ON
  846. #define RELAY1_DELAY_ON 0
  847. #endif
  848. #ifndef RELAY2_DELAY_ON
  849. #define RELAY2_DELAY_ON 0
  850. #endif
  851. #ifndef RELAY3_DELAY_ON
  852. #define RELAY3_DELAY_ON 0
  853. #endif
  854. #ifndef RELAY4_DELAY_ON
  855. #define RELAY4_DELAY_ON 0
  856. #endif
  857. #ifndef RELAY1_DELAY_OFF
  858. #define RELAY1_DELAY_OFF 0
  859. #endif
  860. #ifndef RELAY2_DELAY_OFF
  861. #define RELAY2_DELAY_OFF 0
  862. #endif
  863. #ifndef RELAY3_DELAY_OFF
  864. #define RELAY3_DELAY_OFF 0
  865. #endif
  866. #ifndef RELAY4_DELAY_OFF
  867. #define RELAY4_DELAY_OFF 0
  868. #endif
  869. #ifndef RELAY1_LED
  870. #define RELAY1_LED 0
  871. #endif
  872. #ifndef RELAY2_LED
  873. #define RELAY2_LED 0
  874. #endif
  875. #ifndef RELAY3_LED
  876. #define RELAY3_LED 0
  877. #endif
  878. #ifndef RELAY4_LED
  879. #define RELAY4_LED 0
  880. #endif
  881. // Needed for ESP8285 boards under Windows using PlatformIO (?)
  882. #ifndef BUTTON_PUSHBUTTON
  883. #define BUTTON_PUSHBUTTON 0
  884. #define BUTTON_SWITCH 1
  885. #define BUTTON_DEFAULT_HIGH 2
  886. #define BUTTON_SET_PULLUP 4
  887. #endif
  888. // Does the board track the relay status?
  889. #ifndef TRACK_RELAY_STATUS
  890. #define TRACK_RELAY_STATUS 1
  891. #endif
  892. // Serial baudrate
  893. #ifndef SERIAL_BAUDRATE
  894. #define SERIAL_BAUDRATE 115200
  895. #endif
  896. // Relay providers
  897. #ifndef RELAY_PROVIDER
  898. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  899. #endif
  900. // Light provider
  901. #ifndef LIGHT_PROVIDER
  902. #define LIGHT_PROVIDER LIGHT_PROVIDER_NONE
  903. #endif