-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(properties): add barometric pressure property
- Loading branch information
1 parent
5ef8c12
commit b610203
Showing
7 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef AIRLY_INCLUDE_AIRLY_PROPERTIES_BAROMETRIC_PRESSURE_H_ | ||
#define AIRLY_INCLUDE_AIRLY_PROPERTIES_BAROMETRIC_PRESSURE_H_ | ||
|
||
/* Config for WebThings framework */ | ||
#include <WebThingConfig.h> | ||
|
||
/* WebThings framework */ | ||
#include <Thing.h> | ||
|
||
void describeBarometricPressureProperty(ThingDevice* device); | ||
void setBarometricPressureProperty(const float barometricPressure); | ||
|
||
#endif // AIRLY_INCLUDE_AIRLY_PROPERTIES_BAROMETRIC_PRESSURE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <airly/properties/Humidity.h> | ||
|
||
/* AVR low-level */ | ||
#include <avr/pgmspace.h> | ||
|
||
/* Preprocessor-based localization */ | ||
#include <airly/I18n.h> | ||
|
||
// -------------------------------------------------------------------------- // | ||
// Property: Barometric pressure (hPa) | ||
// -------------------------------------------------------------------------- // | ||
#if defined(THING_HAS_BME280) | ||
|
||
static const char* propertyId PROGMEM = "barometricPressure"; | ||
static ThingProperty property(propertyId, | ||
i18n::BarometricPressurePropertyDescription, | ||
NUMBER, "BarometricPressureProperty"); | ||
|
||
void describeBarometricPressureProperty(ThingDevice* device) { | ||
property.title = i18n::BarometricPressurePropertyTitle; | ||
property.unit = "hectopascal"; | ||
property.minimum = 300; | ||
property.maximum = 1100; | ||
property.readOnly = true; | ||
|
||
device->addProperty(&property); | ||
} | ||
|
||
void setBarometricPressureProperty(const float barometricPressure) { | ||
auto hectopascals = barometricPressure / 100; | ||
property.setValue({.number = hectopascals}); | ||
} | ||
|
||
#endif | ||
// -------------------------------------------------------------------------- // |