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.

225 lines
7.5 KiB

8 years ago
8 years ago
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
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. //--------------------------------------------------------------------------------
  9. // EEPROM
  10. //--------------------------------------------------------------------------------
  11. #define EEPROM_RELAY_STATUS 0
  12. #define EEPROM_ENERGY_COUNT 1
  13. #define EEPROM_DATA_END 5
  14. //--------------------------------------------------------------------------------
  15. // BUTTON
  16. //--------------------------------------------------------------------------------
  17. #define BUTTON_LNGCLICK_LENGTH 1000
  18. #define BUTTON_LNGLNGCLICK_LENGTH 10000
  19. #define BUTTON_EVENT_NONE 0
  20. #define BUTTON_EVENT_PRESSED 1
  21. #define BUTTON_EVENT_CLICK 2
  22. #define BUTTON_EVENT_DBLCLICK 3
  23. #define BUTTON_EVENT_LNGCLICK 4
  24. #define BUTTON_EVENT_LNGLNGCLICK 5
  25. #define BUTTON_MODE_NONE 0
  26. #define BUTTON_MODE_TOGGLE 1
  27. #define BUTTON_MODE_AP 2
  28. #define BUTTON_MODE_RESET 3
  29. #define BUTTON_MODE_PULSE 4
  30. #define BUTTON_MODE_FACTORY 5
  31. #define BUTTON_DEFAULT_MODE BUTTON_MODE_TOGGLE
  32. //--------------------------------------------------------------------------------
  33. // RELAY
  34. //--------------------------------------------------------------------------------
  35. #define RELAY_MODE_OFF 0
  36. #define RELAY_MODE_ON 1
  37. #define RELAY_MODE_SAME 2
  38. #define RELAY_MODE_TOOGLE 3
  39. #define RELAY_SYNC_ANY 0
  40. #define RELAY_SYNC_NONE_OR_ONE 1
  41. #define RELAY_SYNC_ONE 2
  42. #define RELAY_SYNC_SAME 3
  43. #define RELAY_PULSE_NONE 0
  44. #define RELAY_PULSE_OFF 1
  45. #define RELAY_PULSE_ON 2
  46. #define RELAY_PROVIDER_RELAY 0
  47. #define RELAY_PROVIDER_DUAL 1
  48. #define RELAY_PROVIDER_MY9291 2
  49. #ifndef RELAY_PROVIDER
  50. #define RELAY_PROVIDER RELAY_PROVIDER_RELAY
  51. #endif
  52. // Pulse time in seconds
  53. #define RELAY_PULSE_TIME 1
  54. // 0 means OFF, 1 ON and 2 whatever was before
  55. #define RELAY_MODE RELAY_MODE_OFF
  56. // 0 means ANY, 1 zero or one and 2 one and only one
  57. #define RELAY_SYNC RELAY_SYNC_ANY
  58. // 0 means no pulses, 1 means normally off, 2 normally on
  59. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  60. //--------------------------------------------------------------------------------
  61. // I18N
  62. //--------------------------------------------------------------------------------
  63. #define TMP_CELSIUS 0
  64. #define TMP_FAHRENHEIT 1
  65. #define TMP_UNITS TMP_CELSIUS
  66. //--------------------------------------------------------------------------------
  67. // LED
  68. //--------------------------------------------------------------------------------
  69. // All defined LEDs in the board can be managed through MQTT
  70. // except the first one when LED_AUTO is set to 1.
  71. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  72. #define LED_AUTO 1
  73. // -----------------------------------------------------------------------------
  74. // WIFI & WEB
  75. // -----------------------------------------------------------------------------
  76. #define WIFI_RECONNECT_INTERVAL 300000
  77. #define WIFI_MAX_NETWORKS 5
  78. #define ADMIN_PASS "fibonacci"
  79. #define FORCE_CHANGE_PASS 1
  80. #define HTTP_USERNAME "admin"
  81. #define WS_BUFFER_SIZE 5
  82. #define WS_TIMEOUT 1800000
  83. #define WEBSERVER_PORT 80
  84. #define DNS_PORT 53
  85. #define ENABLE_MDNS 1
  86. #define WEB_MODE_NORMAL 0
  87. #define WEB_MODE_PASSWORD 1
  88. #define AP_MODE AP_MODE_ALONE
  89. // This option builds the firmware with the web interface embedded.
  90. // You first have to build the data.h file that holds the contents
  91. // of the web interface by running "gulp buildfs_embed"
  92. #ifndef EMBEDDED_WEB
  93. #define EMBEDDED_WEB 0
  94. #endif
  95. // -----------------------------------------------------------------------------
  96. // OTA & NOFUSS
  97. // -----------------------------------------------------------------------------
  98. #define OTA_PORT 8266
  99. #define NOFUSS_SERVER ""
  100. #define NOFUSS_INTERVAL 3600000
  101. // -----------------------------------------------------------------------------
  102. // MQTT
  103. // -----------------------------------------------------------------------------
  104. #ifndef MQTT_USE_ASYNC
  105. #define MQTT_USE_ASYNC 0
  106. #endif
  107. #define MQTT_SERVER ""
  108. #define MQTT_PORT 1883
  109. #define MQTT_TOPIC "/test/switch/{identifier}"
  110. #define MQTT_RETAIN true
  111. #define MQTT_QOS 0
  112. #define MQTT_KEEPALIVE 30
  113. #define MQTT_RECONNECT_DELAY 10000
  114. #define MQTT_TRY_INTERVAL 30000
  115. #define MQTT_MAX_TRIES 12
  116. #define MQTT_SKIP_RETAINED 1
  117. #define MQTT_SKIP_TIME 1000
  118. #define MQTT_ACTION_TOPIC "/action"
  119. #define MQTT_RELAY_TOPIC "/relay"
  120. #define MQTT_LED_TOPIC "/led"
  121. #define MQTT_COLOR_TOPIC "/color"
  122. #define MQTT_BUTTON_TOPIC "/button"
  123. #define MQTT_IP_TOPIC "/ip"
  124. #define MQTT_VERSION_TOPIC "/version"
  125. #define MQTT_HEARTBEAT_TOPIC "/status"
  126. #define MQTT_ACTION_RESET "reset"
  127. #define MQTT_CONNECT_EVENT 0
  128. #define MQTT_DISCONNECT_EVENT 1
  129. #define MQTT_MESSAGE_EVENT 2
  130. // Custom get and set postfixes
  131. // Use something like "/status" or "/set", with leading slash
  132. #define MQTT_USE_GETTER ""
  133. #define MQTT_USE_SETTER ""
  134. // -----------------------------------------------------------------------------
  135. // I2C
  136. // -----------------------------------------------------------------------------
  137. #define ENABLE_I2C 0
  138. #define I2C_SDA_PIN 4
  139. #define I2C_SCL_PIN 14
  140. #define I2C_CLOCK_STRETCH_TIME 200
  141. #define I2C_SCL_FREQUENCY 1000
  142. // -----------------------------------------------------------------------------
  143. // MY9291
  144. // -----------------------------------------------------------------------------
  145. #define MY9291_DI_PIN 13
  146. #define MY9291_DCKI_PIN 15
  147. #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
  148. #define MY9291_COLOR_RED 0
  149. #define MY9291_COLOR_GREEN 0
  150. #define MY9291_COLOR_BLUE 0
  151. #define MY9291_COLOR_WHITE 192
  152. // -----------------------------------------------------------------------------
  153. // DOMOTICZ
  154. // -----------------------------------------------------------------------------
  155. #ifndef ENABLE_DOMOTICZ
  156. #define ENABLE_DOMOTICZ 1
  157. #endif
  158. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  159. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  160. // -----------------------------------------------------------------------------
  161. // NTP
  162. // -----------------------------------------------------------------------------
  163. #define NTP_SERVER "pool.ntp.org"
  164. #define NTP_TIME_OFFSET 1
  165. #define NTP_DAY_LIGHT true
  166. #define NTP_UPDATE_INTERVAL 1800
  167. // -----------------------------------------------------------------------------
  168. // FAUXMO
  169. // -----------------------------------------------------------------------------
  170. // This setting defines whether Alexa support should be built into the firmware
  171. #ifndef ENABLE_FAUXMO
  172. #define ENABLE_FAUXMO 1
  173. #endif
  174. // This is default value for the fauxmoEnabled setting that defines whether
  175. // this device should be discoberable and respond to Alexa commands.
  176. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  177. #define FAUXMO_ENABLED 1