Skip to content

One wire timing #131

@jeff-at-theranch

Description

@jeff-at-theranch

Board Type

Raspberry Pi4

Operating System

Raspbian

Swift Version

version 5.3.3

Description

I have a number of 1-wire sensor (as well as a 10 channel GPIO relay board), the issue is, I read the unwire temps every few minutes I call the getsalves function, and it looks like between the time I get the devices and then read them they are not in the w1/devices directory, I am guessing they are being updated.

checkOneWireTemps <- my function

mySensors = ["28-3c01b607c42c", "28-3c01b607e11a", "28-3c01b6070726", "28-3c01b607bee2", "28-3c01b607e2e6", "28-3c01b607ad96", "28-3c01b6070ed6", "28-3c01b607b037", "28-3c01b607dbb6", "28-3c01b607a9f6", "28-3c01b607b0cf"]

and as I iterate through them:

x = 28-3c01b607c42c
y = ["6e 02 55 05 7f a5 a5 66 6d : crc=6d YES", "6e 02 55 05 7f a5 a5 66 6d t=38875"]
insert into onewiretemps values ( now(), '28-3c01b607c42c', '38.875' )
x = 28-3c01b607e11a
y = ["30 02 55 05 7f a5 a5 66 c9 : crc=c9 YES", "30 02 55 05 7f a5 a5 66 c9 t=35000"]
insert into onewiretemps values ( now(), '28-3c01b607e11a', '35.0' )
x = 28-3c01b6070726
y = ["5b 02 55 05 7f a5 a5 66 c7 : crc=c7 YES", "5b 02 55 05 7f a5 a5 66 c7 t=37687"]
insert into onewiretemps values ( now(), '28-3c01b6070726', '37.687' )
x = 28-3c01b607bee2
y = ["90 01 55 05 7f a5 a5 66 b4 : crc=b4 YES", "90 01 55 05 7f a5 a5 66 b4 t=25000"]
insert into onewiretemps values ( now(), '28-3c01b607bee2', '25.0' )
x = 28-3c01b607e2e6
y = ["3b 02 55 05 7f a5 a5 66 26 : crc=26 YES", "3b 02 55 05 7f a5 a5 66 26 t=35687"]
insert into onewiretemps values ( now(), '28-3c01b607e2e6', '35.687' )
x = 28-3c01b607ad96
y = ["43 02 55 05 7f a5 a5 66 b9 : crc=b9 YES", "43 02 55 05 7f a5 a5 66 b9 t=36187"]
insert into onewiretemps values ( now(), '28-3c01b607ad96', '36.187' )
x = 28-3c01b6070ed6
y = ["40 02 00 00 1f 00 00 00 91 : crc=91 YES", "40 02 00 00 1f 00 00 00 91 t=36000"]
insert into onewiretemps values ( now(), '28-3c01b6070ed6', '36.0' )
x = 28-3c01b607b037
Couldn't open 1-Wire device: /sys/bus/w1/devices/28-3c01b607b037/w1_slave: No such file or directory
Aborted

and seconds later :

pi@raspberrypi:~/Developer/myHome2 $ l /sys/bus/w1/devices/
total 0
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b6070726 -> ../../../devices/w1_bus_master1/28-3c01b6070726/
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b6070ed6 -> ../../../devices/w1_bus_master1/28-3c01b6070ed6/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b6076217 -> ../../../devices/w1_bus_master1/28-3c01b6076217/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b6079c5e -> ../../../devices/w1_bus_master1/28-3c01b6079c5e/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607a9f6 -> ../../../devices/w1_bus_master1/28-3c01b607a9f6/
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b607ad96 -> ../../../devices/w1_bus_master1/28-3c01b607ad96/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607b037 -> ../../../devices/w1_bus_master1/28-3c01b607b037/
lrwxrwxrwx 1 root 0 Jan 20 08:48 28-3c01b607b0cf -> ../../../devices/w1_bus_master1/28-3c01b607b0cf/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607b7b5 -> ../../../devices/w1_bus_master1/28-3c01b607b7b5/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607bac1 -> ../../../devices/w1_bus_master1/28-3c01b607bac1/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607bed9 -> ../../../devices/w1_bus_master1/28-3c01b607bed9/
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b607bee2 -> ../../../devices/w1_bus_master1/28-3c01b607bee2/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607c18d -> ../../../devices/w1_bus_master1/28-3c01b607c18d/
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b607c42c -> ../../../devices/w1_bus_master1/28-3c01b607c42c/
lrwxrwxrwx 1 root 0 Jan 20 08:46 28-3c01b607dbb6 -> ../../../devices/w1_bus_master1/28-3c01b607dbb6/
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b607e11a -> ../../../devices/w1_bus_master1/28-3c01b607e11a/
lrwxrwxrwx 1 root 0 Jan 20 08:42 28-3c01b607e2e6 -> ../../../devices/w1_bus_master1/28-3c01b607e2e6/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607ed43 -> ../../../devices/w1_bus_master1/28-3c01b607ed43/
lrwxrwxrwx 1 root 0 Jan 20 08:47 28-3c01b607fcfb -> ../../../devices/w1_bus_master1/28-3c01b607fcfb/
lrwxrwxrwx 1 root 0 Jan 20 08:34 w1_bus_master1 -> ../../../devices/w1_bus_master1/

I think you need add a catch when opening the file, just in case it doesn't exist at the time of reading.

In the meantime, I'll just use the file system to read them.

Thanks for everything else using the lib to control/check the relays.

j.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions