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.

279 lines
9.3 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. // Periodic reports
  148. #define MQTT_REPORT_STATUS 1
  149. #define MQTT_REPORT_IP 1
  150. #define MQTT_REPORT_MAC 1
  151. #define MQTT_REPORT_RSSI 1
  152. #define MQTT_REPORT_UPTIME 1
  153. #define MQTT_REPORT_FREEHEAP 1
  154. #define MQTT_REPORT_VCC 1
  155. #define MQTT_REPORT_RELAY 1
  156. #define MQTT_REPORT_HOSTNAME 1
  157. #define MQTT_REPORT_APP 1
  158. #define MQTT_REPORT_VERSION 1
  159. #define MQTT_REPORT_INTERVAL 0
  160. #define MQTT_STATUS_ONLINE "1"
  161. #define MQTT_STATUS_OFFLINE "0"
  162. #define MQTT_ACTION_RESET "reset"
  163. #define MQTT_CONNECT_EVENT 0
  164. #define MQTT_DISCONNECT_EVENT 1
  165. #define MQTT_MESSAGE_EVENT 2
  166. // Custom get and set postfixes
  167. // Use something like "/status" or "/set", with leading slash
  168. #define MQTT_USE_GETTER ""
  169. #define MQTT_USE_SETTER ""
  170. // -----------------------------------------------------------------------------
  171. // I2C
  172. // -----------------------------------------------------------------------------
  173. #define ENABLE_I2C 0
  174. #define I2C_SDA_PIN 4
  175. #define I2C_SCL_PIN 14
  176. #define I2C_CLOCK_STRETCH_TIME 200
  177. #define I2C_SCL_FREQUENCY 1000
  178. // -----------------------------------------------------------------------------
  179. // LIGHT
  180. // -----------------------------------------------------------------------------
  181. #define LIGHT_PROVIDER_NONE 0
  182. #define LIGHT_PROVIDER_WS2812 1
  183. #define LIGHT_PROVIDER_RGB 2
  184. #define LIGHT_PROVIDER_RGBW 3
  185. #define LIGHT_PROVIDER_MY9192 4
  186. #define LIGHT_DEFAULT_COLOR "#000080"
  187. #define LIGHT_SAVE_DELAY 5
  188. #define MY9291_DI_PIN 13
  189. #define MY9291_DCKI_PIN 15
  190. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  191. // Shared settings between RGB and RGBW lights
  192. #define RGBW_INVERSE_LOGIC 1
  193. #define RGBW_RED_PIN 14
  194. #define RGBW_GREEN_PIN 5
  195. #define RGBW_BLUE_PIN 12
  196. #define RGBW_WHITE_PIN 13
  197. // -----------------------------------------------------------------------------
  198. // DOMOTICZ
  199. // -----------------------------------------------------------------------------
  200. #ifndef ENABLE_DOMOTICZ
  201. #define ENABLE_DOMOTICZ 1
  202. #endif
  203. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  204. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  205. // -----------------------------------------------------------------------------
  206. // NTP
  207. // -----------------------------------------------------------------------------
  208. #define NTP_SERVER "pool.ntp.org"
  209. #define NTP_TIME_OFFSET 1
  210. #define NTP_DAY_LIGHT true
  211. #define NTP_UPDATE_INTERVAL 1800
  212. // -----------------------------------------------------------------------------
  213. // FAUXMO
  214. // -----------------------------------------------------------------------------
  215. // This setting defines whether Alexa support should be built into the firmware
  216. #ifndef ENABLE_FAUXMO
  217. #define ENABLE_FAUXMO 1
  218. #endif
  219. // This is default value for the fauxmoEnabled setting that defines whether
  220. // this device should be discoberable and respond to Alexa commands.
  221. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  222. #define FAUXMO_ENABLED 1