ESPHome 2025.12.1
Loading...
Searching...
No Matches
micronova.h
Go to the documentation of this file.
1#pragma once
2
7#include "esphome/core/log.h"
8
9#include <vector>
10
11namespace esphome::micronova {
12
13static const char *const TAG = "micronova";
14
15class MicroNova;
16
18// Interface classes.
20 public:
23
25
26 void set_memory_location(uint8_t l) { this->memory_location_ = l; }
27 uint8_t get_memory_location() { return this->memory_location_; }
28
29 void set_memory_address(uint8_t a) { this->memory_address_ = a; }
30 uint8_t get_memory_address() { return this->memory_address_; }
31
32 void dump_base_config();
33
34 protected:
36 uint8_t memory_location_ = 0;
37 uint8_t memory_address_ = 0;
38};
39
41 public:
44 virtual void request_value_from_stove() = 0;
45 virtual void process_value_from_stove(int value_from_stove) = 0;
46
47 void set_needs_update(bool u) { this->needs_update_ = u; }
48 bool get_needs_update() { return this->needs_update_; }
49
50 void update() override { this->set_needs_update(true); }
51
52 void dump_base_config();
53
54 protected:
55 bool needs_update_ = false;
56};
57
65
67// Main component class
68class MicroNova : public Component, public uart::UARTDevice {
69 public:
71
72 void setup() override;
73 void loop() override;
74 void dump_config() override;
77
78 void request_address(uint8_t location, uint8_t address, MicroNovaListener *listener);
79 void write_address(uint8_t location, uint8_t address, uint8_t data);
80 int read_stove_reply();
81
82 void set_enable_rx_pin(GPIOPin *enable_rx_pin) { this->enable_rx_pin_ = enable_rx_pin; }
83
84 protected:
86
94
97
98 std::vector<MicroNovaListener *> micronova_listeners_{};
99};
100
101} // namespace esphome::micronova
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:955
This class simplifies creating components that periodically check a state.
Definition component.h:474
void set_enable_rx_pin(GPIOPin *enable_rx_pin)
Definition micronova.h:82
std::vector< MicroNovaListener * > micronova_listeners_
Definition micronova.h:98
void write_address(uint8_t location, uint8_t address, uint8_t data)
MicroNovaSerialTransmission current_transmission_
Definition micronova.h:96
void register_micronova_listener(MicroNovaListener *l)
Definition micronova.h:75
void request_address(uint8_t location, uint8_t address, MicroNovaListener *listener)
Definition micronova.cpp:73
virtual void process_value_from_stove(int value_from_stove)=0