Skip to content

Commit

Permalink
Merge pull request #39 from vi7/outfan_control
Browse files Browse the repository at this point in the history
Outfan control
  • Loading branch information
vi7 authored Dec 26, 2022
2 parents 84909a6 + 8e67a35 commit cf32269
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
#define SSR_OUTLET_ON 0x17703
#define SSR_OUTLET_OFF 0x1770C

#define OUTFAN_ON_CODE OUTLET1_ON
#define OUTFAN_OFF_CODE OUTLET1_OFF
#define HUM_ON_CODE SSR_OUTLET_ON
#define HUM_OFF_CODE SSR_OUTLET_OFF
#define HUM_MAINS_ON_CODE OUTLET2_ON
Expand All @@ -83,7 +85,7 @@ const uint8_t TEMP_HYSTERESIS = 10;
// Recommended RH values:
// - vegetative - 60%
// - flowering - 50%
const uint8_t MAX_RH = 60;
const uint8_t MAX_RH = 50;
const uint8_t RH_HYSTERESIS = 20;
// lamp check interval in seconds
const uint8_t LIGHT_CHECK_INTERVAL = 10;
Expand Down
2 changes: 1 addition & 1 deletion include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
#ifndef VERSION_H
#define VERSION_H

#define VERSION "0.13.0"
#define VERSION "0.14.0"

#endif
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ WebServer server(WEB_SERVER_PORT);

#ifdef RADIO_POWER
RCSwitch PowerManager::transmitter = RCSwitch();
Device outFan(OUTFAN_ON_CODE, OUTFAN_OFF_CODE);
Device hum(HUM_ON_CODE, HUM_OFF_CODE);
/*
* Additional 'humMains' device switches on an outlet on main power
Expand Down Expand Up @@ -136,6 +137,7 @@ void setup() {
timer.setInterval(htu2xD.getReadInterval(), []{htu2xD.rhDataHandler(&hum, MAX_RH, RH_HYSTERESIS);});
timer.setInterval(LIGHT_CHECK_INTERVAL * 1000, []{ldr.lampStatus();});

outFan.powerOn();
humMains.powerOn();
waterScheduler = Scheduler([]{
waterDevice.scheduledWater(
Expand All @@ -144,9 +146,10 @@ void setup() {
}, WATER_SCHEDULE);
lampOnScheduler = Scheduler([]{lamp.scheduledPowerOn(lampOnScheduler);}, LAMP_ON_SCHEDULE);
lampOffScheduler = Scheduler([]{lamp.scheduledPowerOff(lampOffScheduler);}, LAMP_OFF_SCHEDULE);
/* Uncomment lines below to enable automatic on/off schedule for the fan */
/* Uncomment scheduler lines below to enable automatic on/off for the fan */
// fanOnScheduler = Scheduler([]{fan.scheduledPowerOn(fanOnScheduler);}, FAN_ON_SCHEDULE);
// fanOffScheduler = Scheduler([]{fan.scheduledPowerOff(fanOffScheduler);}, FAN_OFF_SCHEDULE);
fan.powerOn();
humOnScheduler = Scheduler([]{hum.scheduledPowerOn(humOnScheduler);}, HUM_ON_SCHEDULE);
humOffScheduler = Scheduler([]{hum.scheduledPowerOff(humOffScheduler);}, HUM_OFF_SCHEDULE);

Expand Down

0 comments on commit cf32269

Please sign in to comment.