Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sensors/SensorDigitalOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ class SensorDigitalOutput: public Sensor {
void onSetup() {
// do not average the value
children.get()->setValueProcessing(NONE);
// setup the pin
// First, set pin status. This will effect only the pullup at first
setStatus(OFF);
// Now, setup the pin mode
pinMode(_pin, OUTPUT);
// setup the off pin if needed
if (_pin_off > 0) pinMode(_pin_off, OUTPUT);
Expand All @@ -121,8 +123,7 @@ class SensorDigitalOutput: public Sensor {
// keep track of the value in EEPROM so to restore it upon a reboot
children.get()->setPersistValue(true);
#else
// turn the output off by default
setStatus(OFF);

#endif
};

Expand Down
3 changes: 2 additions & 1 deletion sensors/SensorRelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ SensorRelay

class SensorRelay: public SensorDigitalOutput {
public:
SensorRelay(int8_t pin, uint8_t child_id = 0): SensorDigitalOutput(pin, child_id) {
SensorRelay(int8_t pin, bool inverted = false, uint8_t child_id = 0): SensorDigitalOutput(pin, child_id) {
_name = "RELAY";
setInvertValueToWrite(inverted);
children.get()->setPresentation(S_BINARY);
children.get()->setType(V_STATUS);
children.get()->setDescription(_name);
Expand Down