forked from emsesp/EMS-ESP32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroomcontrol.h
57 lines (49 loc) · 2.25 KB
/
roomcontrol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* EMS-ESP - https://github.com/emsesp/EMS-ESP
* Copyright 2020-2024 Paul Derbyshire
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EMSESP_ROOMCONTROL_H
#define EMSESP_ROOMCONTROL_H
#include "emsesp.h"
namespace emsesp {
class Roomctrl {
public:
static void send(const uint8_t addr);
static void check(const uint8_t addr, const uint8_t * data, const uint8_t length);
static void set_remotetemp(const uint8_t type, const uint8_t hc, const int16_t temp);
static void set_remotehum(const uint8_t type, const uint8_t hc, const int8_t hum);
enum : uint8_t { RC20 = 113, FB10 = 109, RC100H = 200, SENSOR = 0x40 };
private:
static constexpr uint8_t ADDR = 0x18; // address for hc1
static constexpr uint32_t SEND_INTERVAL = 60000; // 1 minute
static constexpr uint8_t HCS = 4; // max 4 heating circuits
static uint8_t get_hc(const uint8_t addr);
static void version(uint8_t addr, uint8_t dst);
static void unknown(uint8_t addr, uint8_t dst, uint8_t type, uint8_t offset);
static void unknown(uint8_t addr, uint8_t dst, uint8_t offset, uint8_t typeh, uint8_t typel);
static void temperature(uint8_t addr, uint8_t dst, uint8_t hc);
static void humidity(uint8_t addr, uint8_t dst, uint8_t hc);
static void nack_write();
static int16_t calc_dew(int16_t temp, uint8_t hum);
static bool switch_off_[HCS];
static uint32_t rc_time_[HCS];
static int16_t remotetemp_[HCS];
static uint8_t remotehum_[HCS];
static uint8_t sendcnt[HCS];
static uint8_t type_; // type is product-id 113 for RC20 or 109 for Junkers FB10
};
} // namespace emsesp
#endif