esphome-ratgdo/components/ratgdo/ratgdo_state.cpp

50 lines
1.2 KiB
C++
Raw Permalink Normal View History

2023-06-07 15:06:51 +00:00
#include "ratgdo_state.h"
namespace esphome {
namespace ratgdo {
LightState light_state_toggle(LightState state)
{
switch (state) {
case LightState::OFF:
return LightState::ON;
case LightState::ON:
return LightState::OFF;
// 2 and 3 appears sometimes
case LightState::UNKNOWN:
default:
return LightState::UNKNOWN;
2023-06-07 15:06:51 +00:00
}
}
LockState lock_state_toggle(LockState state)
{
switch (state) {
case LockState::UNLOCKED:
return LockState::LOCKED;
case LockState::LOCKED:
return LockState::UNLOCKED;
// 2 and 3 appears sometimes
case LockState::UNKNOWN:
2023-06-09 23:04:29 +00:00
default:
return LockState::UNKNOWN;
2023-06-09 23:04:29 +00:00
}
2023-06-09 23:04:32 +00:00
}
2023-06-09 23:04:29 +00:00
2023-12-18 17:56:25 +00:00
LearnState learn_state_toggle(LearnState state)
{
switch (state) {
case LearnState::ACTIVE:
return LearnState::INACTIVE;
case LearnState::INACTIVE:
return LearnState::ACTIVE;
// 2 and 3 appears sometimes
case LearnState::UNKNOWN:
default:
return LearnState::UNKNOWN;
}
}
2023-06-07 15:06:51 +00:00
} // namespace ratgdo
} // namespace esphome