A sensor is a device used to capture a value, by electronical means in this project.
The sensors in Ardamon are tied to a Sensor type, usually to define what kind of sensor we're talking about.
In order for Ardamon to be able to store and reuse values retrieved by sensors, the Arduino board must send them in a human readable unit. Let me explain myself : A cheap way to measure a temperature is to use a thermistor. It's a little resistor whose resisting value will change according to the temperature.
It's often used in a voltage divider. But you don't send the resistor value to Ardamon. An arduino board measure voltage coming in an analog input using steps. Each input uses 1024 steps ranging from 0 (0V) to 1023 (5V), but it's still not the value the arduino has to send to Ardamon. In order to work, Ardamon will require to receive a celcius or farenheit value in decimal form (ie : 20.5 for 20.5°C).
Therefore, the Arduino sketch will have to convert the steps value in degrees.
Ardamon is designed to be user friendly, so everything inside is expected to be expressed in human easily understandable units.
Any sensor can work both ways : most of the sensors will be used only to store values and show them in a graph, but any sensor can also be "Ardamon driven", that means that Ardamon, according to scheduled values, will ask the Arduino to take proper measures to ensure the sensor value will remain around a defined value.
Example : In a typical thermostat setting, Ardamon will have two sensors : one for the living room and one for the outside. While the outside sensor values will only be stored and displayed, we want that the living room temperature will remain around time-based values. Then we will be using schedules to program the temperature we want to have at different times and Ardamon can send back to the Arduino a message similar to 'I have received the living room temperature and right now, I want you to act so the temperature will be this value'. The Arduino board will then (if required) pilot the heater to heat the room to get to the reference temperature.
A sensor has some properties :
- A text_id value, that will be a unique name for this sensor used when receiving values from the Arduino or requesting values to set.
- A standard value. This value will be sent back to the Arduino is nothing else is changing it (level 1 regulation)
- Some schedules that will tell what value should be received at what time (example, I want to have 21°C in the room between 5PM and 11PM on mondays). This is level 2 regulation.
- An override value and expiration date that will override any other settings until the expiration date. Example : Exceptionnaly, I want to have 25°C in the room for the next 3 hours.
- And of course a sensor type.