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 308 forks source link

Get retained value #217

Closed AllanMar closed 7 years ago

AllanMar commented 7 years ago

I'm working on an IR Node but I need to know the last state. I was thinking about just saving them on the ESP (EEPROM/SPIFFS) but then I thought perhaps it would make more sense to load the retained value from MQTT instead... I can't seem to determine any "clean" way to fit this into the current framework though. Any suggestions? Would this be something considered in the future?

marvinroger commented 7 years ago

That's why /set topics must be sent as retained, so that you can receive it on boot. What's wrong with this approach?

marvinroger commented 7 years ago

Oh, you mean the value on the property topic, not on the /set topics, and indeed the /set topics might be out of sync with the property value.

I can't think of a clean way to do this, just like you. I guess storing the value locally would be safer. For example, for my roller shutters (which I can set at a given percentage), I store the current percentage on the EEPROM.

AllanMar commented 7 years ago

Yes, I was referring to the property topics. I'll just deal with it with EEPROM, sometimes the most obvious way is the best way.

Thanks and great project here!

rigorm commented 7 years ago

Hi Marvin,

Your project would be a good exemple to put on the example page.

maybe not Homie specific but still. Could be useful to show how to use the EEPROM/SPIFFS..

a striped down version

what do you think ?

J-F

--------- Original Message --------- Subject: Re: [marvinroger/homie-esp8266] Get retained value (#217) From: "Marvin Roger" notifications@github.com Date: 11/15/16 5:34 am To: "marvinroger/homie-esp8266" homie-esp8266@noreply.github.com

Oh, you mean the value on the property topic, not on the /set topics, and indeed the /set topics might be out of sync with the property value. I can't think of a clean way to do this, just like you. I guess storing the value locally would be safer. For example, for my roller shutters (which I can set at a given percentage), I store the current percentage on the EEPROM.

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.