Skip to content

Commit

Permalink
docu
Browse files Browse the repository at this point in the history
  • Loading branch information
mathertel committed Sep 7, 2024
1 parent 4292c6a commit 9095190
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dev/elementclass.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,18 @@ This method is implemented in the base Element class and stores the passed board
to enable participating in sending actions and other board functionality.


### set() - setting properties and receiving actions
### set(key, value) - setting properties and receiving actions

When the Element is crated and even later when a action is send to the Element a key and value is passed in the `set` function.
This is the the only function that needs to process incoming data.
It checks the passed key and then takes the data or executes the action.

Some Element implementations will only require to implement the setting parameters given from the configuration and others also may react to actions to trigger a functionality or to modify a dynamic property of the Element.

The key parameter is passed as a const char pointer and is always converted to lowercase.

When it is one of the most used keys the char pointer can be used for pointer comparison as it is looked up in the actions set. This speeds up the overall processing of actions.

The set function must return `true` when a property is known to the element and was handled.


Expand Down
1 change: 1 addition & 0 deletions elements/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ some common implementation to allow gathering values on a regular basis and upda
{{ elemCard("pms") }}
{{ elemCard("bmp280") }}
{{ elemCard("bl0937", "no") }}
{{ elemCard("scd4x", "no") }}

<!-- TODO: element bme280 bme280 -->

Expand Down
16 changes: 16 additions & 0 deletions elements/scd4x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: SCD4x Element for CO2 Sensors
icon: no
tags: ["Element", "Sensor", "WIP"]
layout: "page.njk"
excerpt: >
The SCD40 and SCD41 sensors from sensirion are available on breakout boards to meassure the CO2 in the air by providing values in ppm units.
---

The sensor chips are pre-adjusted to offer reasonable output values.
For providing exact values the temperature and humidity is measured and available as well.

The SCD40 and SCD41 sensors differ in resolution and the single measurement mode is only supported by the SCD41 version.

Both sensors are using the I2C bus for communication and the SCD4XElement implementation allows configuration
and creating actions by reading probe values from the sensors.
1 change: 1 addition & 0 deletions elements/sensors.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The HomeDing library supports a collection of common sensor chips:
* [PMS Element](/elements/pms.md) supports the PMS5003 sensor by plantdata to count micro particles in the air.
* [INA219 Element](/elements/ina219.md) using the INA219 power consumption chip.
* [INA226 Element](/elements/ina226.md) using the INA219 power consumption chip.
* [SCD4x Element](/elements/scd4x.md) supports the scd4x CO2 Sensors.


## Common Sensor Implementation
Expand Down

0 comments on commit 9095190

Please sign in to comment.