33class Channel :
public LocalAction {
35 explicit Channel(
int number = -1);
37 static Channel *Begin();
38 static Channel *Last();
39 static Channel *GetByChannelNumber(
int channelNumber);
43 static void resetToDefaults();
48 bool setChannelNumber(
int newChannelNumber);
50 void setNewValue(
double dbl);
51 void setNewValue(
double temp,
double humi);
52 void setNewValue(int32_t value);
53 void setNewValue(
bool value);
55 void setNewValue(uint8_t red,
58 uint8_t colorBrightness,
60 void setNewValue(uint64_t value);
62 bool setNewValue(
const char *newValue);
64 void setStateOffline();
65 void setStateOnline();
66 void setStateOnlineAndNotAvailable();
67 void setStateFirmwareUpdateOngoing();
68 void setStateOfflineRemoteWakeupNotSupported();
69 bool isStateOnline()
const;
70 bool isStateOnlineAndNotAvailable()
const;
71 bool isStateOfflineRemoteWakeupNotSupported()
const;
72 bool isStateFirmwareUpdateOngoing()
const;
76 void setContainerFillValue(int8_t fillLevel);
77 void setContainerAlarm(
bool active);
78 void setContainerWarning(
bool active);
79 void setContainerInvalidSensorState(
bool invalid);
80 void setContainerSoundAlarmOn(
bool soundAlarmOn);
83 int8_t getContainerFillValue()
const;
84 bool isContainerAlarmActive()
const;
85 bool isContainerWarningActive()
const;
86 bool isContainerInvalidSensorStateActive()
const;
87 bool isContainerSoundAlarmOn()
const;
156 double getValueDouble();
157 double getValueDoubleFirst();
158 double getValueDoubleSecond();
159 int32_t getValueInt32();
160 uint64_t getValueInt64();
161 virtual bool getValueBool();
162 uint8_t getValueRed();
163 uint8_t getValueGreen();
164 uint8_t getValueBlue();
165 uint8_t getValueColorBrightness();
166 uint8_t getValueBrightness();
167 double getLastTemperature();
168 uint8_t getValueClosingPercentage()
const;
169 uint8_t getValueTilt()
const;
170 bool getValueIsCalibrating()
const;
172 void setHvacIsOn(
bool isOn);
173 void setHvacIsOnPercent(uint8_t percent);
174 void setHvacMode(uint8_t mode);
175 void setHvacSetpointTemperatureHeat(int16_t setpointTemperatureHeat);
176 void setHvacSetpointTemperatureCool(int16_t setpointTemperatureCool);
177 void clearHvacSetpointTemperatureHeat();
178 void clearHvacSetpointTemperatureCool();
179 void setHvacFlags(uint16_t alarmsAndFlags);
180 void setHvacFlagSetpointTemperatureHeatSet(
bool value);
181 void setHvacFlagSetpointTemperatureCoolSet(
bool value);
182 void setHvacFlagHeating(
bool value);
183 void setHvacFlagCooling(
bool value);
184 void setHvacFlagWeeklySchedule(
bool value);
185 void setHvacFlagFanEnabled(
bool value);
186 void setHvacFlagThermometerError(
bool value);
187 void setHvacFlagClockError(
bool value);
188 void setHvacFlagCountdownTimer(
bool value);
189 void setHvacFlagForcedOffBySensor(
bool value);
190 void setHvacFlagCoolSubfunction(
enum HvacCoolSubfunctionFlag flag);
191 void setHvacFlagWeeklyScheduleTemporalOverride(
bool value);
192 void setHvacFlagBatteryCoverOpen(
bool value);
193 void setHvacFlagCalibrationError(
bool value);
194 void setHvacFlagAntifreezeOverheatActive(
bool value);
195 void clearHvacState();
197 uint8_t getHvacIsOnRaw()
const;
198 bool getHvacIsOnBool()
const;
199 uint8_t getHvacIsOnPercent()
const;
201 uint8_t getHvacMode()
const;
204 const char *getHvacModeCstr(
int mode = -1)
const;
205 int16_t getHvacSetpointTemperatureHeat()
const;
206 int16_t getHvacSetpointTemperatureCool()
const;
207 uint16_t getHvacFlags()
const;
208 bool isHvacFlagSetpointTemperatureHeatSet()
const;
209 bool isHvacFlagSetpointTemperatureCoolSet()
const;
210 bool isHvacFlagHeating()
const;
211 bool isHvacFlagCooling()
const;
212 bool isHvacFlagWeeklySchedule()
const;
213 bool isHvacFlagFanEnabled()
const;
214 bool isHvacFlagThermometerError()
const;
215 bool isHvacFlagClockError()
const;
216 bool isHvacFlagCountdownTimer()
const;
217 bool isHvacFlagForcedOffBySensor()
const;
218 enum HvacCoolSubfunctionFlag getHvacFlagCoolSubfunction()
const;
219 bool isHvacFlagWeeklyScheduleTemporalOverride()
const;
220 bool isHvacFlagBatteryCoverOpen()
const;
221 bool isHvacFlagCalibrationError()
const;
222 bool isHvacFlagAntifreezeOverheatActive()
const;
224 static bool isHvacFlagSetpointTemperatureHeatSet(
const THVACValue *hvacValue);
225 static bool isHvacFlagSetpointTemperatureCoolSet(
const THVACValue *hvacValue);
226 static bool isHvacFlagHeating(
const THVACValue *hvacValue);
227 static bool isHvacFlagCooling(
const THVACValue *hvacValue);
228 static bool isHvacFlagWeeklySchedule(
const THVACValue *hvacValue);
229 static bool isHvacFlagFanEnabled(
const THVACValue *hvacValue);
230 static bool isHvacFlagThermometerError(
const THVACValue *hvacValue);
231 static bool isHvacFlagClockError(
const THVACValue *hvacValue);
232 static bool isHvacFlagCountdownTimer(
const THVACValue *hvacValue);
233 static bool isHvacFlagForcedOffBySensor(
const THVACValue *hvacValue);
234 static enum HvacCoolSubfunctionFlag getHvacFlagCoolSubfunction(
236 static bool isHvacFlagWeeklyScheduleTemporalOverride(
238 static bool isHvacFlagBatteryCoverOpen(
const THVACValue *hvacValue);
239 static bool isHvacFlagCalibrationError(
const THVACValue *hvacValue);
240 static bool isHvacFlagAntifreezeOverheatActive(
const THVACValue *hvacValue);
242 static void setHvacSetpointTemperatureHeat(
THVACValue *hvacValue,
243 int16_t setpointTemperatureHeat);
244 static void setHvacSetpointTemperatureCool(
THVACValue *hvacValue,
245 int16_t setpointTemperatureCool);
249 static bool isHvacValueValid(
const THVACValue *hvacValue);
251 virtual bool isExtended()
const;
252 bool isUpdateReady()
const;
253 int getChannelNumber()
const;
254 _supla_int_t getChannelType()
const;
256 void setType(_supla_int_t type);
259 void setDefault(_supla_int_t value);
260 void setDefaultFunction(_supla_int_t function);
261 int32_t getDefaultFunction()
const;
262 bool isFunctionValid(int32_t function)
const;
263 void setFlag(uint64_t flag);
264 void unsetFlag(uint64_t flag);
265 uint64_t getFlags()
const;
266 void setFuncList(_supla_int_t functions);
267 _supla_int_t getFuncList()
const;
268 void addToFuncList(_supla_int_t function);
269 void removeFromFuncList(_supla_int_t function);
270 void setActionTriggerCaps(_supla_int_t caps);
271 _supla_int_t getActionTriggerCaps();
273 void setValidityTimeSec(uint32_t timeSec);
274 virtual void sendUpdate();
278 virtual bool getExtValueAsElectricityMeter(
280 void setCorrection(
double correction,
bool forSecondaryValue =
false);
281 bool isSleepingEnabled();
282 bool isWeeklyScheduleAvailable();
285 bool isBatteryPoweredFieldEnabled()
const;
286 bool isBatteryPowered()
const;
288 void setBatteryPowered(
bool);
305 void setBridgeSignalStrength(
unsigned char level);
306 uint8_t getBridgeSignalStrength()
const;
307 bool isBridgeSignalStrengthAvailable()
const;
309 void setInitialCaption(
const char *caption);
310 bool isInitialCaptionSet()
const;
311 const char* getInitialCaption()
const;
313 void setDefaultIcon(uint8_t iconId);
314 uint8_t getDefaultIcon()
const;
316 static uint32_t lastCommunicationTimeMs;
317 void fillRawValue(
void *value);
318 int8_t *getValuePtr();
320 void setSubDeviceId(uint8_t subDeviceId);
321 uint8_t getSubDeviceId()
const;
323 bool isRollerShutterRelayType()
const;
326 void setSendGetConfig();
328 bool isChannelStateEnabled()
const;
329 void clearSendValue();
333 bool isValueUpdateReady()
const;
335 void clearSendGetConfig();
336 bool isGetConfigRequested()
const;
338 void setSendInitialCaption();
339 void clearSendInitialCaption();
340 bool isInitialCaptionUpdateReady()
const;
342 void setSendStateInfo();
343 void clearSendStateInfo();
344 bool isStateInfoUpdateReady()
const;
346 static Channel *firstPtr;
347 Channel *nextPtr =
nullptr;
349 char *initialCaption =
nullptr;
351 uint64_t channelFlags = 0;
352 uint32_t functionsBitmap = 0;
353 uint32_t validityTimeSec = 0;
355 int16_t channelNumber = -1;
357 uint16_t defaultFunction =
361 uint8_t changedFields = 0;
363 uint8_t batteryLevel = 255;
364 uint8_t batteryPowered = 0;
365 unsigned char bridgeSignalStrength = 255;
368 ChannelType channelType = ChannelType::NOT_SET;
371 uint8_t defaultIcon = 0;
372 uint8_t subDeviceId = 0;
375 int8_t value[SUPLA_CHANNELVALUE_SIZE] = {};