-
Notifications
You must be signed in to change notification settings - Fork 15
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
ST --> MQTT Bridge messages not retained #18
Comments
Just want to make sure I understand what you are saying:
next reboot of what? The device? ST? MBS-Server The way I think it is supposed to work:
if you clarify your flow it might make more sense. In summary: To check if MBS-server retained setting is working here is what i would do.
hope this clarifies |
I don't think you can wake from deep sleep using MQTT since wifi is down during deep sleep and MQTT message will not be received. I think a D1 and RST have to be shorted (or the other way round) for it to come out of deep sleep or like you are doing waking up with a timer. |
I am not trying to wake the device but prevent from going to deep sleep again The message is published correctly to clients that are already connected. Hope this is more clear |
not sure I follow - if all clients that are connected are getting the message and you have retained setting set correctly under what circumstances is it working? Are you sure message from ST is the last message published to that topic? |
I have created a test server try using this. Here the log will show if we are sending the right true flag to the MQTT broker - if that shows 'true' for the commands that you are sending and still cannot confirm messages are being retained the problem might be with the broker or device and we can troubleshoot those once we can eliminate MBS-server |
The retain flag seems to be true : If I start MQTT explorer after this, I see all topics except "winesensor_cellier_1/switch/state" |
You've probably already check this but just to confirm: so that is what message will be retained to. But the topic you mention you are looking for when MQTT explorer starts is so by extention when you say
you mean the topic |
check on other thing for me if you could please: the eSP8266 is subscribed to that topic so it responds to that by changing state. which is is being picked by MQTT explorer just wondering if that could be the scenario Also noticing a space between raspberry and '/' just wondering if that could be an issue if inadvertently the subscription topic is missing that space. |
Yes you are right I reduced the lenght of the topic for sake of simplifying things but the topics are the same. The device is publishing temperature, humidity, etc and they are retained correctly. FYI, I just did the test : The message is correctly retained and the deep sleep is prevented on my device |
The ESP doesn't publish state change, it just subscribe to the topic and execute actions when payload is "on" |
Also noticing a space between raspberry and '/' just wondering if that could be an issue if inadvertently the subscription topic is missing that space. If that is not the case then let explore some other scenarios:
|
No don't worry I replace the name of my server for sake of privacy lol ... there is no "typo" |
looks like u r using mosquitto.
|
You mean multiple brokers ? No I use the Smartthings bridge and Mosquitto on the same raspberry pi
no |
thnx could you respond to other comment above also please |
Yes but for some reason not retained when the device wake up after deep sleep
Just a way of troubleshooting it. Disconnecting and connecting MQTT explorer is like my esp8266 waking up and going back to sleep
Yes but only if published while the device is on (60s every 15min)
It is hard to time correctly (60s every 15min) so the goal is to publish the message, wait maximum 15 minutes and be 100% sure the device will not be sleeping |
Could I send you privately my config files and device handlers ? Via e-mail ? |
sure please feel free to send me. i think this change should fix it. my email should be there |
Same behavior Could it be because "switch" is a reserved system name in ST?? Cannot find your email address sorry |
that is odd.
and the log is still showing ST-MQTT Retain:true? i was so confident this would fix it. using "switch" should not be an issue |
Oh yes you got it ! correct line is : |
Nice job ! :) Works good now ! Could I still send you my files and you tell me if I am using the devices.yml correctly ? I modified MBS smartapp and not really sure I had to. But now the messages are correctly retained 💯 |
sure - send me your configs and i can look at them thx for finding and troubleshooting this - careless mistake on my end |
dont think that email is forwarding try this |
Hi,
I am implementing a ESP8266 sensor with ESPHome library and everything works fine so far.
The sensor is running for 60s and enter deep sleep for 15min.
I am using a "ota_switch" via MQTT to prevent going to deep sleep. That way, I am able to update the sensor via OTA.
The problem is that the message the MQTT publishes following a state change on ST is not persistent. If I happen to "time" the message during the 60s runtime, my logic works perfectly. But if push the virtual button during deep sleep, it is not retained until next boot.
I have the same behavior using MQTT Explorer, the message is not retained.
The weird thing is "MQTT --> ST" is always retain and I have no issues at all
The text was updated successfully, but these errors were encountered: