You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
1.0 KiB

#pragma once
#include "../common.h"
namespace esphome {
namespace xiaomi {
namespace bslamp2 {
/**
* This custom LightState class is used to provide access to the protected
* LightTranformer information in the LightState class.
*
* This class is used by the ColorTransitionHandler class to inspect if
* an ongoing light color transition is active in the LightState object.
*/
class XiaomiBslamp2LightState : public light::LightState, public LightStateTransformerInspector
{
public:
XiaomiBslamp2LightState(const std::string &name, XiaomiBslamp2LightOutput *output) : light::LightState(name, output) {
output->set_transformer_inspector(this);
}
bool is_active() { return transformer_ != nullptr; }
bool is_transition() { return transformer_->is_transition(); }
light::LightColorValues get_end_values() { return transformer_->get_end_values(); }
float get_progress() { return transformer_->get_progress(); }
};
} // namespace bslamp2
} // namespace xiaomi
} // namespace esphome