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.

300 lines
11 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. // LED#_PIN: GPIO for the n-th LED (1-based, up to 4 LEDs)
  17. // LED#_PIN_INVERSE: LED has inversed logic (lit when pulled down)
  18. // -----------------------------------------------------------------------------
  19. // Development boards
  20. // -----------------------------------------------------------------------------
  21. #if defined(NODEMCUV2)
  22. #define MANUFACTURER "NODEMCU"
  23. #define DEVICE "LOLIN"
  24. #define BUTTON1_PIN 0
  25. #define BUTTON1_RELAY 1
  26. #define BUTTON1_MODE BUTTON_SWITCH | BUTTON_DEFAULT_HIGH
  27. #define RELAY1_PIN 12
  28. #define RELAY1_PIN_INVERSE 0
  29. #define LED1_PIN 2
  30. #define LED1_PIN_INVERSE 1
  31. #elif defined(D1_RELAYSHIELD)
  32. #define MANUFACTURER "WEMOS"
  33. #define DEVICE "D1_MINI"
  34. #define RELAY1_PIN 5
  35. #define RELAY1_PIN_INVERSE 0
  36. #define LED1_PIN 2
  37. #define LED1_PIN_INVERSE 1
  38. // -----------------------------------------------------------------------------
  39. // Itead Studio boards
  40. // -----------------------------------------------------------------------------
  41. #elif defined(SONOFF)
  42. #define MANUFACTURER "ITEAD"
  43. #define DEVICE "SONOFF"
  44. #define BUTTON1_PIN 0
  45. #define BUTTON1_RELAY 1
  46. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  47. #define RELAY1_PIN 12
  48. #define RELAY1_PIN_INVERSE 0
  49. #define LED1_PIN 13
  50. #define LED1_PIN_INVERSE 1
  51. #elif defined(SONOFF_TH)
  52. #define MANUFACTURER "ITEAD"
  53. #define DEVICE "SONOFF_TH"
  54. #define BUTTON1_PIN 0
  55. #define BUTTON1_RELAY 1
  56. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  57. #define RELAY1_PIN 12
  58. #define RELAY1_PIN_INVERSE 0
  59. #define LED1_PIN 13
  60. #define LED1_PIN_INVERSE 1
  61. #elif defined(SONOFF_SV)
  62. #define MANUFACTURER "ITEAD"
  63. #define DEVICE "SONOFF_SV"
  64. #define BUTTON1_PIN 0
  65. #define BUTTON1_RELAY 1
  66. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  67. #define RELAY1_PIN 12
  68. #define RELAY1_PIN_INVERSE 0
  69. #define LED1_PIN 13
  70. #define LED1_PIN_INVERSE 1
  71. #elif defined(SLAMPHER)
  72. #define MANUFACTURER "ITEAD"
  73. #define DEVICE "SLAMPHER"
  74. #define BUTTON1_PIN 0
  75. #define BUTTON1_RELAY 1
  76. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  77. #define RELAY1_PIN 12
  78. #define RELAY1_PIN_INVERSE 0
  79. #define LED1_PIN 13
  80. #define LED1_PIN_INVERSE 1
  81. #elif defined(S20)
  82. #define MANUFACTURER "ITEAD"
  83. #define DEVICE "S20"
  84. #define BUTTON1_PIN 0
  85. #define BUTTON1_RELAY 1
  86. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  87. #define RELAY1_PIN 12
  88. #define RELAY1_PIN_INVERSE 0
  89. #define LED1_PIN 13
  90. #define LED1_PIN_INVERSE 1
  91. #elif defined(SONOFF_TOUCH)
  92. #define MANUFACTURER "ITEAD"
  93. #define DEVICE "SONOFF_TOUCH"
  94. #define BUTTON1_PIN 0
  95. #define BUTTON1_RELAY 1
  96. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  97. #define RELAY1_PIN 12
  98. #define RELAY1_PIN_INVERSE 0
  99. #define LED1_PIN 13
  100. #define LED1_PIN_INVERSE 1
  101. #elif defined(SONOFF_POW)
  102. #define MANUFACTURER "ITEAD"
  103. #define DEVICE "SONOFF_POW"
  104. #define BUTTON1_PIN 0
  105. #define BUTTON1_RELAY 1
  106. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  107. #define RELAY1_PIN 12
  108. #define RELAY1_PIN_INVERSE 0
  109. #define LED1_PIN 15
  110. #define LED1_PIN_INVERSE 0
  111. #define ENABLE_POW 1
  112. #elif defined(SONOFF_DUAL)
  113. #define MANUFACTURER "ITEAD"
  114. #define DEVICE "SONOFF_DUAL"
  115. #define BUTTON1_PIN 0
  116. #define LED1_PIN 13
  117. #define LED1_PIN_INVERSE 1
  118. #undef SERIAL_BAUDRATE
  119. #define SERIAL_BAUDRATE 19230
  120. #elif defined(SONOFF_4CH)
  121. #define MANUFACTURER "ITEAD"
  122. #define DEVICE "SONOFF_4CH"
  123. #define BUTTON1_PIN 0
  124. #define BUTTON1_RELAY 1
  125. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  126. #define BUTTON2_PIN 9
  127. #define BUTTON2_RELAY 2
  128. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  129. #define BUTTON3_PIN 10
  130. #define BUTTON3_RELAY 3
  131. #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  132. #define BUTTON4_PIN 14
  133. #define BUTTON4_RELAY 4
  134. #define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  135. #define RELAY1_PIN 12
  136. #define RELAY1_PIN_INVERSE 0
  137. #define RELAY2_PIN 5
  138. #define RELAY2_PIN_INVERSE 0
  139. #define RELAY3_PIN 4
  140. #define RELAY3_PIN_INVERSE 0
  141. #define RELAY4_PIN 15
  142. #define RELAY4_PIN_INVERSE 0
  143. #define LED1_PIN 13
  144. #define LED1_PIN_INVERSE 1
  145. #elif defined(ITEAD_1CH_INCHING)
  146. // Note: definitions for this board are based on third party data
  147. // and have not been fully tested yet. If you have the chance to
  148. // test them, please report back. Thank you.
  149. #define MANUFACTURER "ITEAD"
  150. #define DEVICE "1CH_INCHING"
  151. #define BUTTON1_PIN 0
  152. #define BUTTON1_RELAY 1
  153. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  154. #define BUTTON2_PIN 15
  155. #define BUTTON2_RELAY 0
  156. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  157. #define RELAY1_PIN 12
  158. #define RELAY1_PIN_INVERSE 0
  159. #define LED1_PIN 13
  160. #define LED1_PIN_INVERSE 0
  161. // Special LED that shows pulse mode status
  162. #define LED_PULSE 14
  163. // -----------------------------------------------------------------------------
  164. // Electrodragon boards
  165. // -----------------------------------------------------------------------------
  166. #elif defined(ESP_RELAY_BOARD)
  167. #define MANUFACTURER "ELECTRODRAGON"
  168. #define DEVICE "ESP_RELAY_BOARD"
  169. #define BUTTON1_PIN 0
  170. #define BUTTON1_RELAY 1
  171. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  172. #define BUTTON2_PIN 2
  173. #define BUTTON2_RELAY 2
  174. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  175. #define RELAY1_PIN 12
  176. #define RELAY1_PIN_INVERSE 0
  177. #define RELAY2_PIN 13
  178. #define RELAY2_PIN_INVERSE 0
  179. #define LED1_PIN 16
  180. #define LED1_PIN_INVERSE 0
  181. // -----------------------------------------------------------------------------
  182. // WorkChoice ecoPlug
  183. // -----------------------------------------------------------------------------
  184. #elif defined(ECOPLUG)
  185. #define MANUFACTURER "WORKCHOICE"
  186. #define DEVICE "ECOPLUG"
  187. #define BUTTON1_PIN 13
  188. #define BUTTON1_RELAY 1
  189. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  190. #define RELAY1_PIN 15
  191. #define RELAY1_PIN_INVERSE 0
  192. #define LED1_PIN 2
  193. #define LED1_PIN_INVERSE 0
  194. // -----------------------------------------------------------------------------
  195. // JanGoe Wifi Relay (https://github.com/JanGoe/esp8266-wifi-relay)
  196. // -----------------------------------------------------------------------------
  197. #elif defined(WIFI_RELAY_NC)
  198. #define MANUFACTURER "JANGOE"
  199. #define DEVICE "WIFI_RELAY_NC"
  200. #define BUTTON1_PIN 12
  201. #define BUTTON1_RELAY 1
  202. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  203. #define BUTTON2_PIN 13
  204. #define BUTTON2_RELAY 2
  205. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  206. #define RELAY1_PIN 2
  207. #define RELAY1_PIN_INVERSE 1
  208. #define RELAY2_PIN 14
  209. #define RELAY2_PIN_INVERSE 1
  210. #elif defined(WIFI_RELAY_NO)
  211. #define MANUFACTURER "JANGOE"
  212. #define DEVICE "WIFI_RELAY_NO"
  213. #define BUTTON1_PIN 12
  214. #define BUTTON1_RELAY 1
  215. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  216. #define BUTTON2_PIN 13
  217. #define BUTTON2_RELAY 2
  218. #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  219. #define RELAY1_PIN 2
  220. #define RELAY1_PIN_INVERSE 0
  221. #define RELAY2_PIN 14
  222. #define RELAY2_PIN_INVERSE 0
  223. // -----------------------------------------------------------------------------
  224. // ESPurna board (still beta)
  225. // -----------------------------------------------------------------------------
  226. #elif defined(ESPURNA)
  227. #define MANUFACTURER "TINKERMAN"
  228. #define DEVICE "ESPURNA"
  229. #define BUTTON1_PIN 0
  230. #define BUTTON1_RELAY 1
  231. #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
  232. #define RELAY1_PIN 12
  233. #define RELAY1_PIN_INVERSE 0
  234. #define LED1_PIN 13
  235. #define LED1_PIN_INVERSE 0
  236. // -----------------------------------------------------------------------------
  237. // WiFi MQTT Relay / Thermostat
  238. // -----------------------------------------------------------------------------
  239. #elif defined(MQTT_RELAY)
  240. #define MANUFACTURER "OPENENERGYMONITOR"
  241. #define DEVICE "MQTT_RELAY"
  242. #define BUTTON1_PIN 0
  243. #define BUTTON1_RELAY 1
  244. #define RELAY1_PIN 12
  245. #define RELAY1_PIN_INVERSE 0
  246. #define LED1_PIN 16
  247. #define LED1_PIN_INVERSE 0
  248. // -----------------------------------------------------------------------------
  249. // Unknown hardware
  250. // -----------------------------------------------------------------------------
  251. #else
  252. #error "UNSUPPORTED HARDWARE!"
  253. #endif