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.

48 lines
1.5 KiB

  1. // -----------------------------------------------------------------------------
  2. // Lights
  3. // -----------------------------------------------------------------------------
  4. #pragma once
  5. namespace Light {
  6. constexpr const long VALUE_MIN = LIGHT_MIN_VALUE;
  7. constexpr const long VALUE_MAX = LIGHT_MAX_VALUE;
  8. constexpr const long BRIGHTNESS_MIN = LIGHT_MIN_BRIGHTNESS;
  9. constexpr const long BRIGHTNESS_MAX = LIGHT_MAX_BRIGHTNESS;
  10. // Default to the Philips Hue value that HA also use.
  11. // https://developers.meethue.com/documentation/core-concepts
  12. constexpr const long MIREDS_COLDWHITE = LIGHT_COLDWHITE_MIRED;
  13. constexpr const long MIREDS_WARMWHITE = LIGHT_WARMWHITE_MIRED;
  14. constexpr const long KELVIN_WARMWHITE = LIGHT_WARMWHITE_KELVIN;
  15. constexpr const long KELVIN_COLDWHITE = LIGHT_COLDWHITE_KELVIN;
  16. constexpr const long PWM_MIN = LIGHT_MIN_PWM;
  17. constexpr const long PWM_MAX = LIGHT_MAX_PWM;
  18. constexpr const long PWM_LIMIT = LIGHT_LIMIT_PWM;
  19. enum Communications : unsigned char {
  20. COMMS_NONE = 0,
  21. COMMS_NORMAL = 1 << 0,
  22. COMMS_GROUP = 1 << 1
  23. };
  24. }
  25. size_t lightChannels();
  26. void lightState(unsigned char i, bool state);
  27. bool lightState(unsigned char i);
  28. void lightState(bool state);
  29. bool lightState();
  30. void lightBrightness(long brightness);
  31. long lightBrightness();
  32. long lightChannel(unsigned char id);
  33. void lightChannel(unsigned char id, long value);
  34. void lightBrightnessStep(long steps, long multiplier = LIGHT_STEP);
  35. void lightChannelStep(unsigned char id, long steps, long multiplier = LIGHT_STEP);