ESPHome 2025.5.0
Loading...
Searching...
No Matches
micronova.h
Go to the documentation of this file.
1#pragma once
2
5#include "esphome/core/log.h"
8
9#include <vector>
10
11namespace esphome {
12namespace micronova {
13
14static const char *const TAG = "micronova";
15static const int STOVE_REPLY_DELAY = 60;
16
17static const std::string STOVE_STATES[11] = {"Off",
18 "Start",
19 "Pellets loading",
20 "Ignition",
21 "Working",
22 "Brazier Cleaning",
23 "Final Cleaning",
24 "Standby",
25 "No pellets alarm",
26 "No ignition alarm",
27 "Undefined alarm"};
28
44
45class MicroNova;
46
48// Interface classes.
50 public:
53 virtual void dump_config();
54
56
59
60 void set_memory_location(uint8_t l) { this->memory_location_ = l; }
61 uint8_t get_memory_location() { return this->memory_location_; }
62
63 void set_memory_address(uint8_t a) { this->memory_address_ = a; }
64 uint8_t get_memory_address() { return this->memory_address_; }
65
66 protected:
69 uint8_t memory_location_ = 0;
70 uint8_t memory_address_ = 0;
71};
72
74 public:
77 virtual void request_value_from_stove() = 0;
78 virtual void process_value_from_stove(int value_from_stove) = 0;
79
80 void set_needs_update(bool u) { this->needs_update_ = u; }
81 bool get_needs_update() { return this->needs_update_; }
82
83 protected:
84 bool needs_update_ = false;
85};
86
88 public:
90 virtual void request_value_from_stove() = 0;
91 virtual void process_value_from_stove(int value_from_stove) = 0;
92
93 void set_needs_update(bool u) { this->needs_update_ = u; }
94 bool get_needs_update() { return this->needs_update_; }
95
96 protected:
97 bool needs_update_ = false;
98};
99
101 public:
103 virtual void set_stove_state(bool v) = 0;
104 virtual bool get_stove_state() = 0;
105
106 protected:
107 uint8_t memory_data_on_ = 0;
108 uint8_t memory_data_off_ = 0;
109};
110
112 public:
114
115 protected:
116 uint8_t memory_data_ = 0;
117};
118
120// Main component class
122 public:
124
125 void setup() override;
126 void loop() override;
127 void update() override;
128 void dump_config() override;
130
131 void request_address(uint8_t location, uint8_t address, MicroNovaSensorListener *listener);
132 void write_address(uint8_t location, uint8_t address, uint8_t data);
133 int read_stove_reply();
134
135 void set_enable_rx_pin(GPIOPin *enable_rx_pin) { this->enable_rx_pin_ = enable_rx_pin; }
136
137 void set_current_stove_state(uint8_t s) { this->current_stove_state_ = s; }
139
142
143 protected:
145
147
155
158
159 std::vector<MicroNovaSensorListener *> micronova_listeners_{};
161};
162
163} // namespace micronova
164} // namespace esphome
uint8_t l
Definition bl0906.h:0
uint8_t m
Definition bl0906.h:1
uint8_t address
Definition bl0906.h:4
Mutex implementation, with API based on the unavailable std::mutex.
Definition helpers.h:561
This class simplifies creating components that periodically check a state.
Definition component.h:301
void set_function(MicroNovaFunctions f)
Definition micronova.h:57
void set_stove(MicroNovaSwitchListener *s)
Definition micronova.h:140
std::vector< MicroNovaSensorListener * > micronova_listeners_
Definition micronova.h:159
void set_enable_rx_pin(GPIOPin *enable_rx_pin)
Definition micronova.h:135
void write_address(uint8_t location, uint8_t address, uint8_t data)
MicroNovaSerialTransmission current_transmission_
Definition micronova.h:157
void request_address(uint8_t location, uint8_t address, MicroNovaSensorListener *listener)
Definition micronova.cpp:65
MicroNovaSwitchListener * stove_switch_
Definition micronova.h:160
MicroNovaSwitchListener * get_stove_switch()
Definition micronova.h:141
void set_current_stove_state(uint8_t s)
Definition micronova.h:137
void register_micronova_listener(MicroNovaSensorListener *l)
Definition micronova.h:129
virtual void process_value_from_stove(int value_from_stove)=0
virtual void process_value_from_stove(int value_from_stove)=0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7