From 4a9a65baa552291ba72a3bd0c9d5d905a4442a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 5 Feb 2018 23:13:11 +0100 Subject: [PATCH] Clean domoticz data types --- code/espurna/domoticz.ino | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/espurna/domoticz.ino b/code/espurna/domoticz.ino index 92b6da36..4a919cb7 100644 --- a/code/espurna/domoticz.ino +++ b/code/espurna/domoticz.ino @@ -16,8 +16,8 @@ bool _dcz_enabled = false; // Private methods //------------------------------------------------------------------------------ -int _domoticzRelay(unsigned int idx) { - for (int relayID=0; relayID= 0) { - unsigned long value = root["nvalue"]; - DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %lu for IDX %lu\n"), value, idx); + unsigned char value = root["nvalue"]; + DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %u for IDX %u\n"), value, idx); relayStatus(relayID, value == 1); } @@ -84,7 +84,7 @@ void _domoticzWebSocketOnSend(JsonObject& root) { root["dczTopicOut"] = getSetting("dczTopicOut", DOMOTICZ_OUT_TOPIC); JsonArray& relays = root.createNestedArray("dczRelays"); - for (byte i=0; i void domoticzSend(const char * key, T nvalue) { domoticzSend(key, nvalue, ""); } -void domoticzSendRelay(unsigned int relayID) { +void domoticzSendRelay(unsigned char relayID) { if (!_dcz_enabled) return; char buffer[15]; - snprintf_P(buffer, sizeof(buffer), PSTR("dczRelayIdx%lu"), relayID); + snprintf_P(buffer, sizeof(buffer), PSTR("dczRelayIdx%u"), relayID); domoticzSend(buffer, relayStatus(relayID) ? "1" : "0"); } -int domoticzIdx(unsigned int relayID) { +unsigned int domoticzIdx(unsigned char relayID) { char buffer[15]; - snprintf_P(buffer, sizeof(buffer), PSTR("dczRelayIdx%lu"), relayID); + snprintf_P(buffer, sizeof(buffer), PSTR("dczRelayIdx%u"), relayID); return getSetting(buffer).toInt(); }