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.

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