ex_co2_mini v0.1.0 ExCO2Mini.Collector

Collects data packets from a ExCO2Mini.Reader instance and provides simple on-demand access to CO2 and temperature data.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Returns the CO2 concentration, in parts per million (ppm)

Creates a process to collect data

Returns the ambient temperature, in degrees centigrade (°C)

Link to this section Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Returns the CO2 concentration, in parts per million (ppm).

Link to this function

start_link(opts)

Creates a process to collect data.

opts is a keyword list. It accepts all of the options that GenServer.start_link/3 does, as well as the following:

  • opts[:reader] (required) — The PID or name (atom) of a ExCO2Meter.Reader process.

  • opts[:subscribe_as_name] — If true, then opts[:name] must be included as well. The collector will subscribe using its name rather than PID.

    • This can be useful in preventing the ExCO2Mini.Reader process from accumulating defunct subscriptions if this collector is restarted repeatedly.

Returns {:ok, pid} once the collector has been successfully started and has subscribed to the reader.

Link to this function

temperature(pid)

Returns the ambient temperature, in degrees centigrade (°C).