-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Retain flag on SENSOR data #74
Comments
what do you mean by retain sensor messages? If you are meaning to save the temp/humidity/power data to flash so that it's not lost on a reboot, that's not really possible because flash is write limited, it will wear out, so writing to it every time we get a new piece of data would cause the devices to wear out much faster. It's far better to have your home automation system grab the data and store it in some method. Even if you use a Pi and write to a SD card, you can at least replace the SD card when it wears out and not have to replace the entire computer (or in the case of the sonoffs, all the computers wired into things around your house as they wear out) :-) |
Was this in relation to setting the retain flag on the MQTT messages (same as the below concept?) |
each of those things is expected to change relatively infrequently, when they
are configured to retain, every time the item changes it writes to flash.
sensor data is expected to change every time it's reported (5 min by defaults,
but it works down to about 5-10 seconds
…On Sun, 19 Mar 2017, khcnz wrote:
Was this in relation to setting the retain flag on the MQTT messages (same as the below concept?)
#define MQTT_BUTTON_RETAIN
#define MQTT_POWER_RETAIN
#define MQTT_SWITCH_RETAIN
|
I haven't looked at the code but one of us is confused - i was talking about the retain flag sent on the MQTT messages which tells the broker to store this message. Nothing to do with flash |
Yes, one of us in confused, I'm pretty sure those retain flags are telling the
firmware on the esp to save those to flash so that they are avaiable after
restart.
I don't see how it would make sense for the device to set a flag on messages to
the mqtt broker about retention, it has no idea what is on the other end of the
broker (how many different things may be there), let alone if it makes sense for
those things to remember state or not.
David Lang
|
I have had a look at source - pretty sure I am correct and these relate to the retain flag on the MQTT message. The point of the retain flag is that the message is cached by the broker so when you connect you will receive the most recent value that has been posted. This ensures that as long as your server is always reachable by sonoff then any client that would like to receive the most recent value can just ask the MQTT broker - thats an expected pattern good write up here about how it may be useful in an IOT world http://www.steves-internet-guide.com/mqtt-retained-messages-example/ I'd suggest its a valid use case and re-open the ticket for prioritization. the change would be pretty trivial. |
If this is just a flag to the mqtt broker telling it to cache the data and allow
it to be queried (as opposed to the 'normal' role of the broker of just message
passing), then is there a reason not to set the flag all the time? It's a
different mode of accessing the broker, so it won't confuse existing clients.
And it's not likely to be a significant load on the broker (or if it is, even
with thousands of devices, the broker needs to be fixed :-)
go ahead and re-open the issue.
|
It wasn't my ticket and i don't have issue permission :) |
Implemented SensorRetain on message |
5.0.3 20170504 * Add command SensorRetain on|off to enable retaining of mqtt message tele/sonoff/SENSOR (#74) * Change WifiConfig timeout from 60 seconds to 180 seconds (#212) * Change Sonoff Touch command Ledstate functionality by turning led on if power is off (#214) * Add 4 seconds delay after power on before enabling button to workaround Wemos D1 mini RTS circuit (#380)
5.0.3 20170504 * Add command SensorRetain on|off to enable retaining of mqtt message tele/sonoff/SENSOR (arendst#74) * Change WifiConfig timeout from 60 seconds to 180 seconds (arendst#212) * Change Sonoff Touch command Ledstate functionality by turning led on if power is off (arendst#214) * Add 4 seconds delay after power on before enabling button to workaround Wemos D1 mini RTS circuit (arendst#380)
Update from Tasmota
Shuttercalibration will change over time and enhance. Issue arendst#75 and arendst#74 fixed
Step 1 of enhanced calibration. open and close duration for shutter are now 0.1 second precise.
Hi Theo,
Would it be possible to retain sensor messages?
thanks in advance
The text was updated successfully, but these errors were encountered: