Make the example work as is (#3630)

The HVAC component will not appear without valid initial values sent from the sketch. Initial default values added to avoid the problem.
This commit is contained in:
mortenmathiasen 2017-10-15 21:33:06 +02:00 committed by Fabian Affolter
parent f762f779a2
commit b5119b9d57

View File

@ -98,6 +98,8 @@ MyMessage msgHVACSetPointC(CHILD_ID_HVAC, V_HVAC_SETPOINT_COOL);
MyMessage msgHVACSpeed(CHILD_ID_HVAC, V_HVAC_SPEED); MyMessage msgHVACSpeed(CHILD_ID_HVAC, V_HVAC_SPEED);
MyMessage msgHVACFlowState(CHILD_ID_HVAC, V_HVAC_FLOW_STATE); MyMessage msgHVACFlowState(CHILD_ID_HVAC, V_HVAC_FLOW_STATE);
bool initialValueSent = false;
void presentation() { void presentation() {
sendSketchInfo("Heatpump", "2.1"); sendSketchInfo("Heatpump", "2.1");
present(CHILD_ID_HVAC, S_HVAC, "Thermostat"); present(CHILD_ID_HVAC, S_HVAC, "Thermostat");
@ -108,6 +110,13 @@ void setup() {
void loop() { void loop() {
// put your main code here, to run repeatedly: // put your main code here, to run repeatedly:
if (!initialValueSent) {
send(msgHVACSetPointC.set(20));
send(msgHVACSpeed.set("Auto"));
send(msgHVACFlowState.set("Off"));
initialValueSent = true;
}
} }
void receive(const MyMessage &message) { void receive(const MyMessage &message) {