Use door stop command in place of toggle (#16)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
385a89507b
commit
eb6f40c060
|
@ -180,7 +180,7 @@ button:
|
||||||
id($id_prefix).query_openings();
|
id($id_prefix).query_openings();
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
id: ${id_prefix}_test
|
id: ${id_prefix}_sync
|
||||||
name: "Sync"
|
name: "Sync"
|
||||||
entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
on_press:
|
on_press:
|
||||||
|
|
|
@ -483,12 +483,12 @@ namespace ratgdo {
|
||||||
|
|
||||||
void RATGDOComponent::openDoor()
|
void RATGDOComponent::openDoor()
|
||||||
{
|
{
|
||||||
doorCommand(data::OPEN);
|
doorCommand(data::DOOR_OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::closeDoor()
|
void RATGDOComponent::closeDoor()
|
||||||
{
|
{
|
||||||
doorCommand(data::CLOSE);
|
doorCommand(data::DOOR_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::stopDoor()
|
void RATGDOComponent::stopDoor()
|
||||||
|
@ -497,12 +497,12 @@ namespace ratgdo {
|
||||||
ESP_LOGV(TAG, "The door is not moving.");
|
ESP_LOGV(TAG, "The door is not moving.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toggleDoor();
|
doorCommand(data::DOOR_STOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::toggleDoor()
|
void RATGDOComponent::toggleDoor()
|
||||||
{
|
{
|
||||||
doorCommand(data::TOGGLE);
|
doorCommand(data::DOOR_TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::doorCommand(uint32_t data)
|
void RATGDOComponent::doorCommand(uint32_t data)
|
||||||
|
@ -519,37 +519,37 @@ namespace ratgdo {
|
||||||
void RATGDOComponent::lightOn()
|
void RATGDOComponent::lightOn()
|
||||||
{
|
{
|
||||||
this->lightState = LightState::LIGHT_STATE_ON;
|
this->lightState = LightState::LIGHT_STATE_ON;
|
||||||
transmit(command::LIGHT, data::ON);
|
transmit(command::LIGHT, data::LIGHT_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::lightOff()
|
void RATGDOComponent::lightOff()
|
||||||
{
|
{
|
||||||
this->lightState = LightState::LIGHT_STATE_OFF;
|
this->lightState = LightState::LIGHT_STATE_OFF;
|
||||||
transmit(command::LIGHT, data::OFF);
|
transmit(command::LIGHT, data::LIGHT_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::toggleLight()
|
void RATGDOComponent::toggleLight()
|
||||||
{
|
{
|
||||||
this->lightState = light_state_toggle(this->lightState);
|
this->lightState = light_state_toggle(this->lightState);
|
||||||
transmit(command::LIGHT, data::TOGGLE);
|
transmit(command::LIGHT, data::LIGHT_TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock functions
|
// Lock functions
|
||||||
void RATGDOComponent::lock()
|
void RATGDOComponent::lock()
|
||||||
{
|
{
|
||||||
this->lockState = LockState::LOCK_STATE_LOCKED;
|
this->lockState = LockState::LOCK_STATE_LOCKED;
|
||||||
transmit(command::LOCK, data::ON);
|
transmit(command::LOCK, data::LOCK_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::unlock()
|
void RATGDOComponent::unlock()
|
||||||
{
|
{
|
||||||
transmit(command::LOCK, data::OFF);
|
transmit(command::LOCK, data::LOCK_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::toggleLock()
|
void RATGDOComponent::toggleLock()
|
||||||
{
|
{
|
||||||
this->lockState = lock_state_toggle(this->lockState);
|
this->lockState = lock_state_toggle(this->lockState);
|
||||||
transmit(command::LOCK, data::TOGGLE);
|
transmit(command::LOCK, data::LOCK_TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::saveCounter()
|
void RATGDOComponent::saveCounter()
|
||||||
|
|
|
@ -62,11 +62,19 @@ namespace ratgdo {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace data {
|
namespace data {
|
||||||
const uint32_t OFF = 0;
|
const uint32_t LIGHT_OFF = 0;
|
||||||
const uint32_t CLOSE = 0;
|
const uint32_t LIGHT_ON = 1;
|
||||||
const uint32_t ON = 1;
|
const uint32_t LIGHT_TOGGLE = 2;
|
||||||
const uint32_t OPEN = 1;
|
const uint32_t LIGHT_TOGGLE2 = 3;
|
||||||
const uint32_t TOGGLE = 2;
|
|
||||||
|
const uint32_t LOCK_OFF = 0;
|
||||||
|
const uint32_t LOCK_ON = 1;
|
||||||
|
const uint32_t LOCK_TOGGLE = 2;
|
||||||
|
|
||||||
|
const uint32_t DOOR_CLOSE = 0;
|
||||||
|
const uint32_t DOOR_OPEN = 1;
|
||||||
|
const uint32_t DOOR_TOGGLE = 2;
|
||||||
|
const uint32_t DOOR_STOP = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace command {
|
namespace command {
|
||||||
|
|
Loading…
Reference in New Issue