I have added your addition to the ST_Anything GitHub repository, hacks and all!
I donât have time to go through it in detail to make any improvements, however I also didnât want to forget about your contribution to the project. Hopefully others will find it helpful as well.
I did modify the comments sections to reflect the correct file names and to give you credit for the work.
Had a question about v2.9 that was posted. Github mentions âAdded Arduino OTA support for ESP8266â but Iâm not seeing any change in the example sketches or the libraries to support OTA. Can you give me a nudge in the right direction? Do we have to incorporate the OTA code from Arduino into the sketch from ST_Anything? Is there a version of a library where the info is located? Any first steps you might be able to give would be greatly appreciated.
Thanks again for this. I currently have 5 ESP8266 devices running throughout my house performing different functions. Saved me SOO much cash and no batteries to replace!
All of the Arduino OTA changes are located in the âSmartThingsESP8266WiFiâ library. I noticed my test NodeMCU was more prone to lockupâs after the OTA Update feature was added. I did some research and found an updated version of the ArduinoOTA.cpp file was available which prevents lockups.
Here is the post in the more current ST_Anything thread that details the patch.
Thanks for the ST_Anything! I use it on several devices and works really good!. I have started a new project to control mye ventilation system at home. It needs 3 relayâs to control speed. 1 for low. 1 for medium and one for high. When selection one of speeds the other relays needs to turn of. This I have managed to configure. The one thing I can not figure out is to get a fan control in SmartThings. I would like to use the standard control so I can use it with Action Tiles etc.
Iâve been trying to find the same thing!!! Canât find it anywhere. Iâve had to just use the 4 relays as separate devices which makes it so cumbersome.
Dan,
Iâve finally got the ST_Anything working with nodemcu. Now I want to implement this pulse counting flow-sensor. Can you give me some pointers how to integrate it into the flow?
Iâm going to have to think about that question⊠No one has asked for that device for years⊠What ST Device Capability do you think matches best with a flow meter? Perhaps a simple Voltage Measurement capability?
Iâll try to dust off that code and see if I can get it working on the ESP8266 platform. It may take me a little while to find some free time. Feel free to remind me in a few days if I donât get back you.
I think power device is closest. liters/minutes is like Kwh. Power meter also counts pulses typically. Many power meters will send out a pulse of light for every KW consumed. For the flow-sensor, a pulse is generated for every X liters of water flow. So counting pulses, every Y seconds is whatâs needed.
@cslee - I was able to get this working very quickly.
I created a new âChild Power Meterâ Device Handler, and updated the âParent_ST_Anything_Ethernetâ DTH accordingly. Please add/update your ST_Anything Groovy code accordingly (easiest to just use the GitHub integration if available to you.)
I have also revised some of the Arduino code to work with the ESP8266 platform. Please update your âŠArduino\libraries\ST_Anything folder with the new version of âPS_PulseCounter.hâ and âPS_PulseCounter.cppâ.
Finally, youâll need to add a device to your ST_Anything Arduino sketch.
be sure to add â#include <PS_PulseCounter.h>â at the top of your sketch, near the other include statements.
add a â#define PIN_PULSE D5â type of statement for whatever PIN you choose to use.
add a " static st::PS_PulseCounter sensor1(F(âpower1â), 60, 5, PIN_PULSE, FALLING, INPUT_PULLUP, 1.0, 0);" statement in your setup() routine. Read the header file comments to see what all of the arguments are used for. NOTE: You must use the name âpower1â in order for the child device to be created!
add a " st::Everything::addSensor(&sensor1);" statement in setup() to make sure ST_Anything knows about your new sensor device
Have fun! Please let me know if everything works as expected or if you have any issues.
Dan,
I updated the arduino libraries and DHT. I removed the device in ST and added it back. However I dont see the child power in ST. The water has disappeared in ST.
My sketch uses the following lines to declare the pulse counter and it works fine. Did you update the Parent Ethernet DTH as well? Did you publish it? Did you remember to go into the new Parent Device on your ST Phone App and configure its settings (i.e. MAC address, IP, and Port) ?
Dan,
Thanks. It was the Parent Ethernet DTH which did not get published. It appears in ST now. Iâll do more testing with the flow sensor now. Iâll let you know how it goes.
Dan,
It is working. The power registers some value when pulses are detected. A few seconds later it goes to 0.
How can I get two measures out of it. One is total cumulative pulse which can be reset (much like kWh in power meters) and another which measure pulse/minute (much like watts). Each one will need a scaling factor to adjust the value to (gallons) and second to gallons/hr. It much also be nice to have a days since reset for first measure.
Youâre going to have to probably modify the Child DTH to add that additional functionality yourself. Iâd rather leave the Arduino code as simple as possible. You should be able to modify the existing âChild Power Meterâ to create an accumulator and reset capability, along with scaling factors/algorithms.
For an example, take a look at my âChild Temperature Sensorâ as it allows for a user select F/C conversion, as well as a temperature offset. Youâll see these as User Preferences near the top, and then later where these values are used to adjust the raw incoming data before the final value is updated.
To get pulses/minute, simple change the 120 to 60 in the device declaration in your setup() routine.