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.

283 lines
9.4 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
8 years ago
8 years ago
  1. //------------------------------------------------------------------------------
  2. // GENERAL
  3. //------------------------------------------------------------------------------
  4. #define SERIAL_BAUDRATE 115200
  5. #define HOSTNAME DEVICE
  6. #define BUFFER_SIZE 1024
  7. #define HEARTBEAT_INTERVAL 300000
  8. #define UPTIME_OVERFLOW 4294967295
  9. //--------------------------------------------------------------------------------
  10. // DEBUG
  11. //--------------------------------------------------------------------------------
  12. #ifndef DEBUG_PORT
  13. #define DEBUG_PORT Serial
  14. #endif
  15. // Uncomment and configure these lines to enable remote debug via udpDebug
  16. // To receive the message son the destination computer use nc:
  17. // nc -ul 8111
  18. //#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
  19. //#define DEBUG_UDP_PORT 8111
  20. //--------------------------------------------------------------------------------
  21. // EEPROM
  22. //--------------------------------------------------------------------------------
  23. #define EEPROM_RELAY_STATUS 0
  24. #define EEPROM_ENERGY_COUNT 1
  25. #define EEPROM_DATA_END 5
  26. //--------------------------------------------------------------------------------
  27. // BUTTON
  28. //--------------------------------------------------------------------------------
  29. #define BUTTON_LNGCLICK_LENGTH 1000
  30. #define BUTTON_LNGLNGCLICK_LENGTH 10000
  31. #define BUTTON_EVENT_NONE 0
  32. #define BUTTON_EVENT_PRESSED 1
  33. #define BUTTON_EVENT_CLICK 2
  34. #define BUTTON_EVENT_DBLCLICK 3
  35. #define BUTTON_EVENT_LNGCLICK 4
  36. #define BUTTON_EVENT_LNGLNGCLICK 5
  37. #define BUTTON_MODE_NONE 0
  38. #define BUTTON_MODE_TOGGLE 1
  39. #define BUTTON_MODE_AP 2
  40. #define BUTTON_MODE_RESET 3
  41. #define BUTTON_MODE_PULSE 4
  42. #define BUTTON_MODE_FACTORY 5
  43. #define BUTTON_DEFAULT_MODE BUTTON_MODE_TOGGLE
  44. //--------------------------------------------------------------------------------
  45. // RELAY
  46. //--------------------------------------------------------------------------------
  47. #define RELAY_MODE_OFF 0
  48. #define RELAY_MODE_ON 1
  49. #define RELAY_MODE_SAME 2
  50. #define RELAY_MODE_TOOGLE 3
  51. #define RELAY_MODE_FOLLOW 4
  52. #define RELAY_SYNC_ANY 0
  53. #define RELAY_SYNC_NONE_OR_ONE 1
  54. #define RELAY_SYNC_ONE 2
  55. #define RELAY_SYNC_SAME 3
  56. #define RELAY_PULSE_NONE 0
  57. #define RELAY_PULSE_OFF 1
  58. #define RELAY_PULSE_ON 2
  59. #define RELAY_PROVIDER_RELAY 0
  60. #define RELAY_PROVIDER_DUAL 1
  61. #define RELAY_PROVIDER_LIGHT 2
  62. // Pulse time in seconds
  63. #define RELAY_PULSE_TIME 1
  64. // 0 means OFF, 1 ON and 2 whatever was before
  65. #define RELAY_MODE RELAY_MODE_OFF
  66. // 0 means ANY, 1 zero or one and 2 one and only one
  67. #define RELAY_SYNC RELAY_SYNC_ANY
  68. // 0 means no pulses, 1 means normally off, 2 normally on
  69. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  70. // Relay requests flood protection window - in seconds
  71. #define RELAY_FLOOD_WINDOW 3
  72. // Allowed actual relay changes inside requests flood protection window
  73. #define RELAY_FLOOD_CHANGES 5
  74. //--------------------------------------------------------------------------------
  75. // I18N
  76. //--------------------------------------------------------------------------------
  77. #define TMP_CELSIUS 0
  78. #define TMP_FAHRENHEIT 1
  79. #define TMP_UNITS TMP_CELSIUS
  80. //--------------------------------------------------------------------------------
  81. // LED
  82. //--------------------------------------------------------------------------------
  83. // All defined LEDs in the board can be managed through MQTT
  84. // except the first one when LED_AUTO is set to 1.
  85. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  86. #define LED_AUTO 1
  87. // -----------------------------------------------------------------------------
  88. // WIFI & WEB
  89. // -----------------------------------------------------------------------------
  90. #define WIFI_RECONNECT_INTERVAL 120000
  91. #define WIFI_MAX_NETWORKS 5
  92. #define ADMIN_PASS "fibonacci"
  93. #define FORCE_CHANGE_PASS 1
  94. #define HTTP_USERNAME "admin"
  95. #define WS_BUFFER_SIZE 5
  96. #define WS_TIMEOUT 1800000
  97. #define WEBSERVER_PORT 80
  98. #define DNS_PORT 53
  99. #define ENABLE_MDNS 1
  100. #define WEB_MODE_NORMAL 0
  101. #define WEB_MODE_PASSWORD 1
  102. #define AP_MODE AP_MODE_ALONE
  103. // This option builds the firmware with the web interface embedded.
  104. // You first have to build the data.h file that holds the contents
  105. // of the web interface by running "gulp buildfs_embed"
  106. #ifndef EMBEDDED_WEB
  107. #define EMBEDDED_WEB 1
  108. #endif
  109. // -----------------------------------------------------------------------------
  110. // OTA & NOFUSS
  111. // -----------------------------------------------------------------------------
  112. #define OTA_PORT 8266
  113. #define NOFUSS_SERVER ""
  114. #define NOFUSS_INTERVAL 3600000
  115. // -----------------------------------------------------------------------------
  116. // MQTT
  117. // -----------------------------------------------------------------------------
  118. #ifndef MQTT_USE_ASYNC
  119. #define MQTT_USE_ASYNC 1
  120. #endif
  121. #define MQTT_SERVER ""
  122. #define MQTT_PORT 1883
  123. #define MQTT_TOPIC "/test/switch/{identifier}"
  124. #define MQTT_RETAIN true
  125. #define MQTT_QOS 0
  126. #define MQTT_KEEPALIVE 30
  127. #define MQTT_RECONNECT_DELAY 10000
  128. #define MQTT_TRY_INTERVAL 30000
  129. #define MQTT_MAX_TRIES 12
  130. #define MQTT_SKIP_RETAINED 1
  131. #define MQTT_SKIP_TIME 1000
  132. #define MQTT_TOPIC_ACTION "action"
  133. #define MQTT_TOPIC_RELAY "relay"
  134. #define MQTT_TOPIC_LED "led"
  135. #define MQTT_TOPIC_COLOR "color"
  136. #define MQTT_TOPIC_BUTTON "button"
  137. #define MQTT_TOPIC_IP "ip"
  138. #define MQTT_TOPIC_VERSION "version"
  139. #define MQTT_TOPIC_UPTIME "uptime"
  140. #define MQTT_TOPIC_FREEHEAP "freeheap"
  141. #define MQTT_TOPIC_VCC "vcc"
  142. #define MQTT_TOPIC_STATUS "status"
  143. #define MQTT_TOPIC_MAC "mac"
  144. #define MQTT_TOPIC_RSSI "rssi"
  145. #define MQTT_TOPIC_APP "app"
  146. #define MQTT_TOPIC_INTERVAL "interval"
  147. #define MQTT_TOPIC_HOSTNAME "hostname"
  148. // Periodic reports
  149. #define MQTT_REPORT_STATUS 1
  150. #define MQTT_REPORT_IP 1
  151. #define MQTT_REPORT_MAC 1
  152. #define MQTT_REPORT_RSSI 1
  153. #define MQTT_REPORT_UPTIME 1
  154. #define MQTT_REPORT_FREEHEAP 1
  155. #define MQTT_REPORT_VCC 1
  156. #define MQTT_REPORT_RELAY 1
  157. #define MQTT_REPORT_COLOR 1
  158. #define MQTT_REPORT_HOSTNAME 1
  159. #define MQTT_REPORT_APP 1
  160. #define MQTT_REPORT_VERSION 1
  161. #define MQTT_REPORT_INTERVAL 0
  162. #define MQTT_STATUS_ONLINE "1"
  163. #define MQTT_STATUS_OFFLINE "0"
  164. #define MQTT_ACTION_RESET "reset"
  165. #define MQTT_CONNECT_EVENT 0
  166. #define MQTT_DISCONNECT_EVENT 1
  167. #define MQTT_MESSAGE_EVENT 2
  168. // Custom get and set postfixes
  169. // Use something like "/status" or "/set", with leading slash
  170. #define MQTT_USE_GETTER ""
  171. #define MQTT_USE_SETTER ""
  172. // -----------------------------------------------------------------------------
  173. // I2C
  174. // -----------------------------------------------------------------------------
  175. #define ENABLE_I2C 0
  176. #define I2C_SDA_PIN 4
  177. #define I2C_SCL_PIN 14
  178. #define I2C_CLOCK_STRETCH_TIME 200
  179. #define I2C_SCL_FREQUENCY 1000
  180. // -----------------------------------------------------------------------------
  181. // LIGHT
  182. // -----------------------------------------------------------------------------
  183. #define LIGHT_PROVIDER_NONE 0
  184. #define LIGHT_PROVIDER_WS2812 1
  185. #define LIGHT_PROVIDER_RGB 2
  186. #define LIGHT_PROVIDER_RGBW 3
  187. #define LIGHT_PROVIDER_MY9192 4
  188. #define LIGHT_DEFAULT_COLOR "#000080"
  189. #define LIGHT_SAVE_DELAY 5
  190. #define LIGHT_MAX_VALUE 255
  191. #define MY9291_DI_PIN 13
  192. #define MY9291_DCKI_PIN 15
  193. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  194. // Shared settings between RGB and RGBW lights
  195. #define RGBW_INVERSE_LOGIC 1
  196. #define RGBW_RED_PIN 14
  197. #define RGBW_GREEN_PIN 5
  198. #define RGBW_BLUE_PIN 12
  199. #define RGBW_WHITE_PIN 13
  200. // -----------------------------------------------------------------------------
  201. // DOMOTICZ
  202. // -----------------------------------------------------------------------------
  203. #ifndef ENABLE_DOMOTICZ
  204. #define ENABLE_DOMOTICZ 1
  205. #endif
  206. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  207. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  208. // -----------------------------------------------------------------------------
  209. // NTP
  210. // -----------------------------------------------------------------------------
  211. #define NTP_SERVER "pool.ntp.org"
  212. #define NTP_TIME_OFFSET 1
  213. #define NTP_DAY_LIGHT true
  214. #define NTP_UPDATE_INTERVAL 1800
  215. // -----------------------------------------------------------------------------
  216. // FAUXMO
  217. // -----------------------------------------------------------------------------
  218. // This setting defines whether Alexa support should be built into the firmware
  219. #ifndef ENABLE_FAUXMO
  220. #define ENABLE_FAUXMO 1
  221. #endif
  222. // This is default value for the fauxmoEnabled setting that defines whether
  223. // this device should be discoberable and respond to Alexa commands.
  224. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  225. #define FAUXMO_ENABLED 1