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.

24 lines
632 B

  1. /*
  2. DOMOTICZ MODULE
  3. Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #if ENABLE_DOMOTICZ
  6. template<typename T> void domoticzSend(const char * key, T nvalue, const char * svalue) {
  7. unsigned int idx = getSetting(key).toInt();
  8. if (idx > 0) {
  9. char payload[128];
  10. snprintf(payload, 128, "{\"idx\": %d, \"nvalue\": %s, \"svalue\": \"%s\"}", idx, String(nvalue).c_str(), svalue);
  11. mqttSendRaw(getSetting("dczTopicIn", DOMOTICZ_IN_TOPIC).c_str(), payload);
  12. }
  13. }
  14. template<typename T> void domoticzSend(const char * key, T nvalue) {
  15. domoticzSend(key, nvalue, "");
  16. }
  17. #endif