homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 307 forks source link

Range index control is not valid #746

Open denis-obukhov opened 1 year ago

denis-obukhov commented 1 year ago

Develop branch.

Simple settable property is defined. When I write "true" or "false" or any other value to the appropriate topic (homie/esp_node/fan_control/stage1_on/set) (either manually via MQTT Explorer or using a ready-to-use Homie convention module in NodeRED) I get "Range index control is not valid" message in console. fanStage1Handler is never called. I can't figure out where it comes from. Can't find anything similar to this.

#include <Homie.h>

const int FAN_MODE_PIN_1 = D6;
HomieNode fanNode("fan_control", "Fan Control", "switch");
bool fanStage1Handler(const HomieRange& range, const String& value);

void loopHandler() {
}

void setup() {
  Serial.begin(115200);
  Serial << endl << endl;
  delay(1000);

  pinMode(FAN_MODE_PIN_1, OUTPUT);

  Homie_setFirmware("esp_node", "1.0.0");
  Homie.setLoopFunction(loopHandler);

  fanNode.advertise("stage1_on").setName("Fan stage 1").setDatatype("boolean").settable(fanStage1Handler);
  Homie.setup();
}

void loop() {
  Homie.loop();
}

bool fanStage1Handler(const HomieRange& range, const String& value) { 
  Homie.getLogger() << "fanStage1Handler is fired " << endl;
  return true;
}