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.2 KiB

  1. /*
  2. RELAY MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #include "espurna.h"
  7. #include "rpc.h"
  8. #include <bitset>
  9. constexpr size_t RelaysMax = 32;
  10. PayloadStatus relayParsePayload(const char * payload);
  11. bool relayStatus(unsigned char id, bool status, bool report, bool group_report);
  12. bool relayStatus(unsigned char id, bool status);
  13. // gets either current or target status, where current is the status that we are
  14. // actually in and target is the status we would be, eventually, unless
  15. // relayStatus(id, relayStatus()) is called
  16. bool relayStatus(unsigned char id);
  17. bool relayStatusTarget(unsigned char id);
  18. void relayToggle(unsigned char id, bool report, bool group_report);
  19. void relayToggle(unsigned char id);
  20. unsigned char relayCount();
  21. const String& relayPayloadOn();
  22. const String& relayPayloadOff();
  23. const String& relayPayloadToggle();
  24. const char* relayPayload(PayloadStatus status);
  25. void relayMQTT(unsigned char id);
  26. void relayMQTT();
  27. void relayPulse(unsigned char id);
  28. void relaySync(unsigned char id);
  29. void relaySave(bool eeprom);
  30. void relaySetupDummy(size_t size, bool reconfigure = false);
  31. void relaySetup();