Skip to content
This repository was archived by the owner on Dec 31, 2019. It is now read-only.

Commit 8f3b4b1

Browse files
committed
Merge branch 'beta'
2 parents c65a068 + f386d97 commit 8f3b4b1

File tree

129 files changed

+36661
-15810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+36661
-15810
lines changed

1w.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

1w_d.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python
2+
3+
# This file is part of Openplotter.
4+
# Copyright (C) 2015 by sailoog <https://github.com/sailoog/openplotter>
5+
#
6+
# Openplotter is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 2 of the License, or
9+
# any later version.
10+
# Openplotter is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with Openplotter. If not, see <http://www.gnu.org/licenses/>.
17+
18+
import socket, time, platform
19+
if platform.machine()[0:3]!='arm':
20+
print 'this is not a raspberry pi -> no W1ThermSensor'
21+
else:
22+
from w1thermsensor import W1ThermSensor
23+
from classes.conf import Conf
24+
25+
conf = Conf()
26+
27+
try:
28+
sensors_list=eval(conf.get('1W', 'DS18B20'))
29+
except: sensors_list=[]
30+
31+
if sensors_list:
32+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
33+
sensors=[]
34+
sensors_list2=[]
35+
for item in sensors_list:
36+
try:
37+
type=W1ThermSensor.THERM_SENSOR_DS18B20
38+
for sensor in W1ThermSensor.get_available_sensors():
39+
if item[2] == sensor.id:
40+
type = sensor.type
41+
sensors.append(W1ThermSensor(type, item[2]))
42+
sensors_list2.append(item)
43+
except Exception,e: print str(e)
44+
45+
while True:
46+
time.sleep(0.1)
47+
list_signalk=[]
48+
ib=0
49+
for i in sensors_list2:
50+
try:
51+
temp=sensors[ib].get_temperature(W1ThermSensor.KELVIN)
52+
temp_offset=temp+float(i[3])
53+
value=str(temp_offset)
54+
path=i[1]
55+
name=i[0]
56+
SignalK='{"updates":[{"$source":"OPsensors.1W.'+name+'","values":[{"path":"'+path+'","value":'+value+'}]}]}\n'
57+
sock.sendto(SignalK, ('127.0.0.1', 55557))
58+
except Exception,e: print str(e)
59+
ib=ib+1

0 commit comments

Comments
 (0)