Class: Tinkerforge::BrickletAirQuality
- Inherits:
-
Object
- Object
- Tinkerforge::BrickletAirQuality
- Defined in:
- lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.rb
Instance Method Summary collapse
-
#qff(altitude) ⇒ Object
Returns the derived air pressure at sea level.
-
#state ⇒ Object
Returns the device’s state.
Instance Method Details
#qff(altitude) ⇒ Object
Returns the derived air pressure at sea level.
Air pressure is derived from:
-
air pressure as measured by the Bricklet itself
-
temperature as measured by the Bricklet itself
-
altitude of the Bricklet’s location (meter)
With help from:
28 29 30 31 |
# File 'lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.rb', line 28 def qff(altitude) # QFE / [1 - Tg * H / (273.15 + Tfe + Tg * H)] ^ (0.034163 / Tg) (get_air_pressure / (1 - 0.0065 * altitude / (273.15 + (get_temperature * 0.01) + 0.0065 * altitude)) ** (0.034163 / 0.0065)).round end |
#state ⇒ Object
Returns the device’s state.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.rb', line 6 def state av = get_all_values super.merge( 'iaq_index' => av[0], 'iaq_index_accuracy' => av[1], 'temperature' => av[2], 'temperature_offset' => get_temperature_offset, 'humidity' => av[3], 'air_pressure' => av[4], ) end |