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.

682 lines
22 KiB

  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#_PIN_INVERSE: Relay has inversed logic (closed or ON when pulled down)
  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. // WIFI_LED: LED number that will used for WIFI notifications (1-based, defaults to 1)
  20. // -----------------------------------------------------------------------------
  21. // Development boards
  22. // -----------------------------------------------------------------------------
  23. #if defined(NODEMCUV2)
  24. #define MANUFACTURER "NODEMCU"
  25. #define DEVICE "LOLIN"
  26. #define BUTTON1_PIN 0
  27. #define BUTTON1_RELAY 1
  28. #define BUTTON1_LNGCLICK BUTTON_MODE_PULSE
  29. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  30. #define RELAY1_PIN 12
  31. #define RELAY1_PIN_INVERSE 0
  32. #define LED1_PIN 2
  33. #define LED1_PIN_INVERSE 1
  34. #elif defined(D1_RELAYSHIELD)
  35. #define MANUFACTURER "WEMOS"
  36. #define DEVICE "D1_MINI"
  37. #define RELAY1_PIN 5
  38. #define RELAY1_PIN_INVERSE 0
  39. #define LED1_PIN 2
  40. #define LED1_PIN_INVERSE 1
  41. // -----------------------------------------------------------------------------
  42. // ESPurna
  43. // -----------------------------------------------------------------------------
  44. #elif defined(ESPURNA_H)
  45. #define MANUFACTURER "TINKERMAN"
  46. #define DEVICE "ESPURNA_H"
  47. #define RELAY1_PIN 12
  48. #define RELAY1_PIN_INVERSE 1
  49. #define LED1_PIN 5
  50. #define LED1_PIN_INVERSE 0
  51. #define BUTTON1_PIN 4
  52. #define BUTTON1_RELAY 1
  53. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  54. #define ENABLE_HLW8012 1
  55. // -----------------------------------------------------------------------------
  56. // Itead Studio boards
  57. // -----------------------------------------------------------------------------
  58. #elif defined(SONOFF)
  59. #define MANUFACTURER "ITEAD"
  60. #define DEVICE "SONOFF"
  61. #define BUTTON1_PIN 0
  62. #define BUTTON1_RELAY 1
  63. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  64. #define RELAY1_PIN 12
  65. #define RELAY1_PIN_INVERSE 0
  66. #define LED1_PIN 13
  67. #define LED1_PIN_INVERSE 1
  68. #elif defined(SONOFF_TH)
  69. #define MANUFACTURER "ITEAD"
  70. #define DEVICE "SONOFF_TH"
  71. #define BUTTON1_PIN 0
  72. #define BUTTON1_RELAY 1
  73. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  74. #define RELAY1_PIN 12
  75. #define RELAY1_PIN_INVERSE 0
  76. #define LED1_PIN 13
  77. #define LED1_PIN_INVERSE 1
  78. #elif defined(SONOFF_SV)
  79. #define MANUFACTURER "ITEAD"
  80. #define DEVICE "SONOFF_SV"
  81. #define BUTTON1_PIN 0
  82. #define BUTTON1_RELAY 1
  83. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  84. #define RELAY1_PIN 12
  85. #define RELAY1_PIN_INVERSE 0
  86. #define LED1_PIN 13
  87. #define LED1_PIN_INVERSE 1
  88. #elif defined(SLAMPHER)
  89. #define MANUFACTURER "ITEAD"
  90. #define DEVICE "SLAMPHER"
  91. #define BUTTON1_PIN 0
  92. #define BUTTON1_RELAY 1
  93. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  94. #define RELAY1_PIN 12
  95. #define RELAY1_PIN_INVERSE 0
  96. #define LED1_PIN 13
  97. #define LED1_PIN_INVERSE 1
  98. #elif defined(S20)
  99. #define MANUFACTURER "ITEAD"
  100. #define DEVICE "S20"
  101. #define BUTTON1_PIN 0
  102. #define BUTTON1_RELAY 1
  103. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  104. #define RELAY1_PIN 12
  105. #define RELAY1_PIN_INVERSE 0
  106. #define LED1_PIN 13
  107. #define LED1_PIN_INVERSE 1
  108. #elif defined(SONOFF_TOUCH)
  109. #define MANUFACTURER "ITEAD"
  110. #define DEVICE "SONOFF_TOUCH"
  111. #define BUTTON1_PIN 0
  112. #define BUTTON1_RELAY 1
  113. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  114. #define RELAY1_PIN 12
  115. #define RELAY1_PIN_INVERSE 0
  116. #define LED1_PIN 13
  117. #define LED1_PIN_INVERSE 1
  118. #elif defined(SONOFF_POW)
  119. #define MANUFACTURER "ITEAD"
  120. #define DEVICE "SONOFF_POW"
  121. #define BUTTON1_PIN 0
  122. #define BUTTON1_RELAY 1
  123. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  124. #define RELAY1_PIN 12
  125. #define RELAY1_PIN_INVERSE 0
  126. #define LED1_PIN 15
  127. #define LED1_PIN_INVERSE 0
  128. #define ENABLE_HLW8012 1
  129. #elif defined(SONOFF_DUAL)
  130. #define MANUFACTURER "ITEAD"
  131. #define DEVICE "SONOFF_DUAL"
  132. #define BUTTON3_RELAY 1
  133. #define LED1_PIN 13
  134. #define LED1_PIN_INVERSE 1
  135. #undef SERIAL_BAUDRATE
  136. #define SERIAL_BAUDRATE 19230
  137. #undef RELAY_PROVIDER
  138. #define RELAY_PROVIDER RELAY_PROVIDER_DUAL
  139. #define DUMMY_RELAY_COUNT 2
  140. #elif defined(SONOFF_4CH)
  141. #define MANUFACTURER "ITEAD"
  142. #define DEVICE "SONOFF_4CH"
  143. #define BUTTON1_PIN 0
  144. #define BUTTON1_RELAY 1
  145. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  146. #define BUTTON2_PIN 9
  147. #define BUTTON2_RELAY 2
  148. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  149. #define BUTTON3_PIN 10
  150. #define BUTTON3_RELAY 3
  151. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  152. #define BUTTON4_PIN 14
  153. #define BUTTON4_RELAY 4
  154. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  155. #define RELAY1_PIN 12
  156. #define RELAY1_PIN_INVERSE 0
  157. #define RELAY2_PIN 5
  158. #define RELAY2_PIN_INVERSE 0
  159. #define RELAY3_PIN 4
  160. #define RELAY3_PIN_INVERSE 0
  161. #define RELAY4_PIN 15
  162. #define RELAY4_PIN_INVERSE 0
  163. #define LED1_PIN 13
  164. #define LED1_PIN_INVERSE 1
  165. #elif defined(SONOFF_4CH_PRO)
  166. #define MANUFACTURER "ITEAD"
  167. #define DEVICE "SONOFF_4CH_PRO"
  168. #define BUTTON1_PIN 0
  169. #define BUTTON1_RELAY 1
  170. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  171. #define BUTTON2_PIN 9
  172. #define BUTTON2_RELAY 2
  173. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  174. #define BUTTON3_PIN 10
  175. #define BUTTON3_RELAY 3
  176. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  177. #define BUTTON4_PIN 14
  178. #define BUTTON4_RELAY 4
  179. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  180. #define RELAY1_PIN 12
  181. #define RELAY1_PIN_INVERSE 0
  182. #define RELAY2_PIN 5
  183. #define RELAY2_PIN_INVERSE 0
  184. #define RELAY3_PIN 4
  185. #define RELAY3_PIN_INVERSE 0
  186. #define RELAY4_PIN 15
  187. #define RELAY4_PIN_INVERSE 0
  188. #define LED1_PIN 13
  189. #define LED1_PIN_INVERSE 1
  190. #elif defined(ITEAD_1CH_INCHING)
  191. // The inching functionality is managed by a misterious IC in the board.
  192. // You cannot control the inching button and functionality from the ESP8266
  193. // Besides, enabling the inching functionality using the hardware button
  194. // will result in the relay switching on and off continuously.
  195. // Fortunately the unkown IC keeps memory of the hardware inching status
  196. // so you can just disable it and forget. The inching LED must be lit.
  197. // You can still use the pulse options from the web interface
  198. // without problem.
  199. #define MANUFACTURER "ITEAD"
  200. #define DEVICE "1CH_INCHING"
  201. #define BUTTON1_PIN 0
  202. #define BUTTON1_RELAY 1
  203. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  204. #define RELAY1_PIN 12
  205. #define RELAY1_PIN_INVERSE 0
  206. #define LED1_PIN 13
  207. #define LED1_PIN_INVERSE 1
  208. #elif defined(ITEAD_MOTOR)
  209. #define MANUFACTURER "ITEAD"
  210. #define DEVICE "MOTOR"
  211. #define BUTTON1_PIN 0
  212. #define BUTTON1_RELAY 1
  213. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  214. #define RELAY1_PIN 12
  215. #define RELAY1_PIN_INVERSE 0
  216. #define LED1_PIN 13
  217. #define LED1_PIN_INVERSE 1
  218. #elif defined(ITEAD_BNSZ01)
  219. #define MANUFACTURER "ITEAD"
  220. #define DEVICE "BN-SZ01"
  221. #define LED1_PIN 13
  222. #define LED1_PIN_INVERSE 1
  223. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  224. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  225. #define DUMMY_RELAY_COUNT 1
  226. #define LIGHT_CH1_PIN 12
  227. #define LIGHT_CH1_INVERSE 0
  228. #elif defined(SONOFF_RFBRIDGE)
  229. #define MANUFACTURER "ITEAD"
  230. #define DEVICE "RFBRIDGE"
  231. #define BUTTON1_PIN 0
  232. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  233. #define LED1_PIN 13
  234. #define LED1_PIN_INVERSE 1
  235. #undef SERIAL_BAUDRATE
  236. #define SERIAL_BAUDRATE 19200
  237. #undef RELAY_PROVIDER
  238. #define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE
  239. #define DUMMY_RELAY_COUNT 6
  240. #define TRACK_RELAY_STATUS 0
  241. #elif defined(SONOFF_B1)
  242. #define MANUFACTURER "ITEAD"
  243. #define DEVICE "SONOFF_B1"
  244. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  245. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
  246. #define DUMMY_RELAY_COUNT 1
  247. #define MY9291_DI_PIN 13
  248. #define MY9291_DCKI_PIN 15
  249. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  250. #elif defined(SONOFF_LED)
  251. #define MANUFACTURER "ITEAD"
  252. #define DEVICE "SONOFF_LED"
  253. #define LED1_PIN 13
  254. #define LED1_PIN_INVERSE 1
  255. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  256. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  257. #define DUMMY_RELAY_COUNT 1
  258. #define LIGHT_CH1_PIN 12 // Cold white
  259. #define LIGHT_CH2_PIN 14 // Warm white
  260. #define LIGHT_CH1_INVERSE 0
  261. #define LIGHT_CH2_INVERSE 0
  262. #elif defined(SONOFF_T1_1CH)
  263. #define MANUFACTURER "ITEAD"
  264. #define DEVICE "SONOFF_T1_1CH"
  265. #define BUTTON1_PIN 9
  266. #define BUTTON1_RELAY 1
  267. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  268. #define RELAY1_PIN 5
  269. #define RELAY1_PIN_INVERSE 0
  270. #define LED1_PIN 13
  271. #define LED1_PIN_INVERSE 1
  272. #elif defined(SONOFF_T1_2CH)
  273. #define MANUFACTURER "ITEAD"
  274. #define DEVICE "SONOFF_T1_2CH"
  275. #define BUTTON1_PIN 0
  276. #define BUTTON1_RELAY 1
  277. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  278. #define BUTTON2_PIN 10
  279. #define BUTTON2_RELAY 2
  280. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  281. #define RELAY1_PIN 12
  282. #define RELAY1_PIN_INVERSE 0
  283. #define RELAY2_PIN 4
  284. #define RELAY2_PIN_INVERSE 0
  285. #define LED1_PIN 13
  286. #define LED1_PIN_INVERSE 1
  287. #elif defined(SONOFF_T1_3CH)
  288. #define MANUFACTURER "ITEAD"
  289. #define DEVICE "SONOFF_T1_3CH"
  290. #define BUTTON1_PIN 0
  291. #define BUTTON1_RELAY 1
  292. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  293. #define BUTTON2_PIN 9
  294. #define BUTTON2_RELAY 2
  295. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  296. #define BUTTON3_PIN 10
  297. #define BUTTON3_RELAY 3
  298. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  299. #define RELAY1_PIN 12
  300. #define RELAY1_PIN_INVERSE 0
  301. #define RELAY2_PIN 5
  302. #define RELAY2_PIN_INVERSE 0
  303. #define RELAY3_PIN 4
  304. #define RELAY3_PIN_INVERSE 0
  305. #define LED1_PIN 13
  306. #define LED1_PIN_INVERSE 1
  307. // -----------------------------------------------------------------------------
  308. // Electrodragon boards
  309. // -----------------------------------------------------------------------------
  310. #elif defined(ESP_RELAY_BOARD)
  311. #define MANUFACTURER "ELECTRODRAGON"
  312. #define DEVICE "ESP_RELAY_BOARD"
  313. #define BUTTON1_PIN 0
  314. #define BUTTON1_RELAY 1
  315. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  316. #define BUTTON2_PIN 2
  317. #define BUTTON2_RELAY 2
  318. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  319. #define RELAY1_PIN 12
  320. #define RELAY1_PIN_INVERSE 0
  321. #define RELAY2_PIN 13
  322. #define RELAY2_PIN_INVERSE 0
  323. #define LED1_PIN 16
  324. #define LED1_PIN_INVERSE 0
  325. // -----------------------------------------------------------------------------
  326. // WorkChoice ecoPlug
  327. // -----------------------------------------------------------------------------
  328. #elif defined(ECOPLUG)
  329. #define MANUFACTURER "WORKCHOICE"
  330. #define DEVICE "ECOPLUG"
  331. #define BUTTON1_PIN 13
  332. #define BUTTON1_RELAY 1
  333. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  334. #define RELAY1_PIN 15
  335. #define RELAY1_PIN_INVERSE 0
  336. #define LED1_PIN 2
  337. #define LED1_PIN_INVERSE 0
  338. // -----------------------------------------------------------------------------
  339. // AI Thinker
  340. // -----------------------------------------------------------------------------
  341. #elif defined(AI_LIGHT)
  342. #define MANUFACTURER "AI_THINKER"
  343. #define DEVICE "AI_LIGHT"
  344. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  345. #define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
  346. #define DUMMY_RELAY_COUNT 1
  347. #define MY9291_DI_PIN 13
  348. #define MY9291_DCKI_PIN 15
  349. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  350. // -----------------------------------------------------------------------------
  351. // LED Controller
  352. // -----------------------------------------------------------------------------
  353. #elif defined(LED_CONTROLLER)
  354. #define MANUFACTURER "MAGIC_HOME"
  355. #define DEVICE "LED_CONTROLLER"
  356. #define LED1_PIN 2
  357. #define LED1_PIN_INVERSE 1
  358. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  359. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  360. #define DUMMY_RELAY_COUNT 1
  361. #define LIGHT_CH1_PIN 14 // RED
  362. #define LIGHT_CH2_PIN 5 // GREEN
  363. #define LIGHT_CH3_PIN 12 // BLUE
  364. #define LIGHT_CH4_PIN 13 // WHITE
  365. #define LIGHT_CH1_INVERSE 0
  366. #define LIGHT_CH2_INVERSE 0
  367. #define LIGHT_CH3_INVERSE 0
  368. #define LIGHT_CH4_INVERSE 0
  369. // -----------------------------------------------------------------------------
  370. // HUACANXING H801
  371. // -----------------------------------------------------------------------------
  372. #elif defined(H801_LED_CONTROLLER)
  373. #define MANUFACTURER "HUACANXING"
  374. #define DEVICE "H801"
  375. #define LED1_PIN 5
  376. #define LED1_PIN_INVERSE 1
  377. #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
  378. #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
  379. #define DUMMY_RELAY_COUNT 1
  380. #define LIGHT_CH1_PIN 15 // RED
  381. #define LIGHT_CH2_PIN 13 // GREEN
  382. #define LIGHT_CH3_PIN 12 // BLUE
  383. #define LIGHT_CH4_PIN 14 // WHITE1
  384. #define LIGHT_CH5_PIN 4 // WHITE2
  385. #define LIGHT_CH1_INVERSE 0
  386. #define LIGHT_CH2_INVERSE 0
  387. #define LIGHT_CH3_INVERSE 0
  388. #define LIGHT_CH4_INVERSE 0
  389. #define LIGHT_CH5_INVERSE 0
  390. // -----------------------------------------------------------------------------
  391. // Jan Goedeke Wifi Relay
  392. // https://github.com/JanGoe/esp8266-wifi-relay
  393. // -----------------------------------------------------------------------------
  394. #elif defined(WIFI_RELAY_NC)
  395. #define MANUFACTURER "JAN_GOEDEKE"
  396. #define DEVICE "WIFI_RELAY_NC"
  397. #define BUTTON1_PIN 12
  398. #define BUTTON1_RELAY 1
  399. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  400. #define BUTTON2_PIN 13
  401. #define BUTTON2_RELAY 2
  402. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  403. #define RELAY1_PIN 2
  404. #define RELAY1_PIN_INVERSE 1
  405. #define RELAY2_PIN 14
  406. #define RELAY2_PIN_INVERSE 1
  407. #elif defined(WIFI_RELAY_NO)
  408. #define MANUFACTURER "JAN_GOEDEKE"
  409. #define DEVICE "WIFI_RELAY_NO"
  410. #define BUTTON1_PIN 12
  411. #define BUTTON1_RELAY 1
  412. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  413. #define BUTTON2_PIN 13
  414. #define BUTTON2_RELAY 2
  415. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  416. #define RELAY1_PIN 2
  417. #define RELAY1_PIN_INVERSE 0
  418. #define RELAY2_PIN 14
  419. #define RELAY2_PIN_INVERSE 0
  420. // -----------------------------------------------------------------------------
  421. // Jorge García Wifi+Relays Board Kit
  422. // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
  423. // https://github.com/jorgegarciadev/wifikit
  424. // -----------------------------------------------------------------------------
  425. #elif defined(WIFI_RELAYS_BOARD_KIT)
  426. #define MANUFACTURER "JORGE_GARCIA"
  427. #define DEVICE "WIFI_RELAYS_BOARD_KIT"
  428. #define RELAY1_PIN 0
  429. #define RELAY1_PIN_INVERSE 1
  430. #define RELAY2_PIN 2
  431. #define RELAY2_PIN_INVERSE 1
  432. // -----------------------------------------------------------------------------
  433. // WiFi MQTT Relay / Thermostat
  434. // -----------------------------------------------------------------------------
  435. #elif defined(MQTT_RELAY)
  436. #define MANUFACTURER "OPENENERGYMONITOR"
  437. #define DEVICE "MQTT_RELAY"
  438. #define BUTTON1_PIN 0
  439. #define BUTTON1_RELAY 1
  440. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  441. #define RELAY1_PIN 12
  442. #define RELAY1_PIN_INVERSE 0
  443. #define LED1_PIN 16
  444. #define LED1_PIN_INVERSE 0
  445. // -----------------------------------------------------------------------------
  446. // Unknown hardware
  447. // -----------------------------------------------------------------------------
  448. #else
  449. #error "UNSUPPORTED HARDWARE!"
  450. #endif
  451. // -----------------------------------------------------------------------------
  452. // Default values
  453. // -----------------------------------------------------------------------------
  454. #ifndef BUTTON1_PRESS
  455. #define BUTTON1_PRESS BUTTON_MODE_NONE
  456. #endif
  457. #ifndef BUTTON2_PRESS
  458. #define BUTTON2_PRESS BUTTON_MODE_NONE
  459. #endif
  460. #ifndef BUTTON3_PRESS
  461. #define BUTTON3_PRESS BUTTON_MODE_NONE
  462. #endif
  463. #ifndef BUTTON4_PRESS
  464. #define BUTTON4_PRESS BUTTON_MODE_NONE
  465. #endif
  466. #ifndef BUTTON1_CLICK
  467. #define BUTTON1_CLICK BUTTON_MODE_TOGGLE
  468. #endif
  469. #ifndef BUTTON2_CLICK
  470. #define BUTTON2_CLICK BUTTON_MODE_TOGGLE
  471. #endif
  472. #ifndef BUTTON3_CLICK
  473. #define BUTTON3_CLICK BUTTON_MODE_TOGGLE
  474. #endif
  475. #ifndef BUTTON4_CLICK
  476. #define BUTTON4_CLICK BUTTON_MODE_TOGGLE
  477. #endif
  478. #ifndef BUTTON1_DBLCLICK
  479. #define BUTTON1_DBLCLICK BUTTON_MODE_AP
  480. #endif
  481. #ifndef BUTTON2_DBLCLICK
  482. #define BUTTON2_DBLCLICK BUTTON_MODE_NONE
  483. #endif
  484. #ifndef BUTTON3_DBLCLICK
  485. #define BUTTON3_DBLCLICK BUTTON_MODE_NONE
  486. #endif
  487. #ifndef BUTTON4_DBLCLICK
  488. #define BUTTON4_DBLCLICK BUTTON_MODE_NONE
  489. #endif
  490. #ifndef BUTTON1_LNGCLICK
  491. #define BUTTON1_LNGCLICK BUTTON_MODE_RESET
  492. #endif
  493. #ifndef BUTTON2_LNGCLICK
  494. #define BUTTON2_LNGCLICK BUTTON_MODE_NONE
  495. #endif
  496. #ifndef BUTTON3_LNGCLICK
  497. #define BUTTON3_LNGCLICK BUTTON_MODE_NONE
  498. #endif
  499. #ifndef BUTTON4_LNGCLICK
  500. #define BUTTON4_LNGCLICK BUTTON_MODE_NONE
  501. #endif
  502. #ifndef BUTTON1_LNGLNGCLICK
  503. #define BUTTON1_LNGLNGCLICK BUTTON_MODE_FACTORY
  504. #endif
  505. #ifndef BUTTON2_LNGLNGCLICK
  506. #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
  507. #endif
  508. #ifndef BUTTON3_LNGLNGCLICK
  509. #define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE
  510. #endif
  511. #ifndef BUTTON4_LNGLNGCLICK
  512. #define BUTTON4_LNGLNGCLICK BUTTON_MODE_NONE
  513. #endif
  514. #ifndef BUTTON1_RELAY
  515. #define BUTTON1_RELAY 0
  516. #endif
  517. #ifndef BUTTON2_RELAY
  518. #define BUTTON2_RELAY 0
  519. #endif
  520. #ifndef BUTTON3_RELAY
  521. #define BUTTON3_RELAY 0
  522. #endif
  523. #ifndef BUTTON4_RELAY
  524. #define BUTTON4_RELAY 0
  525. #endif
  526. #ifndef RELAY1_DELAY_ON
  527. #define RELAY1_DELAY_ON 0
  528. #endif
  529. #ifndef RELAY2_DELAY_ON
  530. #define RELAY2_DELAY_ON 0
  531. #endif
  532. #ifndef RELAY3_DELAY_ON
  533. #define RELAY3_DELAY_ON 0
  534. #endif
  535. #ifndef RELAY4_DELAY_ON
  536. #define RELAY4_DELAY_ON 0
  537. #endif
  538. #ifndef RELAY1_DELAY_OFF
  539. #define RELAY1_DELAY_OFF 0
  540. #endif
  541. #ifndef RELAY2_DELAY_OFF
  542. #define RELAY2_DELAY_OFF 0
  543. #endif
  544. #ifndef RELAY3_DELAY_OFF
  545. #define RELAY3_DELAY_OFF 0
  546. #endif
  547. #ifndef RELAY4_DELAY_OFF
  548. #define RELAY4_DELAY_OFF 0
  549. #endif
  550. #ifndef RELAY1_LED
  551. #define RELAY1_LED 0
  552. #endif
  553. #ifndef RELAY2_LED
  554. #define RELAY2_LED 0
  555. #endif
  556. #ifndef RELAY3_LED
  557. #define RELAY3_LED 0
  558. #endif
  559. #ifndef RELAY4_LED
  560. #define RELAY4_LED 0
  561. #endif
  562. #ifndef WIFI_LED
  563. #define WIFI_LED 1
  564. #endif
  565. // Needed for ESP8285 boards under Windows using PlatformIO (?)
  566. #ifndef BUTTON_PUSHBUTTON
  567. #define BUTTON_PUSHBUTTON 0
  568. #define BUTTON_SWITCH 1
  569. #define BUTTON_DEFAULT_HIGH 2
  570. #define BUTTON_SET_PULLUP 4
  571. #endif
  572. // Does the board track the relay status?
  573. #ifndef TRACK_RELAY_STATUS
  574. #define TRACK_RELAY_STATUS 1
  575. #endif
  576. // Relay providers
  577. #ifndef RELAY_PROVIDER
  578. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  579. #endif
  580. // Light provider
  581. #ifndef LIGHT_PROVIDER
  582. #define LIGHT_PROVIDER LIGHT_PROVIDER_NONE
  583. #endif