rc-gateway/libraries/Tiny/ContactSensor.h

21 lines
390 B
C++

#pragma once
#include <TinySensor.h>
class ContactSensor: public TinySensor {
SensorType sensorType = CONTACT;
public:
ContactSensor(short id) :
TinySensor(id) {
}
void sendStateAndVoltage(bool state) {
sendInfo(ID(id) | VCC(readVcc()) | STATE(!state) | TYPE(sensorType));
}
void sendState(bool state) {
sendInfo(ID(id) | VCC(0) | STATE(!state) | TYPE(sensorType));
}
};