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.

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