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.

1004 lines
28 KiB

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