2023-06-07 18:49:13 +00:00
|
|
|
#include "ratgdo_light_output.h"
|
2023-06-07 18:27:01 +00:00
|
|
|
#include "../ratgdo_state.h"
|
|
|
|
#include "esphome/core/log.h"
|
|
|
|
|
|
|
|
namespace esphome {
|
|
|
|
namespace ratgdo {
|
|
|
|
|
2023-06-07 18:28:01 +00:00
|
|
|
using namespace esphome::light;
|
2023-06-07 18:27:01 +00:00
|
|
|
|
|
|
|
static const char* const TAG = "ratgdo.light";
|
|
|
|
|
|
|
|
void RATGDOLightOutput::dump_config()
|
|
|
|
{
|
2023-06-07 18:29:05 +00:00
|
|
|
ESP_LOGCONFIG("", "RATGDO Light");
|
2023-06-07 18:27:01 +00:00
|
|
|
}
|
2023-06-07 19:11:03 +00:00
|
|
|
void RATGDOLightOutput::on_motion_state(MotionState state) { }
|
|
|
|
void RATGDOLightOutput::on_obstruction_state(ObstructionState state) { }
|
|
|
|
void RATGDOLightOutput::on_door_state(DoorState state) { }
|
|
|
|
void RATGDOLightOutput::on_light_state(LightState state) { }
|
|
|
|
void RATGDOLightOutput::on_lock_state(LockState state) { }
|
2023-06-07 18:27:01 +00:00
|
|
|
|
|
|
|
LightTraits RATGDOLightOutput::get_traits()
|
|
|
|
{
|
|
|
|
auto traits = LightTraits();
|
|
|
|
traits.set_supported_color_modes({ light::ColorMode::ON_OFF });
|
|
|
|
return traits;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RATGDOLightOutput::write_state(light::LightState* state)
|
|
|
|
{
|
|
|
|
bool binary;
|
|
|
|
state->current_values_as_binary(&binary);
|
|
|
|
if (binary) {
|
2023-06-07 18:34:01 +00:00
|
|
|
this->parent_->lightOn();
|
2023-06-07 18:27:01 +00:00
|
|
|
} else {
|
2023-06-07 18:34:01 +00:00
|
|
|
this->parent_->lightOff();
|
2023-06-07 18:27:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace ratgdo
|
|
|
|
} // namespace esphome
|