sensor v0.1.3 Sensor.Temp behaviour

This is an abstract temperature sensor module.

Specific types of temperature sensors can be implemented as sub-modules. If the sub-modules implement the defined behaviour, then the business logic in your app doesn’t need to care about which instance of temperature sensor is being used.

Summary

Types

t()

This type should be used by all temperature sensors to report their state

Functions

Generic sense command for any type of sensor that implements the Sensor.Temp behaviour

Will attempt to start the supervised sensor process. This sensor can later be referenced by the name parameter

Types

t()
t :: %Sensor.Temp{status: atom, unit: String.t, value: float}

This type should be used by all temperature sensors to report their state

Functions

sense(name)

Generic sense command for any type of sensor that implements the Sensor.Temp behaviour

The name paramter should correspond to the name that was defined when that sensor was started

start(module, params, name)

Will attempt to start the supervised sensor process. This sensor can later be referenced by the name parameter.

Sensor.Temp.start( Sensor.Temp.Dht, [ 11,4 ], ;temp1 )
Sensor.Temp.sense( :temp1 )

Callbacks

read(atom)
read(atom) :: Sensor.Temp.t