When using the one wire system I had a problem with some sensors not showing up on the device list - but were definitely listed in the code with their 12 digit unique identification . After much research the cause of the problem is that Domoticz apparently only discriminates between the devices using the last 4 digits. I had bought 20 devices, all unique but with identical last 4 digits. I then bought a further two only to find they too had the same four digits. I suspect that this is because they were all in the same manufacturing run.
Is there a way to identify the 12 digits and resolve the problem?
TEMPERATURE SENSING
Moderators: leecollings, remb0
-
- Posts: 1
- Joined: Thursday 05 May 2022 13:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TEMPERATURE SENSING
I do have the same problem, I bought 10 DS18B20 sensors, and all of them are identical on the last 6 characters.
Is there a "workaround"?
Dietmar
Is there a "workaround"?
Dietmar
-
- Posts: 27
- Joined: Friday 19 October 2018 18:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: TEMPERATURE SENSING
i use a python3 script: (originally used on 2 ds18b)
Code: Select all
import os
import glob
import time
from datetime import datetime
import urllib.request
########################
# Set up all variables #
########################
#allows use of the sensors
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
#initialize variables for counting hot readings
i1 = 0
#insert device serial numbers here
#sn2 = '28-3c01b55624db'
sn1 = '28-3c01b5562afc'
#initialize all of the directories for the sensors
device_file1 = glob.glob(base_dir + sn1)[0] + '/w1_slave'
idx1 = 3
url_json1 = "http://192.168.1.154:8080/json.htm?type=command¶m=udevice&idx="
idx2 = 122
url_json2 = "http://192.168.1.150:8080/json.htm?type=command¶m=udevice&idx="
################################
# Routines to read each sensor #
################################
#Read Sensor 1
def read_temp_raw1():
f = open(device_file1, 'r')
lines1 = f.readlines()
f.close()
return lines1
def read_temp1():
lines1 = read_temp_raw1()
while lines1[0].strip()[-3:] != 'YES':
time.sleep(0.2)
lines1 = read_temp_raw1()
equals_pos = lines1[1].find('t=')
if equals_pos != -1:
temp_string1 = lines1[1][equals_pos+2:]
temp_c1 = float(temp_string1) / 1000.0
temp_f1 = temp_c1 * 9.0 / 5.0 + 32.0
return temp_c1
#############
# Main Loop #
#############
while True:
temp1 = read_temp1()
print('temp1 '+str(temp1))
# cmd1 = url_json1 + str(idx1) + "&nvalue=0&svalue=" + str(temp1)
# hf1 = urllib.request.urlopen(cmd1)
# hf1.close
# time.sleep(1)
cmd2 = url_json2 + str(idx2) + "&nvalue=0&svalue=" + str(temp1)
hf2 = urllib.request.urlopen(cmd2)
hf2.close
time.sleep(1)
time.sleep(10)
Who is online
Users browsing this forum: No registered users and 1 guest