ESPHome 2026.9.0-dev
Loading...
Searching...
No Matches
mk2pvrouter_sensor.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
3
4namespace esphome::mk2pvrouter {
5
6static const char *const TAG = "mk2pvrouter_sensor";
7
9
11 auto result = parse_number<float>(val);
12 if (!result.has_value()) {
13 ESP_LOGW(TAG, "Failed to parse value '%s' for tag '%s'", val, this->get_tag());
14 return;
15 }
16 this->publish_state(result.value());
17}
18
20 LOG_SENSOR(" ", "Mk2PVRouter Sensor", this);
21 ESP_LOGCONFIG(TAG, " Tag: %s", this->get_tag());
22}
23
24} // namespace esphome::mk2pvrouter
void publish_val(const char *val) override
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:68
mopeka_std_values val[3]
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.
Definition helpers.h:1179