#pragma once #include "esphome/core/component.h" #include "TrumaiNetBoxApp.h" namespace esphome { namespace truma_inetbox { template class HeaterRoomTempAction : public Action, public Parented { public: TEMPLATABLE_VALUE(u_int8_t, temperature) TEMPLATABLE_VALUE(HeatingMode, heating_mode) void play(Ts... x) override { this->parent_->action_heater_room(this->temperature_.value_or(x..., 0), this->heating_mode_.value_or(x..., HeatingMode::HEATING_MODE_OFF)); } }; template class HeaterWaterTempAction : public Action, public Parented { public: TEMPLATABLE_VALUE(u_int8_t, temperature) void play(Ts... x) override { this->parent_->action_heater_water(this->temperature_.value_or(x..., 0)); } }; template class HeaterWaterTempEnumAction : public Action, public Parented { public: TEMPLATABLE_VALUE(TargetTemp, temperature) void play(Ts... x) override { this->parent_->action_heater_water(this->temperature_.value_or(x..., TargetTemp::TARGET_TEMP_OFF)); } }; template class HeaterElecPowerLevelAction : public Action, public Parented { public: TEMPLATABLE_VALUE(u_int16_t, watt) void play(Ts... x) override { this->parent_->action_heater_electric_power_level(this->watt_.value_or(x..., 0)); } }; template class HeaterEnergyMixAction : public Action, public Parented { public: TEMPLATABLE_VALUE(EnergyMix, energy_mix) TEMPLATABLE_VALUE(ElectricPowerLevel, watt) void play(Ts... x) override { this->parent_->action_heater_energy_mix(this->energy_mix_.value_or(x..., EnergyMix::ENERGY_MIX_GAS), this->watt_.value_or(x..., ElectricPowerLevel::ELECTRIC_POWER_LEVEL_0)); } }; template class TimerDisableAction : public Action, public Parented { public: void play(Ts... x) override { this->parent_->action_timer_disable(); } }; template class TimerActivateAction : public Action, public Parented { public: TEMPLATABLE_VALUE(u_int16_t, start) TEMPLATABLE_VALUE(u_int16_t, stop) TEMPLATABLE_VALUE(u_int8_t, room_temperature) TEMPLATABLE_VALUE(HeatingMode, heating_mode) TEMPLATABLE_VALUE(u_int8_t, water_temperature) TEMPLATABLE_VALUE(EnergyMix, energy_mix) TEMPLATABLE_VALUE(ElectricPowerLevel, watt) void play(Ts... x) override { this->parent_->action_timer_activate( this->start_.value(x...), this->stop_.value(x...), this->room_temperature_.value(x...), this->heating_mode_.value_or(x..., HeatingMode::HEATING_MODE_OFF), this->water_temperature_.value_or(x..., 0), this->energy_mix_.value_or(x..., EnergyMix::ENERGY_MIX_NONE), this->watt_.value_or(x..., ElectricPowerLevel::ELECTRIC_POWER_LEVEL_0)); } }; #ifdef USE_TIME template class WriteTimeAction : public Action, public Parented { public: void play(Ts... x) override { this->parent_->action_write_time(); } }; #endif // USE_TIME class TrumaiNetBoxAppHeaterMessageTrigger : public Trigger { public: explicit TrumaiNetBoxAppHeaterMessageTrigger(TrumaiNetBoxApp *parent) { parent->add_on_heater_message_callback([this](const StatusFrameHeater *message) { this->trigger(message); }); } }; } // namespace truma_inetbox } // namespace esphome