From 7987cdaf481044f0394aaea41e54d27742251b0e Mon Sep 17 00:00:00 2001 From: Gregg Date: Mon, 24 Aug 2020 07:42:50 -0500 Subject: [PATCH] FInal Version of Zephyr2 Includes abilty to change brightness of light through HomeKit as well as with button. However, the vent light is too unstable to do this perfectly, and increasing brightness by stepping through multiple decreases is annoying. To do: Create Zephyr3 without brightness control and test to see how it works in practice. --- examples/ZephyrHood2/DEV_Zephyr.h | 55 +--------------------------- examples/ZephyrHood2/ZephyrHood2.ino | 4 -- 2 files changed, 2 insertions(+), 57 deletions(-) diff --git a/examples/ZephyrHood2/DEV_Zephyr.h b/examples/ZephyrHood2/DEV_Zephyr.h index 91c8bf8..25cb7c9 100644 --- a/examples/ZephyrHood2/DEV_Zephyr.h +++ b/examples/ZephyrHood2/DEV_Zephyr.h @@ -91,6 +91,7 @@ struct DEV_ZephyrLight : Service::LightBulb { if(resetLight){ power->setVal(false); + level->setVal(0); resetLight=false; } @@ -161,59 +162,7 @@ struct DEV_ZephyrFan : Service::Fan { } // button }; - -////////////////////////////////// - -struct DEV_ZephyrPower : Service::Switch { - - uint32_t code; - SpanCharacteristic *power; - int buttonPin; - - DEV_ZephyrPower(uint32_t code, int buttonPin, ServiceType mod=ServiceType::Regular) : Service::Switch(mod){ - - power=new Characteristic::On(); - new Characteristic::Name("Vent Power"); - this->code=code; - this->buttonPin=buttonPin; - - Serial.print("Configuring Zephyr Vent Hood Power 433MHz Transmitter with code: "); - Serial.print(code,HEX); - Serial.print("\n"); - new SpanButton(buttonPin); - - } - - StatusCode update(){ - - if(power->getNewVal()){ - LOG1("Activating Zephyr Vent Hood Power\n"); - transmitZephyr(code); - } - - return(StatusCode::OK); - - } // update - - void loop(){ - - if(power->getVal() && power->timeVal()>500){ // check that power is true, and that time since last modification is greater than 3 seconds - LOG1("Resetting Zephyr Vent Hood Power Control\n"); // log message - power->setVal(false); // set power to false - } - - } // loop - - void button(int pin, boolean isLong) override { - - LOG1("Activating Zephyr Vent Hood Power\n"); - transmitZephyr(code); - power->setVal(true); - - } // button - -}; - + ////////////////////////////////// void transmitZephyr(uint32_t code){ diff --git a/examples/ZephyrHood2/ZephyrHood2.ino b/examples/ZephyrHood2/ZephyrHood2.ino index a24905e..c8fa19c 100644 --- a/examples/ZephyrHood2/ZephyrHood2.ino +++ b/examples/ZephyrHood2/ZephyrHood2.ino @@ -23,10 +23,6 @@ void setup() { new DEV_Identify("Zephyr Fan","HomeSpan","ZVH-1","RF-Control","1.0",0); new DEV_ZephyrFan(0x51388,0x61398,16); - new SpanAccessory(); - new DEV_Identify("Zephyr Power","HomeSpan","ZVH-1","RF-Control","1.0",0); - new DEV_ZephyrPower(0x61398,19); - } //////////////////////////////////////