Posts: 1,199
Threads: 101
Joined: Mar 2016
Reputation:
71
What do I put into the short and topic fields so ds18b20 sensor data will get send over mqtt? I know the answer is in the web somewhere, I've had it working before, just can't find it now.
Thanks
Sent from my SGP511 using Tapatalk
Posts: 2,893
Threads: 59
Joined: Mar 2016
Reputation:
278
2016-04-28, 10:10 AM
(This post was last modified: 2016-04-28, 10:11 AM by Sailoog.)
1W
Short: sensor1
MQTT
topic: temp/coolant
ACTIONS
Trigger: None (always true)
Action: - Publish on topic temp/coolant
- [sensor1]
- repeat after 10
- seconds
When you define a short name for switches, outputs, 1W sensors... you will be able to call the current value anywhere putting it between brackets: [sensor1]
Posts: 1,199
Threads: 101
Joined: Mar 2016
Reputation:
71
Great, back in again. Thanks.
Sent from my SGP511 using Tapatalk
Posts: 16
Threads: 4
Joined: Apr 2016
Reputation:
0
Hi Sailoog,
I verified this case using a frequence of 60 secs, but seems that for each event mqtt receives 2 messages.
Moreover for each message it is opened a new TCP socket. In this way I have a lot of tcp sockets opened (those sockets are closed only by timeout condition)
Is it the behaviour expected?
Checking configuration and logs I have:
ds18b20 = [['18DS20std', 't18std0', 'C', '000003e16e42', '1W0', '1'], ['18DS20imp', 't18imp2', 'C', '800000035457', '1W1', '1'], ['intDSstd4', 't18std4', 'C', '000003e13053', '1W2', '1']]
topics = [['tmp', 'temp/int4', 'MQTT0']]
triggers = [[1, -1, -1, -1, [['HOUT0', '', 0.0, 0]]], [1, -1, -1, -1, [['MQTT0', '[t18std4]', 1.0, 2]]]]
from mosquitto.log:
1462282427: New connection from 127.0.0.1 on port 1883.
1462282427: New client connected from 127.0.0.1 as paho/0D56FD3D31FE699C3A (c1, k60, umqttpi).
1462282427: New connection from 127.0.0.1 on port 1883.
1462282427: New client connected from 127.0.0.1 as paho/46C1713D7C0F644F27 (c1, k60, umqttpi).
...
1462283479: Socket error on client paho/373C43968871DDD006, disconnecting.
1462283479: Socket error on client paho/5D9F2F7DC7D704C251, disconnecting.
Thanks in advance
Davide
Posts: 2,893
Threads: 59
Joined: Mar 2016
Reputation:
278
Yes, we set 2 brokers, local and remote, so each event could be received by clients connected to remote server and clients connected to OP server simultaneously.
We are using the publish.single function: https://github.com/eclipse/paho.mqtt.python#single
Quote:Publish a single message to a broker, then disconnect cleanly
Do you think this is not happening?
Posts: 16
Threads: 4
Joined: Apr 2016
Reputation:
0
(2016-05-03, 05:54 PM)Sailoog Wrote: Yes, we set 2 brokers, local and remote, so each event could be received by clients connected to remote server and clients connected to OP server simultaneously.
We are using the publish.single function: https://github.com/eclipse/paho.mqtt.python#single
Quote:Publish a single message to a broker, then disconnect cleanly
Do you think this is not happening?
Opps, my mistake,
I didn't read your code and I configured remote broker as local....
About timeout tcp socket it seems the keepalive option doesn't work very well, I need to double check the log.
Thanks
Davide
Posts: 2,893
Threads: 59
Joined: Mar 2016
Reputation:
278
This happens because we don't have a good documentation I hope to have time after v0.8.0 release.
You are right, keepalive variations doesn't make change, it doesn't work or we are misunderstanding its purpose. AFAIK you can define timeout when make a normal connection but not in publish.single function.
Anyway, after doing some test, my number of sockets is high but stable, they born and die, and it seems that doesn't affect performance. Many of open sockets belong to kplex and internal OP jobs (sensors, calculations...). I need to test with a really high number of mqtt topics and publications to see if the system endures or we have to change strategy.
Thanks Davide, you are being really helpful debugging OP
|