Comments (12)
HI,
I have downloaded the image and upgraded the Nodemcu and it works perfect now!
Thank you very much for your quick response!
Regards,
Jur
from otgw-firmware.
Thanks for reporting the issue. Release of this fix will happen soon.
from otgw-firmware.
@jvinckers so I had to look into the code to verify what you see here. So actually there are several things happening. But let me explain the command queue for you.
When you set (send) a command the following happens:
- the Set command puts adds the command to the queue.
- Adding a command first checks to see if the command is already in the queue, if so, then overwrite the command in queue.
- If not found the command in the queue, then add it to the queue (when there is still a free slot)
- All commands are added with a 20 second delay (so they won't execute instantly)
Then every second the queue handeling is called. That does this:
- Look into queue slots, and check to see if a command is due to be send
- If due, then send command over serial, and update the retry by 1 and set next due in 5 seconds
- If retry > 5, then remove the command from the queue, so a command will never be send more then three times.
When a response is received, and every command should be responded too, then do this:
- Take the response OTGW, and check to see if the command is in the queue (only command letters are used!)
- If there is a match, then the command is removed from the queue, no resending needed.
So the current firmware does implement the command queue, every command you send, takes about 20 second to be send. And if no good response is returned, then it will retry it 5 times, then if that fails the command is removed.
The logs you share is not enough for me to see if the queue properly works for you. If you would be so kind to send more logging and and wait 60 seconds after a command is send, send 2 commands spaces say 7 seconds apart. Then you should see the command queue working, first command should be send for the first time after 20 seconds, and then a retry at 25 seconds, then 27 command 2, etc...
Does this explain your logs better?
Let me know what you think, we can lower the "transmission delay" to 0 ms... but so far no one really complained about the delay and it's nice and slow, so behaviour can be observed well in the logs this way. That's actually the only reason for the 20 second delay.
Hope to hear from you, and a confirmation of the proper functioning would be great.
Regards,
Robert
from otgw-firmware.
In the code you can find the following functions:
- void addOTWGcmdtoqueue(const char* buf, int len)
- void handleOTGWqueue()
- void checkOTGWcmdqueue(const char *buf, int len)
It matches the functions I explained above.
from otgw-firmware.
@jvinckers I have one question for you, why is your OTGW sending PR responses? Are you using the PR command over a serial interface (network) by any chance? What is your setup? Please share some information, that way I can understand better what usecases there are with others.
from otgw-firmware.
A debug trace from my dev build:
[08:57:10][ 14176| 11200] handleMQTTca( 57): Message arrived on topic [OTGW/set/otgw-2CF43257D77C/command] = [TT=16.8] (7)
[08:57:10][ 12832| 11200] addOTWGcmdto( 991): CmdQueue: Adding cmd end of queue, slot [0]
[08:57:10][ 12832| 11200] addOTWGcmdto( 994): CmdQueue: Insert queue in slot[0]:[]
[08:57:10][ 12832| 11200] addOTWGcmdto(1007): CmdQueue: Next free queue slot: [1]
[08:57:11][ 14312| 11200] processOTGW (1156): Thermostat [T00110000] [READ_DATA ] [RelModLevel ] hb[ 0] lb[ 0]
[08:57:11][ 13640| 11200] processOTGW (1151): Boiler [BC0110000] [READ_ACK ] [RelModLevel ] RelModLevel = 0.00 %
[08:57:11][ 12968| 11200] sendMQTTData( 284): Sending MQTT: server [192.168.88.254]:[1883] => TopicId [OTGW/value/otgw-2CF43257D77C/RelModLevel] --> Message [0.00]
[08:57:11][ 13640| 11200] handleOTGWqu(1019): CmdQueue: Checking due in queue slot[0]:[20846]<[23113]
[08:57:11][ 12968| 11200] handleOTGWqu(1021): CmdQueue: Queue slot [0] due
[08:57:11][ 12968| 11200] sendOTGW (1097): Sending to Serial [TT=16.8] (7)
[08:57:11][ 12944| 11200] checkOTGWcmd(1059): CmdQueue: Checking if command is in in queue [TT: 16.80] (9)
[08:57:11][ 12944| 11200] checkOTGWcmd(1070): CmdQueue: Checking [TT]==>[0]:[TT=16.8] from queue
[08:57:11][ 12944| 11200] checkOTGWcmd(1073): CmdQueue: Found cmd [TT]==>[0]:[TT=16.8]
[08:57:11][ 12272| 11200] checkOTGWcmd(1076): CmdQueue: Found value [ 16.80]==>[0]:[TT=16.8]
[08:57:11][ 12272| 11200] checkOTGWcmd(1077): CmdQueue: Remove from queue [0]:[TT=16.8] from queue
[08:57:11][ 12944| 11200] checkOTGWcmd(1079): CmdQueue: Moving [1] => [0]
from otgw-firmware.
Thanx for your reply,
1st about my setup:
I use the NodoShop OTGW with an Nodemcu v2.
Than I use a Ubuntu server running Mosquitto and other services like Apache Postfix etc..
And I have a separate Ubuntu server running Home Assistant. But for testing purposes I have shut down this server to prevent it from interfering the test. (This is where the PR responses initiated from. I think the OpenTherm integration in Home Assistant (via socket connection)).
In the server running Mosquitto I am running a script witch reads the outside temperature every 5 min and sends it via a Socket connection to the Nodemcu. (this works perfect as you can see in the log at timestamp: [00:01:40]
But commands added via MQTT are not processed en stays in the queue even after 20 minutes of waiting.
The 20sec delay is no problem to me.
I have attached the log so your can look into it.
It starts with the incoming MQTT command and it is about 65 sec long. And a snippet about 20 minutes later where you can see the command is still in the queue.
Hopefully you can help me out on this.
from otgw-firmware.
@jvinckers thanks for sharing the log, now that's a very weird condition, as the command is due, but does not execute for some reason. So you are write, this seems to be a bug. I will look in more detail tonight.
from otgw-firmware.
@jvinckers seems that you have hit a bug indeed. I seem to have used now() where I planned to use millis(). Most cases this seems to work, but not always. Thus this is bug in need of fixing. Can you validate my build when I have tested it myself?
from otgw-firmware.
I just uploaded a dev build to the discord, so just pick it up there.
Discord invite: https://discord.gg/zjW3ju7vGQ
from otgw-firmware.
Also tested in HomeAssistant with a climate card based on the MQTT topics and it is running great!
from otgw-firmware.
Fixed with release v0.8.5
from otgw-firmware.
Related Issues (20)
- Settings menu not loading HOT 6
- Home Assistant 20223.5.0 now throwing exception HOT 21
- Web Interface 'PIC firmware' view empty after firmware upgrade HOT 1
- Domoticz gives multiple Connection reset messages HOT 4
- Cannot upgrade firmware HOT 1
- MQTT hotwater settopic value description incorrect HOT 1
- Home Assistant mqtt errors HOT 1
- Web UI Gateway Mode always false HOT 2
- Adding commands to serial data causes problems with native HA integration HOT 1
- OTGW OTA firmware upgrade failed HOT 2
- OTGW HW reboot cause: Exception (2) - Access to invalid address (29) HOT 2
- Ping problems HOT 10
- OTGW connection is lost HOT 10
- Feature: expose current DHW tank temperature to MQTT HOT 2
- Status_master expected to be numeric by Home Assistant HOT 6
- Report return water temperature from OTGW using MQTT HOT 4
- No MQTT updates after reboot HA or Domoticz HOT 5
- RelModLevel not sent over MQTT (but present in API) HOT 2
- Gateway stops working after a few days of not being used HOT 18
- Firmware of V2 hardware HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otgw-firmware.