--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/99b2497c-f6f6-477c-afd2-2f408aeab2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
val = 1.23456node.warn (msg);msg['payload'] = valreturn msgI am using mqtt now to send the message but it's on the same Pi. And it says it lost connection and can't reconnect so I will try both you examples and send what's best.
Tanks both of you.
I am using mqtt now to send the message but it's on the same Pi. And it says it lost connection and can't reconnect so I will try both you examples and send what's best.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send an email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/d2058801-8b67-4d4c-8256-9d6c9ed7a5d6%40googlegroups.com.
In that case fix the mqtt problem. Have you got two clients connected with the same client ID? That will cause connection problems.Colin
On 26 Jan 2018 6:50 a.m., "Christian de Lasson" <christianr...@gmail.com> wrote:
Tanks both of you.
I am using mqtt now to send the message but it's on the same Pi. And it says it lost connection and can't reconnect so I will try both you examples and send what's best.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/790fcf29-33a6-4a80-a552-9d450212788b%40googlegroups.com.
import timeimport sysimport paho.mqtt.client as mqttfrom hx711 import HX711
def cleanAndExit(): client.disconnect(); print "Cleaning..." GPIO.cleanup() print "Bye!" sys.exit()
hx = HX711(23, 24)hx.set_reading_format("LSB",)
hx.set_reference_unit(-921)
hx.reset()hx.tare()
client = mqtt.Client()client.connect("192.168.1.3",1883)
while True: try: val = hx.get_weight(5) print val
client.publish("V/G", str(val), qos=1);