I am making heating controller to my summer cottage. I am using 1-wire DS18B20 temperature sensor which is connected to Raspberry Pi's GPIO 4. I try to start using OWFS, but I didn't get it working with temperature sensor connected straight to RPi. So I made python script which reads temperature straigt from file. Now I have problem copying temperature to smarthome. Following warning comes " temperature does not match type num".
I have same kind of problem with my knx-house copying from/to Hager thermostate.
Here is my config files:
items/smarthome.conf:
etc/logic.conf:
logics/temperature_change_lookup.py:
smarthome.py debug:
So could somebody help me what I am doing wrong!
I have same kind of problem with my knx-house copying from/to Hager thermostate.
Here is my config files:
items/smarthome.conf:
Code:
[mokki]
[[sisa]]
[[[temperature]]]
type = num
visu_acl = rw
sqlite = yes
etc/logic.conf:
Code:
[temperature_change_lookup] # checks for temperature changes filename = temperature_change_lookup.py crontab = init
logics/temperature_change_lookup.py:
Code:
#!/usr/bin/env python3
import time
while 1:
# Open the file that we viewed earlier so that python can see what is in it. Replace the serial number as before.
tfile = open("/sys/bus/w1/devices/28-000005a037fc/w1_slave")
# Read all of the text in the file.
text = tfile.read()
# Close the file now that the text has been read.
tfile.close()
# Split the text with new lines (\n) and select the second line.
secondline = text.split("\n")[1]
# Split the line into words, referring to the spaces, and select the 10th word (counting from 0).
temperaturedata = secondline.split(" ")[9]
print ("temperaturedata: ", temperaturedata) #debuging
# The first two characters are "t=", so get rid of those and convert the temperature from a string to a number.
temperature = float(temperaturedata[2:])
# Put the decimal point in the right place and display it.
temperature = temperature / 1000.0
print ("Temperature: ",temperature) #debuging
sh.mokki.sisa.temperature('temperature')
print ("sh.mokki.sisa.temperature: ",sh.mokki.sisa.temperature()) #debuging
time.sleep(10) # wait untill checks temperature again
smarthome.py debug:
Code:
2014-04-02 11:33:21,654 INFO Main Thread: Main, still alive -- smarthome.py:stop:370 temperaturedata: t=22437 Temperature: [COLOR="Red"]22.437[/COLOR] [COLOR="Red"]2014-04-02 11:33:23,033 WARNING temperature_change_lookup Item mokki.sisa.temperature: value temperature does not match type num. Via Logic None -- item.py:__update:347[/COLOR] sh.mokki.sisa.temperature: [COLOR="red"] 0[/COLOR]


Kommentar