123
Senior Member
I thought the community might pool their knowledge and help kmitchell create a driver for the TEMP08. Providing 1-wire support for Premise would be a major contribution. Building a Module-based driver is a useful skill and I hope this thread will help others gain a better understand of the design process.
I don't have a TEMP08 but I had a quick look at its command set (page 9) and a sample program in VBScript. Here are my thoughts:
I don't have a TEMP08 but I had a quick look at its command set (page 9) and a sample program in VBScript. Here are my thoughts:
- One parent and many children
The driver would consist of a Parent object (handles serial communications and global TEMP08 settings) and Child objects (individual 1-wire devices). - Children inherit from existing Premise classes
Each Child object inherits an existing Premise Home class that best defines the Child's purpose. A DS18S20 Temperature Sensor would be represented by the TemperatureSensor class, a DS2438 Humidity Sensor by the HumiditySensor class, and a DS2450 Voltage Sensors by the AnalogInput class. Some 1-wire devices, like the DS2423 Lightning counter, do not have corresponding Premise classes. The driver may have to create a corresponding Premise Home class. - Parent: TEMP08 class
The TEMP08 class will have several properties than control the physical TEMP08's operation. For example, the TEMP08 has an adjustable polling interval for reporting back the status of attached devices ("PollingInterval": Integer Value). It can also display temperatures in Fahrenheit or Celsius ("TemperatureScale": MultiValue) and set its internal clock ("ClockSync": Boolean, sync to PC's clock). - Child: 1-wire Device class
Each child object inherits from a base class (PremiseOneWireDevice or "POWDevice") that holds, at minimum, the 1-wire device's serial number. - Auto-Discovery
The driver can use this to "discover" what's connected and automatically generate the appropriate POWDevices. - Auto-Removal
The TEMP08 reports when a 1-wire device is removed. Handling this condition requires making a design decision. If the physical 1-wire device is gone, should the driver automatically remove the POWDevice? Or should it set some property in POWDevice ("Status" or "Enabled") to indicate there's a problem? Removing the dead POWDevice is simple and quick but it may be an overkill if the physical 1-wire device simply suffered a momentary hiccup and comes back to life on the next polling cycle. Alternately, the driver could indicate a problem only after the third consecutive report that the physical device is missing (assuming the TEMP08 reports a missing device more than once). - Watchdog
The TEMP08 can be set to report the status of all devices every few seconds. A Watchdog timer should be reset each time the status report arrives. If the Watchodog is allowed to run out, it indicates a status report failed to arrive and it may indicate the TEMP08 has failed or is disconnected. The Watchodog should indicate the problem (perhaps via an "Enabled" Boolean property in the TEMP08 class) and reset itself.