This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mqtt setup for 1 wire ds18b20 sensors
#1
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
Reply
#2
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]
Reply
#3
Great, back in again. Thanks.

Sent from my SGP511 using Tapatalk
Reply
#4
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
Reply
#5
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?
Reply
#6
(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
Reply
#7
This happens because we don't have a good documentation Sad 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 Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)