OWTCL(3)
π NAME π
Owtcl β OWFS library access commands for Tcl. Yep, that's the whole vibe: it's OWTCL(3), from the Library Functions Manual, and it's here to let your Tcl scripts talk to 1-wire stuff π¦
β¨ SYNOPSIS β¨
package require ow
ow option ?arg ...?
::OW::init interface ?interface ...? ?arg ...?
::OW::finish
::OW::isconnect
::OW::get ?path? ?arg ...?
::OW::put path ?value?
::OW::isdirectory path
::OW::isdir path
::OW::exists path
π DESCRIPTION π
π 1-Wire π
1-wire is a wiring protocol and a whole series of devices, designed and manufactured by Dallas Semiconductor, Inc. It's giving low-power, low-speed, low-connector β the bus is literally so minimal that the data line can also hand out power. Main character energy for a cable π₯
Every single device is uniquely and unalterably numbered during manufacture. No duplicates, no take-backs, no cap. And the family is huge: memory, sensors (humidity, temperature, voltage, contact, current), switches, timers and data loggers. You can build more complex devices (like thermocouple sensors) out of these basic ones. There are even 1-wire devices that have encryption built in π
The 1-wire scheme uses a single bus master and multiple slaves on the same wire. The bus master initiates all communication β it's the one holding the aux, periodt. The slaves can be individually discovered and addressed using their unique ID.
Bus masters come in a variety of configurations, including serial, parallel, i2c, network or USB adapters πΈ
π§ OWFS design π§
OWFS</purpose> is a suite of programs designed to make the 1-wire bus and its devices easily accessible. The underlying principle is to create a virtual filesystem, where the unique ID is the directory, and the individual properties of the device are represented as simple files you can read and write. It's giving "everything is a file" and honestly? Iconic π
Details of the individual slave or master design are hidden behind a consistent interface. The goal is to provide an easy set of tools for a software designer to create monitoring or control applications. There are some performance enhancements in the implementation, including data caching, parallel access to bus masters, and aggregation of device communication. But the fundamental goal has been ease of use, flexibility and correctness rather than speed. Not everything has to be a speedrun, bestie π«Ά
πΈ owtcl πΈ
owtcl (3) is a Tcl extension that provides an interface to OWFS. The underlying interface to the 1-wire bus is identical to owfs (1) (filesystem view) and owhttpd (1) web server interface. Only the top layer has been modified to return native Tcl data β¨
π COMMANDS π
Performs one of several operations, depending on option. The legal options (which may be abbreviated) are:
ow open arg ...β Connect to a 1-wire adapter orowserver. Thearg ...defines the way of connecting to the 1-wire bus. The full set of initialization args is extensive β they correspond roughly to the command line args ofowfs(1),owhttpd(1) andowftpd(1).ow closeβ Close the connection to the 1-wire bus orowserver. Bye bestie πow version ?-list?β Return the version of theowtclandowlib/.ow openedβ Return1if connected to a 1-wire adapter orowserver, otherwise0.ow error level valueβ Set debug options. Seeowfs(5).ow error print valueβ Set debug options. Seeowfs(5).ow get path ?-list?β Returns the contents of the OWFS directory as a list if path contains the name of an OWFS directory. If path is the name of an OWFS file, returns the contents of this file. For files*.ALLreturns a values list.ow put path valueβ Puts value in the OWFS file indicated in path. For files*.ALLuse a value list.ow isdirectory pathβ If path is a directory, return1. Otherwise return0.ow isdir pathβ Synonym ofow isdirectory.ow set pathβ Creates a new ow-like command with root in the path. A new command allows optionsget,put,isdirectory,isdirandset.
π LOW-LEVEL COMMANDS π
The following low-level commands are possible:
::OW::init interface ?interface ...? ?arg ...?β Connect to a 1-wire adapter orowserver. interface andarg ...define the way of connecting to the 1-wire bus. The full set of initialization options is extensive β they correspond roughly to the command line options of,Bowfs(1),owhttpd(1) andowftpd(1). (Yes, the,Bis literally in the original. We don't ask questions π)::OW::finishβ Close the connection to the 1-wire bus orowserver.::OW::isconnectβ Return1if connected to a 1-wire adapter orowserver, otherwise0.::OW::get ?path? ?-list?β Returns the contents of the OWFS directory as a list if path contains the name of an OWFS directory. If path is the name of an OWFS file, returns the contents of this file. For files*.ALLreturns a values list. If path is not defined, the contents of the root OWFS directory come back.::OW::put path ?value?β Puts value in the OWFS file indicated in path. For files*.ALLuse a value list. If value is not defined, puts an empty string.::OW::isdirectory pathβ If path is a directory, return1. Otherwise return0.::OW::isdir pathβ Synonym of::OW::isdirectory.::OW::exists pathβ If path exists, return1. Otherwise return0.
β EXAMPLE β
package require ow
ow open -d /dev/ttyS0 -t 60
set save_templow [ow get /28.86BF80000000/templow]
ow put /28.86BF80000000/templow 10
set room_sensor [ow set /28.86BF80000000]
$room_sensor put temphigh 50
set room_temp [$room_sensor set temperature]
set current_temp [$room_temp get]
Look at that. Nested command handles going full inception and it works. Ate π
π¦ SEE ALSO π¦
Programs
owfs (1) owhttpd (1) owftpd (1) owserver (1) owdir (1) owread (1) owwrite (1) owpresent (1) owtap (1)
Configuration and testing
owfs (5) owtap (1) owmon (1)
Language bindings
owtcl (3) owperl (3) owcapi (3)
Clocks
DS1427 (3) DS1904(3) DS1994 (3) DS2404 (3) DS2404S (3) DS2415 (3) DS2417 (3)
ID
DS2401 (3) DS2411 (3) DS1990A (3)
Memory
DS1982 (3) DS1985 (3) DS1986 (3) DS1991 (3) DS1992 (3) DS1993 (3) DS1995 (3) DS1996 (3) DS2430A (3) DS2431 (3) DS2433 (3) DS2502 (3) DS2506 (3) DS28E04 (3) DS28EC20 (3)
Switches
DS2405 (3) DS2406 (3) DS2408 (3) DS2409 (3) DS2413 (3) DS28EA00 (3)
Temperature
DS1822 (3) DS1825 (3) DS1820 (3) DS18B20 (3) DS18S20 (3) DS1920 (3) DS1921 (3) DS1821 (3) DS28EA00 (3) DS28E04 (3)
Humidity
DS1922 (3)
Voltage
DS2450 (3)
Resistance
DS2890 (3)
Multifunction (current, voltage, temperature)
DS2436 (3) DS2437 (3) DS2438 (3) DS2751 (3) DS2755 (3) DS2756 (3) DS2760 (3) DS2770 (3) DS2780 (3) DS2781 (3) DS2788 (3) DS2784 (3)
Counter
DS2423 (3)
LCD Screen
LCD (3) DS2408 (3)
Crypto
DS1977 (3)
Pressure
DS2406 (3) -- TAI8570
π AVAILABILITY π
π AUTHOR π
Serg Oskin (serg@oskin.ru)
and that's a wrap, bestie β¨ this page came from the Tcl manual, dated 2005-01-20, and it's filed under OWTCL(3). go read some sensors, you got this π«Άπ
π¦ where this page comes from
- debian bookworm: libow-tcl 3.2p4+dfsg1-4.1+b1 Β· GPL-2.0-only
- debian trixie: libow-tcl 3.2p4+dfsg1-6 Β· GPL-2.0-only
- ubuntu jammy: libow-tcl 3.2p4+dfsg1-4build5 Β· GPL-2.0-only
- ubuntu noble: libow-tcl 3.2p4+dfsg1-4.3build2 Β· GPL-2.0-only
- ubuntu questing: libow-tcl 3.2p4+dfsg1-6
- ubuntu resolute: libow-tcl 3.2p4+dfsg1-7 Β· GPL-2.0-only
- ubuntu stonking: libow-tcl 3.2p4+dfsg1-7build1 Β· GPL-2.0-only
- Copyright (c) 2003-2004 Paul H Alfille, MD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms