Also, I’d use the IS_Water device, not a contact sensor. It works basically the same, but it’ll show up correctly as a water sensor. Just be sure to set the numReqCounts parameter to zero. Otherwise, it won’t trigger.
//******************************************************************************************
// File: IS_Water.cpp
// Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son)
//
// Summary: IS_Water is a class which implements the Hubitat "Water Sensor" device capability.
// It inherits from the st::InterruptSensor class.
//
// Create an instance of this class in your sketch's global variable section
// For Example: st::IS_Water sensor6(F("water1"), PIN_WATER, HIGH, true, 500);
//
// st::IS_Water() constructor requires the following arguments
// - String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
// - byte pin - REQUIRED - the Arduino Pin to be used as a digital input
// - bool iState - REQUIRED - LOW or HIGH - determines which value indicates the interrupt is true
// - bool internalPullup - OPTIONAL - true == INTERNAL_PULLUP
// - long numReqCounts - OPTIONAL - number of counts before changing state of input (prevent false alarms)
//
// Change History:
//
// Date Who What
// ---- --- ----
// 2020-06-30 Dan Ogorchock Original Creation
//
//
//******************************************************************************************
Please explain the parameters for these sensors. I'm assuming the first (60) is 60 seconds, but I don't know if that is the update time or read value interval.
The parameters are explained at the top of each device’s corresponding .cpp file in the comments section. In both of those examples, the 60 is the number of seconds the sensor is polled for fresh data. That data is sent to Hubitat immediately each time the sensor is polled.
a little off topic but I'm using a HC-SR501 with Hubduino but only getting about 10' range....anyone have a recommendation for a longer range motion sensor that will interface with an 8266 ?
Give a try and let us know how it works. I recall adding OTA update support for one of the platforms…just don’t recall which one off the top of my head…probably the ESP8266…
@kuzenkohome
Here is the code (bugs removed : ) ...
the sketch has a motion sensor and an illuminance sensor (so I can decide whether to close shade)
and also OTA support
interesting...can you say more... not sure what you mean ? The device did show up under ports, so it saw it ...just would not download to it..
I turned off 5G in case to force 2.4G and tried a bunch of other settings people suggested and no go. I also disabled other network adapters as someone suggested.
Do you have Python installed on your Arduino IDE computer? I believe that is all one needs for the ESP8266 OTA updates to work within the Arduino IDE. I use it regularly without any additional code in my sketches. The OTA code for the ESP8266 is already built in.
Yes, I did install Python 2.7.18 (64 bit)..however when I look now I have 3.8.2 (32 bit) also installed
Sorry...now I'm really confused are you saying I didn't have to change my arduino sketch at all to be able to update over the air?
THAT would be cool.... but everywhere I read said you had to download OTA first serially before it will work (and you have to include the support in each sketch)
Yes, you have to load via USB initially from the Arduino IDE to the ESP8266 board. Afterward, the device will appear as a port in the Arduino IDE. You simply select that port (don’t change my other settings), and then simply use the Arduino IDE to compile and load the sketch. That’s it. As I mentioned, the OTA support (for ONLY the ESP8266) is already built into the correct code.
I am pretty sure this is what I used years ago to add ESP8266 OTA support.
OMG (and sorry for so many questions)... but I still have to do the BasicOTA to enable ? Even though you have support in the code? But then after that I'm good?