Use door stop command in place of toggle (#16)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Marius Muja 2023-06-25 08:52:16 -07:00 committed by GitHub
parent 385a89507b
commit eb6f40c060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 16 deletions

View File

@ -180,7 +180,7 @@ button:
id($id_prefix).query_openings();
- platform: template
id: ${id_prefix}_test
id: ${id_prefix}_sync
name: "Sync"
entity_category: diagnostic
on_press:

View File

@ -483,12 +483,12 @@ namespace ratgdo {
void RATGDOComponent::openDoor()
{
doorCommand(data::OPEN);
doorCommand(data::DOOR_OPEN);
}
void RATGDOComponent::closeDoor()
{
doorCommand(data::CLOSE);
doorCommand(data::DOOR_CLOSE);
}
void RATGDOComponent::stopDoor()
@ -497,12 +497,12 @@ namespace ratgdo {
ESP_LOGV(TAG, "The door is not moving.");
return;
}
toggleDoor();
doorCommand(data::DOOR_STOP);
}
void RATGDOComponent::toggleDoor()
{
doorCommand(data::TOGGLE);
doorCommand(data::DOOR_TOGGLE);
}
void RATGDOComponent::doorCommand(uint32_t data)
@ -519,37 +519,37 @@ namespace ratgdo {
void RATGDOComponent::lightOn()
{
this->lightState = LightState::LIGHT_STATE_ON;
transmit(command::LIGHT, data::ON);
transmit(command::LIGHT, data::LIGHT_ON);
}
void RATGDOComponent::lightOff()
{
this->lightState = LightState::LIGHT_STATE_OFF;
transmit(command::LIGHT, data::OFF);
transmit(command::LIGHT, data::LIGHT_OFF);
}
void RATGDOComponent::toggleLight()
{
this->lightState = light_state_toggle(this->lightState);
transmit(command::LIGHT, data::TOGGLE);
transmit(command::LIGHT, data::LIGHT_TOGGLE);
}
// Lock functions
void RATGDOComponent::lock()
{
this->lockState = LockState::LOCK_STATE_LOCKED;
transmit(command::LOCK, data::ON);
transmit(command::LOCK, data::LOCK_ON);
}
void RATGDOComponent::unlock()
{
transmit(command::LOCK, data::OFF);
transmit(command::LOCK, data::LOCK_OFF);
}
void RATGDOComponent::toggleLock()
{
this->lockState = lock_state_toggle(this->lockState);
transmit(command::LOCK, data::TOGGLE);
transmit(command::LOCK, data::LOCK_TOGGLE);
}
void RATGDOComponent::saveCounter()

View File

@ -62,11 +62,19 @@ namespace ratgdo {
*/
namespace data {
const uint32_t OFF = 0;
const uint32_t CLOSE = 0;
const uint32_t ON = 1;
const uint32_t OPEN = 1;
const uint32_t TOGGLE = 2;
const uint32_t LIGHT_OFF = 0;
const uint32_t LIGHT_ON = 1;
const uint32_t LIGHT_TOGGLE = 2;
const uint32_t LIGHT_TOGGLE2 = 3;
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 {