I’m moving to the next phase of my project: setting up the communication between the different devices. For simplicity sake I’ll limit it two 2 zones (there are in reality 7 in total). It turns out that this brings up a TON of questions, so apologies for the lengthy post…
SETUP:
Zone 1: Living Room
- thermostat device (reads the temperature and shows the target temperature, has Up/Down button to change the target T)
- relay device (turns on/off the pump and valve system)
Zone 2: Bed Room
- thermostat device
- relay device
CENTRAL Device, This is the processing unit that:
- communicates with the blynk app (shows all states and temperatures)
- receives current T from all thermostats
- receives target T from all thermostats
- sends ON/OFF state to all relays (which turns on/off pump, open/close valves)
- sends ON/OFF to all thermostats (which show this state on screen)
- sends target T update (when this is changed in the Blynk app) to all thermostats
QUESTIONS:
ANSWERED! 1. I gather from the documentation that EACH DEVICE requires its own authentication token. Is that right?
ANSWERED! 2. if so: how do I create these tokens? (do I need to create 12 projects for that, even though I’m only directly communicating with one: CENTRAL)?
ANSWERED! 3. Can I change (from the documentation) this:
WidgetBridge bridge1(V1); //Initiating Bridge Widget on V1 of Device A
into this:
WidgetBridge bridge_livingroom(V1); //Initiating Bridge Widget on V1 of Device A
- if that is possible can I then keep using V1 for other zones as well so:
WidgetBridge bridge_livingroom(V1); WidgetBridge bridge_bedroom(V1);
- When I push a value, how does the other side of the bridge ‘know’ that the value is pushed? I see this in the doc:
BLYNK_WRITE(V5){ int pinData = param.asInt(); //pinData variable will store value that came via Bridge }
but do I need to check (e.g. every second) whether V5 has changed? Or is there an event that is triggered? Or is BLYNK_WRITE() the event handler? E.g.:
BLYNK_WRITE(V5){ //V5 is heat indicator on the OLED screen of the thermostat
int pinData = param.asInt(); //pinData variable will store value that came via Bridge
heatOn = pinData; //heatOn is a Boolean
updateOLED(); //this function updates the OLED screen indicating that the heat is on or off
}
ANSWERED! 6. Arduino-IDE when compiling it checks the board to which it compiles (Wemos D1) and allows me to use the pin numbers on the board instead of the gpio numbers, so D0, D1, D2, … A0. Lets say that the relay is connected to ‘D6’ can I update it directly and correctly with:
bridge_relay.digitalWrite(D6, HIGH);
- to communicate everything with the app I need to communicate 5 values (target T, current T, heaton, maintenance and error) per zone. There are 7 zones, so 35 values to the app. Is that possible? Reason I ask is that the max virtual pin I see is: 31, so Im short 4. Any way around this?
Once more: thank you very much for looking at this!