supla-device
Loading...
Searching...
No Matches
weight.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_SENSOR_WEIGHT_H_
5#define SRC_SUPLA_SENSOR_WEIGHT_H_
6
7#include "supla/channel_element.h"
8#include "supla/element.h"
9#include "../action_handler.h"
10#include "../local_action.h"
11#include "../actions.h"
12
13#define WEIGHT_NOT_AVAILABLE -1.0
14
15namespace Supla {
16namespace Sensor {
17class Weight : public ChannelElement, public ActionHandler {
18 public:
19 Weight();
20
21 void setRefreshIntervalMs(int intervalMs);
22
23 virtual double getValue();
24 virtual void tareScales() = 0;
25
26 void handleAction(int event, int action) override;
27 void iterateAlways() override;
28
29 protected:
30 uint32_t lastReadTime = 0;
31 uint16_t refreshIntervalMs = 10000;
32};
33
34}; // namespace Sensor
35}; // namespace Supla
36
37#endif // SRC_SUPLA_SENSOR_WEIGHT_H_
Definition action_handler.h:8
Definition channel_element.h:15
Definition weight.h:17
void iterateAlways() override
Method called on each SuplaDevice iteration.
Definition weight.cpp:34