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.

274 lines
9.1 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. //--------------------------------------------------------------------------------
  70. // I18N
  71. //--------------------------------------------------------------------------------
  72. #define TMP_CELSIUS 0
  73. #define TMP_FAHRENHEIT 1
  74. #define TMP_UNITS TMP_CELSIUS
  75. //--------------------------------------------------------------------------------
  76. // LED
  77. //--------------------------------------------------------------------------------
  78. // All defined LEDs in the board can be managed through MQTT
  79. // except the first one when LED_AUTO is set to 1.
  80. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  81. #define LED_AUTO 1
  82. // -----------------------------------------------------------------------------
  83. // WIFI & WEB
  84. // -----------------------------------------------------------------------------
  85. #define WIFI_RECONNECT_INTERVAL 120000
  86. #define WIFI_MAX_NETWORKS 5
  87. #define ADMIN_PASS "fibonacci"
  88. #define FORCE_CHANGE_PASS 1
  89. #define HTTP_USERNAME "admin"
  90. #define WS_BUFFER_SIZE 5
  91. #define WS_TIMEOUT 1800000
  92. #define WEBSERVER_PORT 80
  93. #define DNS_PORT 53
  94. #define ENABLE_MDNS 1
  95. #define WEB_MODE_NORMAL 0
  96. #define WEB_MODE_PASSWORD 1
  97. #define AP_MODE AP_MODE_ALONE
  98. // This option builds the firmware with the web interface embedded.
  99. // You first have to build the data.h file that holds the contents
  100. // of the web interface by running "gulp buildfs_embed"
  101. #ifndef EMBEDDED_WEB
  102. #define EMBEDDED_WEB 1
  103. #endif
  104. // -----------------------------------------------------------------------------
  105. // OTA & NOFUSS
  106. // -----------------------------------------------------------------------------
  107. #define OTA_PORT 8266
  108. #define NOFUSS_SERVER ""
  109. #define NOFUSS_INTERVAL 3600000
  110. // -----------------------------------------------------------------------------
  111. // MQTT
  112. // -----------------------------------------------------------------------------
  113. #ifndef MQTT_USE_ASYNC
  114. #define MQTT_USE_ASYNC 1
  115. #endif
  116. #define MQTT_SERVER ""
  117. #define MQTT_PORT 1883
  118. #define MQTT_TOPIC "/test/switch/{identifier}"
  119. #define MQTT_RETAIN true
  120. #define MQTT_QOS 0
  121. #define MQTT_KEEPALIVE 30
  122. #define MQTT_RECONNECT_DELAY 10000
  123. #define MQTT_TRY_INTERVAL 30000
  124. #define MQTT_MAX_TRIES 12
  125. #define MQTT_SKIP_RETAINED 1
  126. #define MQTT_SKIP_TIME 1000
  127. #define MQTT_TOPIC_ACTION "action"
  128. #define MQTT_TOPIC_RELAY "relay"
  129. #define MQTT_TOPIC_LED "led"
  130. #define MQTT_TOPIC_COLOR "color"
  131. #define MQTT_TOPIC_BUTTON "button"
  132. #define MQTT_TOPIC_IP "ip"
  133. #define MQTT_TOPIC_VERSION "version"
  134. #define MQTT_TOPIC_UPTIME "uptime"
  135. #define MQTT_TOPIC_FREEHEAP "freeheap"
  136. #define MQTT_TOPIC_VCC "vcc"
  137. #define MQTT_TOPIC_STATUS "status"
  138. #define MQTT_TOPIC_MAC "mac"
  139. #define MQTT_TOPIC_RSSI "rssi"
  140. #define MQTT_TOPIC_APP "app"
  141. #define MQTT_TOPIC_INTERVAL "interval"
  142. #define MQTT_TOPIC_HOSTNAME "hostname"
  143. // Periodic reports
  144. #define MQTT_REPORT_STATUS 1
  145. #define MQTT_REPORT_IP 1
  146. #define MQTT_REPORT_MAC 1
  147. #define MQTT_REPORT_RSSI 1
  148. #define MQTT_REPORT_UPTIME 1
  149. #define MQTT_REPORT_FREEHEAP 1
  150. #define MQTT_REPORT_VCC 1
  151. #define MQTT_REPORT_RELAY 1
  152. #define MQTT_REPORT_HOSTNAME 1
  153. #define MQTT_REPORT_APP 1
  154. #define MQTT_REPORT_VERSION 1
  155. #define MQTT_REPORT_INTERVAL 0
  156. #define MQTT_STATUS_ONLINE "1"
  157. #define MQTT_STATUS_OFFLINE "0"
  158. #define MQTT_ACTION_RESET "reset"
  159. #define MQTT_CONNECT_EVENT 0
  160. #define MQTT_DISCONNECT_EVENT 1
  161. #define MQTT_MESSAGE_EVENT 2
  162. // Custom get and set postfixes
  163. // Use something like "/status" or "/set", with leading slash
  164. #define MQTT_USE_GETTER ""
  165. #define MQTT_USE_SETTER ""
  166. // -----------------------------------------------------------------------------
  167. // I2C
  168. // -----------------------------------------------------------------------------
  169. #define ENABLE_I2C 0
  170. #define I2C_SDA_PIN 4
  171. #define I2C_SCL_PIN 14
  172. #define I2C_CLOCK_STRETCH_TIME 200
  173. #define I2C_SCL_FREQUENCY 1000
  174. // -----------------------------------------------------------------------------
  175. // LIGHT
  176. // -----------------------------------------------------------------------------
  177. #define LIGHT_PROVIDER_NONE 0
  178. #define LIGHT_PROVIDER_WS2812 1
  179. #define LIGHT_PROVIDER_RGB 2
  180. #define LIGHT_PROVIDER_RGBW 3
  181. #define LIGHT_PROVIDER_MY9192 4
  182. #define LIGHT_DEFAULT_COLOR "#000080"
  183. #define LIGHT_SAVE_DELAY 5
  184. #define MY9291_DI_PIN 13
  185. #define MY9291_DCKI_PIN 15
  186. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  187. // Shared settings between RGB and RGBW lights
  188. #define RGBW_INVERSE_LOGIC 1
  189. #define RGBW_RED_PIN 14
  190. #define RGBW_GREEN_PIN 5
  191. #define RGBW_BLUE_PIN 12
  192. #define RGBW_WHITE_PIN 13
  193. // -----------------------------------------------------------------------------
  194. // DOMOTICZ
  195. // -----------------------------------------------------------------------------
  196. #ifndef ENABLE_DOMOTICZ
  197. #define ENABLE_DOMOTICZ 1
  198. #endif
  199. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  200. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  201. // -----------------------------------------------------------------------------
  202. // NTP
  203. // -----------------------------------------------------------------------------
  204. #define NTP_SERVER "pool.ntp.org"
  205. #define NTP_TIME_OFFSET 1
  206. #define NTP_DAY_LIGHT true
  207. #define NTP_UPDATE_INTERVAL 1800
  208. // -----------------------------------------------------------------------------
  209. // FAUXMO
  210. // -----------------------------------------------------------------------------
  211. // This setting defines whether Alexa support should be built into the firmware
  212. #ifndef ENABLE_FAUXMO
  213. #define ENABLE_FAUXMO 1
  214. #endif
  215. // This is default value for the fauxmoEnabled setting that defines whether
  216. // this device should be discoberable and respond to Alexa commands.
  217. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  218. #define FAUXMO_ENABLED 1