Design principles: The bare minimum
- Pressing the "play" button causes the fan to start and a counter to start counting down, e. g. 30 minutes.
- When the countdown reaches 0, the fan stops.
- Pressing the "stop" button stops the fan. This may be the same button as to start it.
- The housing shall be waterproof, due to the humid environment it is necessary to protect the electronics.
- The controller shall know the state of the fan.
- The fan can be remotely switched on by the controller. This way, we can set the fan to be on at least once per day, e.g. in the afternoon from 14h onwards.
- Switching the fan remotely on causes the counter to start as if the "play" button was pressed.
- If the fan is on, and a remote command starts the fan again, the counter value goes back to the start value - NO: there is no such command - it is a toggle.
- If the fan is on, a remote command shall be able to stop the fan immediately.
- The fan has a europlug.
Optional features that did not make it
- Powering up shall cause the fan to be off - NO: last state is remembered.
- The counter start value shall be programmed fixed in the fan module - NO: in the controller.
- All functions shall work independently of the controller - NO: goal not reached.
- The counter start value shall be programmed in the fan module. Maybe with a rotary encoder with 10 positions we can set 10 minute intervals; 10, 20, 30, ... 90 minutes. - NO: it is a Domoticz setting.
- The starting value of the counter can be adjusted in a menu per minute. On the module or on the controller?
- Optional: Once the fan is on, the user can press the up or down keys to increase/decrease the counter.
- Optional: The module shall measure the air humidity, and switch on above a certain percentage (and then off below a lower given percentage). This is good in the summer, but not in the winter, because then the heater is probably on too - and you do not want the heater on with the fan running.
- When started due to humidity rise, there shall be a timeout after which the fan goes off, even if the humidity did not go down.
- If this module has a display and 6 buttons, then: Potential case at https://www.thingiverse.com/thing:142282
- The room should have a window open sensor and an automatic control of the heater, which may all work together with rules and maybe scenes on the controller.
- Optional: The module shall measure the current through the relay, and switch off when excessively low or high.
- One button
After 1800s the fan goes off:
Every day, the timer switches the fan on for a while:
If the humidity is too high, the fan goes on:
Based on https://www.mysensors.org/build/relay
Code at: fanmodule
This node is also a MySensors repeater, see https://www.mysensors.org/about/network.
Start without gateway
This chapter explains what will happen when the gateway can not be found.
version 2.1 nodes while booting will not proceed to the loop part of the sketch if the gateway is not found. You can however force them to move on. The line of code you need is...
#define MY_TRANSPORT_WAIT_READY_MS 3000
This code tells the node how long to wait for the uplink to be established before moving on to the rest of the sketch. The number at the end is how long to wait in milliseconds, in this case 3000ms (3 seconds). You can set this to a time of your choosing.
if the node establishes the uplink it will move on without any delay.
The above line is placed near the top of your sketch somewhere before
have a look at these for a bit more detail....
Synchronising Light switch: https://forum.mysensors.org/topic/6948/synchronising-light-switch