esphome-ratgdo/components/ratgdo/ratgdo_state.cpp

36 lines
845 B
C++
Raw 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-06-07 15:06:51 +00:00
} // namespace ratgdo
} // namespace esphome