As Ghanima points out there are many possible approaches.
Here is one using MQTT and the Python mosquitto module.
MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity
protocol. It was designed as an extremely lightweight
publish/subscribe messaging transport.
You can have your slave Pi's publishing the temperature readings to a master device which has registered for those publications.
I have used the term master/slave but there need not be such a relationship.
In my example I have two slaves, Pis harry and tom, publishing their temperatures to a master laptop mercury.
Slave code
#!/usr/bin/env python
# 2015-04-29
# ds18b20_mq_slave.py
# Public Domain
import mosquitto
import time
import glob
import platform
node = platform.node()
mq = mosquitto.Mosquitto()
# Connect to mercury
mq.connect("mercury")
while True:
for sensor in glob.glob("/sys/bus/w1/devices/28-*"):
f = open(sensor+"/w1_slave", "r")
data = f.read()
f.close()
(discard, sep, reading) = data.partition(' t=')
temp = float(reading) / 1000.0
report = '"{}", "{:.1f}"'.format(node, temp)
print(report)
mq.publish("temp/reading", report)
time.sleep(3.0)
Master code
#!/usr/bin/env python
# 2015-04-29
# ds18b20_mq_master.py
# Public Domain
import mosquitto
import time
def on_connect(mosq, obj, msg):
print "Connected"
def on_message(mosq, obj, msg):
print ("msg={}".format(msg.payload))
mq = mosquitto.Mosquitto()
#define callbacks
mq.on_message = on_message
mq.on_connect = on_connect
#connect
mq.connect("mercury")
#subscribe to topic
mq.subscribe("temp/reading")
#keep connected to broker
while mq.loop() == 0:
time.sleep(1.0)
Typical master output
msg="harry", "16.7"
msg="tom", "17.7"
msg="harry", "16.7"
msg="tom", "17.6"
msg="harry", "16.7"