mirror of
https://github.com/esphome/esphome.git
synced 2026-02-26 05:53:12 -07:00
Merge branch 'integration' into memory_api
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include <utility>
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#include "alarm_control_panel.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/controller_registry.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "cover.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include <strings.h>
|
||||
#include "esphome/core/controller_registry.h"
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <climits>
|
||||
#include "abstract_aqi_calculator.h"
|
||||
// https://www.airnow.gov/sites/default/files/2020-05/aqi-technical-assistance-document-sept2018.pdf
|
||||
// https://document.airnow.gov/technical-assistance-document-for-the-reporting-of-daily-air-quailty.pdf
|
||||
|
||||
namespace esphome {
|
||||
namespace hm3301 {
|
||||
@@ -16,16 +16,15 @@ class AQICalculator : public AbstractAQICalculator {
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int AMOUNT_OF_LEVELS = 7;
|
||||
static const int AMOUNT_OF_LEVELS = 6;
|
||||
|
||||
int index_grid_[AMOUNT_OF_LEVELS][2] = {{0, 50}, {51, 100}, {101, 150}, {151, 200},
|
||||
{201, 300}, {301, 400}, {401, 500}};
|
||||
int index_grid_[AMOUNT_OF_LEVELS][2] = {{0, 50}, {51, 100}, {101, 150}, {151, 200}, {201, 300}, {301, 500}};
|
||||
|
||||
int pm2_5_calculation_grid_[AMOUNT_OF_LEVELS][2] = {{0, 12}, {13, 35}, {36, 55}, {56, 150},
|
||||
{151, 250}, {251, 350}, {351, 500}};
|
||||
int pm2_5_calculation_grid_[AMOUNT_OF_LEVELS][2] = {{0, 9}, {10, 35}, {36, 55},
|
||||
{56, 125}, {126, 225}, {226, INT_MAX}};
|
||||
|
||||
int pm10_0_calculation_grid_[AMOUNT_OF_LEVELS][2] = {{0, 54}, {55, 154}, {155, 254}, {255, 354},
|
||||
{355, 424}, {425, 504}, {505, 604}};
|
||||
int pm10_0_calculation_grid_[AMOUNT_OF_LEVELS][2] = {{0, 54}, {55, 154}, {155, 254},
|
||||
{255, 354}, {355, 424}, {425, INT_MAX}};
|
||||
|
||||
int calculate_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2]) {
|
||||
int grid_index = get_grid_index_(value, array);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#include "light_state.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/controller_registry.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include "light_output.h"
|
||||
#include "light_state.h"
|
||||
#include "transformers.h"
|
||||
|
||||
namespace esphome {
|
||||
|
||||
@@ -10,166 +10,105 @@ StaticVector<Controller *, CONTROLLER_REGISTRY_MAX> ControllerRegistry::controll
|
||||
|
||||
void ControllerRegistry::register_controller(Controller *controller) { controllers.push_back(controller); }
|
||||
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
void ControllerRegistry::notify_binary_sensor_update(binary_sensor::BinarySensor *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_binary_sensor_update(obj);
|
||||
// Macro for standard registry notification dispatch - calls on_<entity_name>_update()
|
||||
#define CONTROLLER_REGISTRY_NOTIFY(entity_type, entity_name) \
|
||||
void ControllerRegistry::notify_##entity_name##_update(entity_type *obj) { /* NOLINT(bugprone-macro-parentheses) */ \
|
||||
for (auto *controller : controllers) { \
|
||||
controller->on_##entity_name##_update(obj); \
|
||||
} \
|
||||
}
|
||||
}
|
||||
|
||||
// Macro for entities where controller method has no "_update" suffix (Event, Update)
|
||||
#define CONTROLLER_REGISTRY_NOTIFY_NO_UPDATE_SUFFIX(entity_type, entity_name) \
|
||||
void ControllerRegistry::notify_##entity_name(entity_type *obj) { /* NOLINT(bugprone-macro-parentheses) */ \
|
||||
for (auto *controller : controllers) { \
|
||||
controller->on_##entity_name(obj); \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
CONTROLLER_REGISTRY_NOTIFY(binary_sensor::BinarySensor, binary_sensor)
|
||||
#endif
|
||||
|
||||
#ifdef USE_FAN
|
||||
void ControllerRegistry::notify_fan_update(fan::Fan *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_fan_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(fan::Fan, fan)
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIGHT
|
||||
void ControllerRegistry::notify_light_update(light::LightState *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_light_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(light::LightState, light)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SENSOR
|
||||
void ControllerRegistry::notify_sensor_update(sensor::Sensor *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_sensor_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(sensor::Sensor, sensor)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SWITCH
|
||||
void ControllerRegistry::notify_switch_update(switch_::Switch *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_switch_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(switch_::Switch, switch)
|
||||
#endif
|
||||
|
||||
#ifdef USE_COVER
|
||||
void ControllerRegistry::notify_cover_update(cover::Cover *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_cover_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(cover::Cover, cover)
|
||||
#endif
|
||||
|
||||
#ifdef USE_TEXT_SENSOR
|
||||
void ControllerRegistry::notify_text_sensor_update(text_sensor::TextSensor *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_text_sensor_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(text_sensor::TextSensor, text_sensor)
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLIMATE
|
||||
void ControllerRegistry::notify_climate_update(climate::Climate *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_climate_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(climate::Climate, climate)
|
||||
#endif
|
||||
|
||||
#ifdef USE_NUMBER
|
||||
void ControllerRegistry::notify_number_update(number::Number *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_number_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(number::Number, number)
|
||||
#endif
|
||||
|
||||
#ifdef USE_DATETIME_DATE
|
||||
void ControllerRegistry::notify_date_update(datetime::DateEntity *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_date_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(datetime::DateEntity, date)
|
||||
#endif
|
||||
|
||||
#ifdef USE_DATETIME_TIME
|
||||
void ControllerRegistry::notify_time_update(datetime::TimeEntity *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_time_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(datetime::TimeEntity, time)
|
||||
#endif
|
||||
|
||||
#ifdef USE_DATETIME_DATETIME
|
||||
void ControllerRegistry::notify_datetime_update(datetime::DateTimeEntity *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_datetime_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(datetime::DateTimeEntity, datetime)
|
||||
#endif
|
||||
|
||||
#ifdef USE_TEXT
|
||||
void ControllerRegistry::notify_text_update(text::Text *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_text_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(text::Text, text)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SELECT
|
||||
void ControllerRegistry::notify_select_update(select::Select *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_select_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(select::Select, select)
|
||||
#endif
|
||||
|
||||
#ifdef USE_LOCK
|
||||
void ControllerRegistry::notify_lock_update(lock::Lock *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_lock_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(lock::Lock, lock)
|
||||
#endif
|
||||
|
||||
#ifdef USE_VALVE
|
||||
void ControllerRegistry::notify_valve_update(valve::Valve *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_valve_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(valve::Valve, valve)
|
||||
#endif
|
||||
|
||||
#ifdef USE_MEDIA_PLAYER
|
||||
void ControllerRegistry::notify_media_player_update(media_player::MediaPlayer *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_media_player_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(media_player::MediaPlayer, media_player)
|
||||
#endif
|
||||
|
||||
#ifdef USE_ALARM_CONTROL_PANEL
|
||||
void ControllerRegistry::notify_alarm_control_panel_update(alarm_control_panel::AlarmControlPanel *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_alarm_control_panel_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY(alarm_control_panel::AlarmControlPanel, alarm_control_panel)
|
||||
#endif
|
||||
|
||||
#ifdef USE_EVENT
|
||||
void ControllerRegistry::notify_event(event::Event *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_event(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY_NO_UPDATE_SUFFIX(event::Event, event)
|
||||
#endif
|
||||
|
||||
#ifdef USE_UPDATE
|
||||
void ControllerRegistry::notify_update(update::UpdateEntity *obj) {
|
||||
for (auto *controller : controllers) {
|
||||
controller->on_update(obj);
|
||||
}
|
||||
}
|
||||
CONTROLLER_REGISTRY_NOTIFY_NO_UPDATE_SUFFIX(update::UpdateEntity, update)
|
||||
#endif
|
||||
|
||||
#undef CONTROLLER_REGISTRY_NOTIFY
|
||||
#undef CONTROLLER_REGISTRY_NOTIFY_NO_UPDATE_SUFFIX
|
||||
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_CONTROLLER_REGISTRY
|
||||
|
||||
@@ -129,9 +129,6 @@ class EntityBase {
|
||||
// Returns empty StringRef if object_id is dynamic (needs allocation)
|
||||
StringRef get_object_id_ref_for_api_() const;
|
||||
|
||||
/// The hash_base() function has been deprecated. It is kept in this
|
||||
/// class for now, to prevent external components from not compiling.
|
||||
virtual uint32_t hash_base() { return 0L; }
|
||||
void calc_object_id_();
|
||||
|
||||
/// Check if the object_id is dynamic (changes with MAC suffix)
|
||||
|
||||
@@ -12,7 +12,7 @@ platformio==6.1.18 # When updating platformio, also update /docker/Dockerfile
|
||||
esptool==5.1.0
|
||||
click==8.1.7
|
||||
esphome-dashboard==20251013.0
|
||||
aioesphomeapi==42.6.0
|
||||
aioesphomeapi==42.7.0
|
||||
zeroconf==0.148.0
|
||||
puremagic==1.30
|
||||
ruamel.yaml==0.18.16 # dashboard_import
|
||||
|
||||
Reference in New Issue
Block a user