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.

295 lines
9.7 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 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_SYNC_ANY 0
  52. #define RELAY_SYNC_NONE_OR_ONE 1
  53. #define RELAY_SYNC_ONE 2
  54. #define RELAY_SYNC_SAME 3
  55. #define RELAY_PULSE_NONE 0
  56. #define RELAY_PULSE_OFF 1
  57. #define RELAY_PULSE_ON 2
  58. #define RELAY_PROVIDER_RELAY 0
  59. #define RELAY_PROVIDER_DUAL 1
  60. #define RELAY_PROVIDER_LIGHT 2
  61. // Pulse time in seconds
  62. #define RELAY_PULSE_TIME 1
  63. // 0 means OFF, 1 ON and 2 whatever was before
  64. #define RELAY_MODE RELAY_MODE_OFF
  65. // 0 means ANY, 1 zero or one and 2 one and only one
  66. #define RELAY_SYNC RELAY_SYNC_ANY
  67. // 0 means no pulses, 1 means normally off, 2 normally on
  68. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  69. // Relay requests flood protection window - in seconds
  70. #define RELAY_FLOOD_WINDOW 3
  71. // Allowed actual relay changes inside requests flood protection window
  72. #define RELAY_FLOOD_CHANGES 5
  73. //--------------------------------------------------------------------------------
  74. // I18N
  75. //--------------------------------------------------------------------------------
  76. #define TMP_CELSIUS 0
  77. #define TMP_FAHRENHEIT 1
  78. #define TMP_UNITS TMP_CELSIUS
  79. //--------------------------------------------------------------------------------
  80. // LED
  81. //--------------------------------------------------------------------------------
  82. // All defined LEDs in the board can be managed through MQTT
  83. // except the first one when LED_AUTO is set to 1.
  84. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  85. #define LED_AUTO 1
  86. // -----------------------------------------------------------------------------
  87. // WIFI & WEB
  88. // -----------------------------------------------------------------------------
  89. #define WIFI_RECONNECT_INTERVAL 120000
  90. #define WIFI_MAX_NETWORKS 5
  91. #define ADMIN_PASS "fibonacci"
  92. #define FORCE_CHANGE_PASS 1
  93. #define HTTP_USERNAME "admin"
  94. #define WS_BUFFER_SIZE 5
  95. #define WS_TIMEOUT 1800000
  96. #define WEBSERVER_PORT 80
  97. #define DNS_PORT 53
  98. #define ENABLE_MDNS 1
  99. #define WEB_MODE_NORMAL 0
  100. #define WEB_MODE_PASSWORD 1
  101. #define AP_MODE AP_MODE_ALONE
  102. // This option builds the firmware with the web interface embedded.
  103. // You first have to build the data.h file that holds the contents
  104. // of the web interface by running "gulp buildfs_embed"
  105. #ifndef EMBEDDED_WEB
  106. #define EMBEDDED_WEB 1
  107. #endif
  108. // -----------------------------------------------------------------------------
  109. // OTA & NOFUSS
  110. // -----------------------------------------------------------------------------
  111. #define OTA_PORT 8266
  112. #define NOFUSS_SERVER ""
  113. #define NOFUSS_INTERVAL 3600000
  114. // -----------------------------------------------------------------------------
  115. // MQTT
  116. // -----------------------------------------------------------------------------
  117. #ifndef MQTT_USE_ASYNC
  118. #define MQTT_USE_ASYNC 1
  119. #endif
  120. #define MQTT_SERVER ""
  121. #define MQTT_PORT 1883
  122. #define MQTT_TOPIC "/test/switch/{identifier}"
  123. #define MQTT_RETAIN true
  124. #define MQTT_QOS 0
  125. #define MQTT_KEEPALIVE 30
  126. #define MQTT_RECONNECT_DELAY 10000
  127. #define MQTT_TRY_INTERVAL 30000
  128. #define MQTT_MAX_TRIES 12
  129. #define MQTT_SKIP_RETAINED 1
  130. #define MQTT_SKIP_TIME 1000
  131. #define MQTT_TOPIC_ACTION "action"
  132. #define MQTT_TOPIC_RELAY "relay"
  133. #define MQTT_TOPIC_LED "led"
  134. #define MQTT_TOPIC_COLOR "color"
  135. #define MQTT_TOPIC_BUTTON "button"
  136. #define MQTT_TOPIC_IP "ip"
  137. #define MQTT_TOPIC_VERSION "version"
  138. #define MQTT_TOPIC_UPTIME "uptime"
  139. #define MQTT_TOPIC_FREEHEAP "freeheap"
  140. #define MQTT_TOPIC_VCC "vcc"
  141. #define MQTT_TOPIC_STATUS "status"
  142. #define MQTT_TOPIC_MAC "mac"
  143. #define MQTT_TOPIC_RSSI "rssi"
  144. #define MQTT_TOPIC_APP "app"
  145. #define MQTT_TOPIC_INTERVAL "interval"
  146. #define MQTT_TOPIC_HOSTNAME "hostname"
  147. #define MQTT_TOPIC_ANALOG "analog"
  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 postfixes6+
  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 ENABLE_GAMMA_CORRECTION 0
  184. #define LIGHT_PROVIDER_NONE 0
  185. #define LIGHT_PROVIDER_WS2812 1
  186. #define LIGHT_PROVIDER_RGB 2
  187. #define LIGHT_PROVIDER_RGBW 3
  188. #define LIGHT_PROVIDER_MY9192 4
  189. #define LIGHT_PROVIDER_RGB2W 5
  190. #define LIGHT_DEFAULT_COLOR "#000080"
  191. #define LIGHT_SAVE_DELAY 5
  192. #define LIGHT_MAX_VALUE 255
  193. #define MY9291_DI_PIN 13
  194. #define MY9291_DCKI_PIN 15
  195. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  196. // Shared settings between RGB and RGBW lights
  197. #define RGBW_INVERSE_LOGIC 1
  198. #define RGBW_RED_PIN 14
  199. #define RGBW_GREEN_PIN 5
  200. #define RGBW_BLUE_PIN 12
  201. #define RGBW_WHITE_PIN 13
  202. // -----------------------------------------------------------------------------
  203. // DOMOTICZ
  204. // -----------------------------------------------------------------------------
  205. #ifndef ENABLE_DOMOTICZ
  206. #define ENABLE_DOMOTICZ 1
  207. #endif
  208. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  209. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  210. // -----------------------------------------------------------------------------
  211. // INFLUXDB
  212. // -----------------------------------------------------------------------------
  213. #ifndef ENABLE_INFLUXDB
  214. #define ENABLE_INFLUXDB 1
  215. #endif
  216. #define INFLUXDB_PORT 8086
  217. // -----------------------------------------------------------------------------
  218. // NTP
  219. // -----------------------------------------------------------------------------
  220. #define NTP_SERVER "pool.ntp.org"
  221. #define NTP_TIME_OFFSET 1
  222. #define NTP_DAY_LIGHT true
  223. #define NTP_UPDATE_INTERVAL 1800
  224. // -----------------------------------------------------------------------------
  225. // FAUXMO
  226. // -----------------------------------------------------------------------------
  227. // This setting defines whether Alexa support should be built into the firmware
  228. #ifndef ENABLE_FAUXMO
  229. #define ENABLE_FAUXMO 1
  230. #endif
  231. // This is default value for the fauxmoEnabled setting that defines whether
  232. // this device should be discoberable and respond to Alexa commands.
  233. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  234. #define FAUXMO_ENABLED 1