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.

88 lines
3.3 KiB

  1. //--------------------------------------------------------------------------------
  2. // Custom RF module
  3. // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  4. // Enable support by passing ENABLE_RF=1 build flag
  5. //--------------------------------------------------------------------------------
  6. #define RF_PIN 14
  7. #define RF_CHANNEL 31
  8. #define RF_DEVICE 1
  9. //--------------------------------------------------------------------------------
  10. // DHTXX temperature/humidity sensor
  11. // Enable support by passing ENABLE_DHT=1 build flag
  12. //--------------------------------------------------------------------------------
  13. #define DHT_PIN 14
  14. #define DHT_UPDATE_INTERVAL 60000
  15. #define DHT_TYPE DHT22
  16. #define DHT_TIMING 11
  17. #define DHT_TEMPERATURE_TOPIC "/temperature"
  18. #define DHT_HUMIDITY_TOPIC "/humidity"
  19. //--------------------------------------------------------------------------------
  20. // DS18B20 temperature sensor
  21. // Enable support by passing ENABLE_DS18B20=1 build flag
  22. //--------------------------------------------------------------------------------
  23. #define DS_PIN 14
  24. #define DS_UPDATE_INTERVAL 60000
  25. #define DS_TEMPERATURE_TOPIC "/temperature"
  26. //--------------------------------------------------------------------------------
  27. // Custom current sensor
  28. // Check http://tinkerman.cat/your-laundry-is-done/
  29. // Enable support by passing ENABLE_EMON=1 build flag
  30. //--------------------------------------------------------------------------------
  31. #define EMON_ANALOG_PROVIDER 0
  32. #define EMON_ADC121_PROVIDER 1
  33. #define EMON_PROVIDER EMON_ADC121_PROVIDER
  34. #if EMON_PROVIDER == EMON_ANALOG_PROVIDER
  35. #define EMON_CURRENT_PIN 0
  36. #define EMON_ADC_BITS 10
  37. #define EMON_REFERENCE_VOLTAGE 1.0
  38. #define EMON_CURRENT_PRECISION 1
  39. #define EMON_CURRENT_OFFSET 0.25
  40. #endif
  41. #if EMON_PROVIDER == EMON_ADC121_PROVIDER
  42. #define EMON_ADC121_ADDRESS 0x50
  43. #define EMON_ADC_BITS 12
  44. #define EMON_REFERENCE_VOLTAGE 3.3
  45. #define EMON_CURRENT_PRECISION 2
  46. #define EMON_CURRENT_OFFSET 0
  47. #endif
  48. #define EMON_CURRENT_RATIO 30
  49. #define EMON_SAMPLES 1000
  50. #define EMON_INTERVAL 10000
  51. #define EMON_MEASUREMENTS 6
  52. #define EMON_MAINS_VOLTAGE 230
  53. #define EMON_POWER_TOPIC "/power"
  54. //--------------------------------------------------------------------------------
  55. // HLW8012 power sensor (Sonoff POW)
  56. // Enable support by passing ENABLE_POW=1 build flag
  57. // Enabled by default when selecting SONOFF_POW hardware
  58. //--------------------------------------------------------------------------------
  59. #define POW_SEL_PIN 5
  60. #define POW_CF1_PIN 13
  61. #define POW_CF_PIN 14
  62. #define POW_USE_INTERRUPTS 1
  63. #define POW_SEL_CURRENT HIGH
  64. #define POW_CURRENT_R 0.001
  65. #define POW_VOLTAGE_R_UP ( 5 * 470000 ) // Real: 2280k
  66. #define POW_VOLTAGE_R_DOWN ( 1000 ) // Real 1.009k
  67. #define POW_POWER_TOPIC "/power"
  68. #define POW_CURRENT_TOPIC "/current"
  69. #define POW_VOLTAGE_TOPIC "/voltage"
  70. #define POW_APOWER_TOPIC "/apower"
  71. #define POW_RPOWER_TOPIC "/rpower"
  72. #define POW_PFACTOR_TOPIC "/pfactor"
  73. #define POW_ENERGY_TOPIC "/energy"
  74. #define POW_UPDATE_INTERVAL 5000
  75. #define POW_REPORT_EVERY 12