Owtcl(TCL)

🌸 Owtcl 🌸

okay bestie, welcome to the Owtcl(TCL) manual page β€” yes that's the manual name, it's giving "Tcl extension that talks to 1-wire stuff" and honestly? iconic. sit down, grab a boba, we're doing this πŸ’–


✨ NAME ✨

Owtcl β€” OWFS library access commands for Tcl. that's it, that's the name, slay.


✨ 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

so 1-wire is a wiring protocol AND a whole family of devices designed and manufactured by Dallas Semiconductor, Inc. the bus is a low-power, low-speed, low-connector scheme where the data line can also provide power. one wire doing the absolute most, we love a multitasker πŸ’…

every single device gets uniquely and unalterably numbered during manufacture. no takebacks, no edits, the number is forever. there's a whole buffet of devices β€” memory, sensors (humidity, temperature, voltage, contact, current), switches, timers, data loggers. and if you want to get fancy, more complex devices (like thermocouple sensors) can be built out of these basic devices. some 1-wire devices even have encryption baked in πŸ”

the scheme uses a single bus master and multiple slaves on the same wire. the bus master initiates all communication, main character energy fr. 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. so many vibes, so many options πŸ¦‹

πŸ—‚οΈ OWFS design

OWFS 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 that you can read and write. literally the cutest abstraction, no cap.

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 too, including data caching, parallel access to bus masters, and aggregation of device communication. but the fundamental goal has always been ease of use, flexibility and correctness rather than speed. periodt.

🧚 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. glow up complete ✨


✨ 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 or owserver. arg ... defines a way of connection to the 1-wire bus. the full set of initialization args is extensive. they correspond roughly to the command line args of owfs (1), owhttpd (1) and owftpd (1).
  • ow close β€” close connection to 1-wire bus or owserver. bye bestie 🫢
  • ow version ?-list? β€” return version of the owtcl and owlib/
  • ow opened β€” return 1 if connected to 1-wire adapter or owserver, otherwise 0.
  • ow error level value β€” set debug options. see owfs (5).
  • ow error print value β€” set debug options. see owfs (5).
  • ow get path ?-list? β€” returns contents of OWFS directory as the list if path contains name OWFS directory. if path is name of OWFS file, returns of contents of this file. for files *.ALL returns a values list.
  • ow put path value β€” puts value in OWFS file indicated in path. for files *.ALL use a value list.
  • ow isdirectory path β€” if path is the directory return 1. otherwise return 0.
  • ow isdir path β€” synonym of ow isdirectory
  • ow set path β€” creates a new ow-like command with root in the path. a new command allows options get, put, isdirectory, isdir and set. nesting commands, we love recursion vibes πŸŒ€

✨ LOW-LEVEL COMMANDS ✨

the following low-level commands are possible:

  • ::OW::init interface ?interface ...? ?arg ...? β€” connect to 1-wire adapter or owserver. interface and arg ... defines a way of connection to the 1-wire bus. the full set of initialization options is extensive. they correspond roughly to the command line options of owfs (1), owhttpd (1) and owftpd (1).
  • ::OW::finish β€” close connection to 1-wire bus or owserver.
  • ::OW::isconnect β€” return 1 if connected to 1-wire adapter or owserver, otherwise 0.
  • ::OW::get ?path? ?-list? β€” returns contents of OWFS directory as the list if path contains name OWFS directory. if path is name of OWFS file, returns of contents of this file. for files *.ALL returns a values list. if path is not defined, contents of root OWFS directory come back.
  • ::OW::put path ?value? β€” puts value in OWFS file indicated in path. for files *.ALL use a value list. if value is not defined, puts a empty string.
  • ::OW::isdirectory path β€” if path is the directory β€” return 1. otherwise return 0.
  • ::OW::isdir path β€” synonym of ::OW::isdirectory
  • ::OW::exists path β€” if path is exists β€” return 1. otherwise return 0.

✨ EXAMPLE ✨

okay here's the whole thing in action, it's giving tutorial but make it cute:

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]

ate that. no crumbs. πŸ“


✨ 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 ✨

http://www.owfs.org


✨ AUTHOR ✨

Serg Oskin (serg@oskin.ru) β€” king behavior honestly πŸ‘‘


and that's the whole page bestie! this came out of the Tcl manual, dated 20/January/2005, filed under Owtcl(TCL). go forth and talk to your 1-wire devices, you've got this πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά