2020-10-16 16:10:36 +02:00
|
|
|
/**
|
|
|
|
* @file HomieTypes.h
|
|
|
|
* @author your name (you@domain.com)
|
|
|
|
* @brief
|
|
|
|
* @version 0.1
|
|
|
|
* @date 2020-10-16
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2020
|
|
|
|
* All Settings, configurable in Homie
|
|
|
|
*/
|
|
|
|
#ifndef HOMIE_PLANT_CFG_CONFIG_H
|
|
|
|
#define HOMIE_PLANT_CFG_CONFIG_H
|
|
|
|
|
|
|
|
#include <Homie.h>
|
|
|
|
|
2022-03-06 14:25:14 +01:00
|
|
|
/**
|
|
|
|
* @name Sensor types
|
|
|
|
* possible sensors:
|
|
|
|
* @{
|
|
|
|
**/
|
|
|
|
|
2022-02-19 02:24:19 +01:00
|
|
|
#define FOREACH_SENSOR(SENSOR) \
|
|
|
|
SENSOR(NONE) \
|
2023-02-12 12:51:52 +01:00
|
|
|
SENSOR(FREQUENCY_MOD_RESISTANCE_PROBE) \
|
2022-04-27 21:19:26 +02:00
|
|
|
SENSOR(ANALOG_RESISTANCE_PROBE)
|
2022-02-19 02:24:19 +01:00
|
|
|
|
2022-03-06 14:25:14 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2022-02-19 02:24:19 +01:00
|
|
|
#define GENERATE_ENUM(ENUM) ENUM,
|
|
|
|
#define GENERATE_STRING(STRING) #STRING,
|
|
|
|
|
|
|
|
enum SENSOR_MODE {
|
|
|
|
FOREACH_SENSOR(GENERATE_ENUM)
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *SENSOR_STRING[] = {
|
|
|
|
FOREACH_SENSOR(GENERATE_STRING)
|
|
|
|
};
|
2022-02-12 05:26:54 +01:00
|
|
|
|
2021-10-22 19:39:42 +02:00
|
|
|
//plant pump is deactivated, but sensor values are still recorded and published
|
2021-07-09 21:50:51 +02:00
|
|
|
#define DEACTIVATED_PLANT -1
|
2021-10-22 19:39:42 +02:00
|
|
|
//special value to indicate a missing sensor when the plant is not deactivated but no valid sensor value was read
|
2021-07-09 21:50:51 +02:00
|
|
|
#define MISSING_SENSOR -2
|
2021-10-22 19:39:42 +02:00
|
|
|
//plant uses only cooldown and duration, moisture is measured but ignored, allowedHours is ignored (eg. make a 30min on 30min off cycle)
|
|
|
|
#define HYDROPONIC_MODE -3
|
2022-05-20 01:00:04 +02:00
|
|
|
//plant uses cooldown and duration and workhours, moisture is measured but ignored
|
|
|
|
#define TIMER_ONLY -4
|
2023-03-22 21:43:52 +01:00
|
|
|
//special value to indicate a shorted sensor when the plant is not deactivated but the sensor reads short circuit value
|
|
|
|
#define SHORT_CIRCUIT_MODE -5
|
2020-10-16 21:12:25 +02:00
|
|
|
|
2022-08-21 11:52:15 +02:00
|
|
|
/**
|
|
|
|
* @brief State of plants
|
|
|
|
*
|
|
|
|
*/
|
2022-08-23 20:26:11 +02:00
|
|
|
#define PLANTSTATE_NUM_DEACTIVATED -1
|
|
|
|
#define PLANTSTATE_NUM_NO_SENSOR -2
|
|
|
|
#define PLANTSTATE_NUM_WET 0x00
|
|
|
|
#define PLANTSTATE_NUM_SUNNY_ALARM 0x11
|
|
|
|
#define PLANTSTATE_NUM_ACTIVE_ALARM 0x41
|
|
|
|
#define PLANTSTATE_NUM_ACTIVE_SUPESSED -3
|
|
|
|
#define PLANTSTATE_NUM_ACTIVE 0x40
|
|
|
|
#define PLANTSTATE_NUM_SUNNY 0x10
|
|
|
|
#define PLANTSTATE_NUM_COOLDOWN_ALARM 0x21
|
|
|
|
#define PLANTSTATE_NUM_COOLDOWN 0x20
|
|
|
|
#define PLANTSTATE_NUM_AFTERWORK_ALARM 0x31
|
|
|
|
#define PLANTSTATE_NUM_AFTERWORK 0x30
|
2022-08-21 11:52:15 +02:00
|
|
|
|
|
|
|
#define PLANTSTATE_STR_DEACTIVATED "deactivated"
|
|
|
|
#define PLANTSTATE_STR_NO_SENSOR "nosensor"
|
|
|
|
#define PLANTSTATE_STR_WET "wet"
|
|
|
|
#define PLANTSTATE_STR_SUNNY_ALARM "sunny+alarm"
|
2022-08-21 11:59:50 +02:00
|
|
|
#define PLANTSTATE_STR_ACTIVE_ALARM "active+alarm"
|
|
|
|
#define PLANTSTATE_STR_ACTIVE_SUPESSED "active+supressed"
|
|
|
|
#define PLANTSTATE_STR_ACTIVE "active"
|
2022-08-21 11:52:15 +02:00
|
|
|
#define PLANTSTATE_STR_SUNNY "sunny"
|
|
|
|
#define PLANTSTATE_STR_COOLDOWN_ALARM "cooldown+alarm"
|
|
|
|
#define PLANTSTATE_STR_COOLDOWN "cooldown"
|
|
|
|
#define PLANTSTATE_STR_AFTERWORK_ALARM "after-work+alarm"
|
|
|
|
#define PLANTSTATE_STR_AFTERWORK "after-work"
|
|
|
|
|
2020-11-04 21:57:40 +01:00
|
|
|
typedef struct PlantSettings_t
|
|
|
|
{
|
2021-07-09 21:50:51 +02:00
|
|
|
HomieSetting<double> *pSensorDry;
|
2020-11-04 21:57:40 +01:00
|
|
|
HomieSetting<long> *pPumpAllowedHourRangeStart;
|
|
|
|
HomieSetting<long> *pPumpAllowedHourRangeEnd;
|
|
|
|
HomieSetting<bool> *pPumpOnlyWhenLowLight;
|
2021-10-27 01:42:01 +02:00
|
|
|
HomieSetting<long> *pPumpCooldownInSeconds;
|
2021-10-01 23:46:37 +02:00
|
|
|
HomieSetting<long> *pPumpDuration;
|
2021-10-26 21:50:55 +02:00
|
|
|
HomieSetting<long> *pPumpPowerLevel;
|
2021-11-19 19:48:14 +01:00
|
|
|
HomieSetting<long> *pPumpMl;
|
2020-10-16 16:10:36 +02:00
|
|
|
} PlantSettings_t;
|
|
|
|
|
|
|
|
#endif
|