Updated hoerman_door to esphome 2025.11.3...

Breaking changes existed in 2025.11.0
See https://github.com/esphome/esphome/pull/11704 for more information
This commit is contained in:
2025-12-04 01:47:24 +01:00
parent 1f7c437c3e
commit 4a0035d607
6 changed files with 40 additions and 16 deletions

View File

@@ -14,6 +14,12 @@
namespace esphome { namespace esphome {
namespace hoermann_door { namespace hoermann_door {
enum DoorOpeningState {
OPENING = 0,
CLOSING = 1,
NO_ACTION = 2
};
class HoermannDoor : public Component, public cover::Cover class HoermannDoor : public Component, public cover::Cover
{ {
private: private:
@@ -53,12 +59,29 @@ public:
manual = false; manual = false;
} }
else{ else{
ESP_LOGD(COMP_TAG, "Not yet supported"); uint8_t state = mainComponent->getEmulator()->getState().doorCurrentPosition;
switch(state){
case DoorState::DOOR_CLOSE_POSITION:
case DoorState::DOOR_OPEN_POSITION:
case DoorState::DOOR_HALF_POSITION:
break;
case DoorState::DOOR_MOVE_CLOSEPOSITION:
break;
case DoorState::DOOR_MOVE_OPENPOSITION:
break;
default:
ESP_LOGE(TAG, "ERROR, HCIEmulator reported door state as something else than normal values");
}
} }
} }
if (call.get_stop()) { if (call.get_stop()) {
mainComponent->getEmulator()->stopDoor(); mainComponent->getEmulator()->stopDoor();
} }
//if(call.get_close()) { //if(call.get_close()) {
//emulator.closeDoor(); //emulator.closeDoor();

View File

@@ -37,12 +37,12 @@ void LogCore(int Level, const char *msg, const unsigned char *data = NULL, size_
str[3] = '\0'; str[3] = '\0';
strncat(newmsg, str, sizeof(str)); strncat(newmsg, str, sizeof(str));
} }
ESP_LOGD(TAG, newmsg); ESP_LOGD(EM_TAG, newmsg);
free(newmsg); free(newmsg);
} }
else else
{ {
ESP_LOGD(TAG, msg); ESP_LOGD(EM_TAG, msg);
} }
} }
//#else //#else
@@ -195,7 +195,7 @@ void HCIEmulator::poll()
} }
else else
{ {
ESP_LOGD(TAG, "skipped frame"); ESP_LOGD(EM_TAG, "skipped frame");
} }
m_skipFrame = false; m_skipFrame = false;

View File

@@ -27,7 +27,7 @@
namespace esphome { namespace esphome {
namespace hoermann_door { namespace hoermann_door {
static const char *const TAG = "HCIEmulator"; static const char *const EM_TAG = "HCIEmulator";
enum DoorState : uint8_t enum DoorState : uint8_t
{ {

View File

@@ -12,7 +12,7 @@ class HoermannMainComponent;
namespace esphome { namespace esphome {
namespace hoermann_door { namespace hoermann_door {
static const char *const COMP_TAG = "Hoermann"; static const char *const TAG = "Hoermann";
void dispatcherFn(void *arg); void dispatcherFn(void *arg);
@@ -100,11 +100,11 @@ class HoermannMainComponent: public Component{
} }
void dump_config() override { void dump_config() override {
ESP_LOGCONFIG(COMP_TAG, "hoermann_door_component:"); ESP_LOGCONFIG(TAG, "hoermann_door_component:");
ESP_LOGCONFIG(COMP_TAG, " UART: "); ESP_LOGCONFIG(TAG, " UART: ");
ESP_LOGCONFIG(COMP_TAG, " UART is configured"); ESP_LOGCONFIG(TAG, " UART is configured");
LOG_PIN(" TX_ON_PIN", this->_tx_on); LOG_PIN(" TX_ON_PIN", this->_tx_on);
ESP_LOGCONFIG(COMP_TAG, " Log Level: %d", this->log_level); ESP_LOGCONFIG(TAG, " Log Level: %d", this->log_level);
} }
}; };
@@ -118,7 +118,7 @@ template<typename... Ts> class StopPollingAction: public Action<Ts...> {
public: public:
StopPollingAction(HoermannMainComponent *motor) : motor_(motor) {} StopPollingAction(HoermannMainComponent *motor) : motor_(motor) {}
void play(Ts... x) override { this->motor_->stop_polling(); } void play(const Ts &...x) override { this->motor_->stop_polling(); }
protected: protected:
HoermannMainComponent *motor_; HoermannMainComponent *motor_;
@@ -127,7 +127,7 @@ template<typename... Ts> class StartPollingAction: public Action<Ts...> {
public: public:
StartPollingAction(HoermannMainComponent *motor) : motor_(motor) {} StartPollingAction(HoermannMainComponent *motor) : motor_(motor) {}
void play(Ts... x) override { this->motor_->start_polling(); } void play(const Ts &...x) override { this->motor_->start_polling(); }
protected: protected:
HoermannMainComponent *motor_; HoermannMainComponent *motor_;

View File

@@ -59,7 +59,7 @@ class NbsLightOutput: public output::BinaryOutput, public Component{
} }
void set_state_callback(light::LightState *callback){ void set_state_callback(light::LightState *callback){
if(callback == nullptr) ESP_LOGW(COMP_TAG, "Got Nullable callback"); if(callback == nullptr) ESP_LOGW(TAG, "Got Nullable callback");
this->callback = callback; this->callback = callback;
} }
void set_emulator_component(HoermannMainComponent* component){ void set_emulator_component(HoermannMainComponent* component){
@@ -72,14 +72,14 @@ class NbsLightOutput: public output::BinaryOutput, public Component{
//ESP_LOGD("Test", "I have no idea"); //ESP_LOGD("Test", "I have no idea");
lastState = mainComponent->getEmulator()->getState().lampOn; lastState = mainComponent->getEmulator()->getState().lampOn;
if(lastState == true){ if(lastState == true){
ESP_LOGD(COMP_TAG, "Light State ON"); ESP_LOGD(TAG, "Light State ON");
auto call = callback->make_call(); auto call = callback->make_call();
call.set_state(true); call.set_state(true);
call.perform(); call.perform();
} }
else { else {
ESP_LOGD(COMP_TAG, "Light State OFF"); ESP_LOGD(TAG, "Light State OFF");
auto call = callback->make_call(); auto call = callback->make_call();
call.set_state(false); call.set_state(false);
call.perform(); call.perform();

View File

@@ -1,5 +1,5 @@
substitutions: substitutions:
garageSide: sy # sy, wo garageSide: wo # sy, wo
version: "2.1.3" version: "2.1.3"
esphome: esphome:
@@ -30,6 +30,7 @@ wifi:
ssid: !secret wifi_ssid ssid: !secret wifi_ssid
password: !secret wifi_password password: !secret wifi_password
fast_connect: true fast_connect: true
min_auth_mode: WPA2
logger: logger:
#level: VERY_VERBOSE #level: VERY_VERBOSE