[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Ignore me it was my mistake! I had forgotten to change the IP of the hub from the default value! First project is now working perfectly ever since I ditched the breadboard, strange!

Can’t thank you enough for this software, the ability to make a SmartThings smart plug for a few pounds compared to the fortune they charge is amazing! Appreciate the help.

1 Like

can my L9110S be used like a Relay in ST_Anything?

Not without someone writing a new ST_Anything C++ class to support the L9110.

Hello,

Thank you for all your hard work that has gone into this! I’m trying to setup a garage door controller using the NodeMCU ESP8266 and have my sketch flashed onto the board. I also have my device handlers configured in my smartthings account.

I’m been able to add the new “Parent_ST_Anything_Ethernet” device, and it shows up in my iOS mobile app. The problem is it keeps saying ‘Checking status…’ and when I click it, I get "Can’t connect to device. Check device and try again’. I don’t see a prompt to enter any of the parameters. I am able to enter the parameters for the IP, MAC address, Port, and # buttons in the developer website for the device, but not through the mobile app. same behavior after the parameters are entered. Any ideas on what to try next?

Which ST Mobile App are you using? Please be sure to use the SmartThings Classic App.

Thank you,

I just downloaded the Classic app and I am now able to get the message to configure and enter the parameters directly from the app. I’ve done so and now it shows on the list with a ‘Refresh’ button, but no controls for open/close. I’m getting RSSI values in my Live Logging window for the device and see ‘Parsing: Door Open’ every few lines.

Please share the setup() function code here so I can see exactly what we’re dealing with.

Thank you again - Excluding comments here is everything in the setup() function:

Side note: High likelihood something is going wrong here as when i tried one of the example sketches as-is the child devices are added as expected.

  static st::IS_DoorControl sensor1(F("Door"), PIN_CONTACT_GARAGE_DOOR, LOW, true, PIN_RELAY_GARAGE_DOOR, LOW, true, 1000);

  st::Everything::debug=true;
  st::Executor::debug=true;
  st::Device::debug=true;
  st::PollingSensor::debug=true;
  st::InterruptSensor::debug=true;

   st::Everything::callOnMsgSend = callback;

    st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);

  st::Everything::init();

  st::Everything::addSensor(&sensor1);

  st::Everything::initDevices();

change the above line to

static st::IS_DoorControl sensor1(F(“doorControl1”), PIN_CONTACT_GARAGE_DOOR, LOW, true, PIN_RELAY_GARAGE_DOOR, LOW, true, 1000);

The names of the devices are very specific, and case sensitive. See the ReadMe for more information about how every device must be assigned a very specific and unique name.

  1. The names of the devices you create in the Arduino setup() routine MUST MATCH EXACTLY the names the Parent Device Handler code expects. The names are CaSe SenSiTiVe! Do not get creative with naming in the Arduino sketch as the Child Devices will not be created. Follow the naming convention as seen in the “ST_Anything_Multiples_xxxx.ino” sketches

Contact Sensors: “contact1”, “contact2”, “contact3”, …
Alarm: “alarm1”, “alarm2”, “alarm3”, …
Motion: “motion1”, “motion2”, “motion3”, …
Smoke Detectors: “smoke1”, “smoke2”, “smoke3”, …
Switch: “switch1”, “switch2”, “switch3”, …
Dimmer Switch: “dimmerSwitch1”, “dimmerSwitch2”, “dimmerSwitch3”, …
RGB Switch: “rgbSwitch1”, “rgbSwitch2”, “rgbSwitch3”, …
RGBW Switch: “rgbwSwitch1”, “rgbwSwitch2”, “rgbwSwitch3”, …
Door Control: “doorControl1”, “doorControl2”, “doorControl3”, …
Water Sensor: “water1”, “water2”, “water3”, …
CO Detector: “carbonMonoxide1”, “carbonMonoxide2”, “carbonMonoxide3”, …
Button: “button1”, “button2”, “button3”, …
Illuminance: “illuminance1”, “illuminance2”, “illuminance3”, …
Voltage: “voltage1”, “voltage2”, “voltage3”, …
RelaySwitch: “relaySwitch1”, “relaySwitch2”, “relaySwitch3”, …
Temperature: “temperature1”, “temperature2”, “temperature3”, …
Humidity: “humidity1”, “humidity2”, “humidity3”, …
Special Case DHT22 Temp/Humid: “temphumid1” along with last two arguments being “temperature1” and “humidity1”,

1 Like

Thank you again Dan!

That solved the problem and makes perfect sense. I must have overlooked this when going through the ReadMe.

Have a great evening!

1 Like

Another question if someone has any ideas:

What is the best way to integrate these ST_Anything child devices (A garage door controller) in my instance, with Alexa/Stringify/IFTTT. It seems that the door controller devices aren’t able to be used in Stringify/IFTTT, and Alexa also doesn’t support it. I’ve tried to create a SmartThings Routine which controlled the garage door but Alexa won’t run the routine since it contains an unsupported device. The goal would be to add voice commands such as ‘Alexa, close the garage door’ or similar. Another would be able to add ‘Close garage door’ in my Stringify routine for ‘goodnight’.

One workaround I can think of is instead of using a ‘door controller’ device, is to use two seperate devices, a relay switch, and a normal contact sensor. The Arduino relay switch would toggle the garage (press the garage door opener button for 1 second). The contact sensor would read the open/closed garage status. One routine would be ‘Open Garage’ which would be “If garage closed, then turn on relay switch”. The ‘Close Garage’ would be “If garage open, then turn on relay switch”. Since relay switches and contact sensors seem supported in Stringify/Alexa the voice commands should be possible to call these routines. Just some thoughts but a cleaner solution would be to figure out a way to get the door controller device working directly.

Just to make sure you understand the current implementation of the Door Control device in ST_Anything… It behaves exactly like the manual pushbutton of your existing garage door opener. This means that it doesn’t matter well you tell the door to open or close, it always just ‘presses the button’ and the door moves.

So, if the garage door is already closed, and then you run a routine to ‘close()’ the door, the door will open. There is no check internally anywhere to evaluate whether or not the relay should be fired.

There are three commands implemented in the Child Door Control device handler - open(), close(), and push(). All three do the exact same thing - fire the relay output on the ST_Anything microcontroller.

Please keep this in mind as you try to automate a garage door. Also, please keep safety as your number 1 priority whenever automating anything mechanical, like a garage door. Closing the door on a sleeping pet, or a child who is playing underneath, could have devastating results. I do not try to ‘automate’ my garage doors. I simply monitor their statuses and alert me if the doors are open when they shouldn’t be. I then take action to determine how to safely close the doors (e.g. check a video camera feed to be sure it is safe to close the door, then click on the door control device in ST to close it.)

@bob5731 - Just wanted to let you know that I have just added SERVO MOTOR SUPPORT to ST_Anything.

You will need to update your ST Device Handlers to pick up the changes and to add the new 'Child Servo" device handler.

You will need to update your ST_Anything libraries and sketches from my GitHub repository to pick up the new library files and example sketch.

You should then start with the ST_Anything_Servos_ESP8266WiFi.ino sketch as a starting point. It demonstrate using two servo motors attached to a single NodeMCU ESP8266. Please be aware that USB power is NOT sufficient to run two small servos at the same time (one small servo motor seemed fine being powered by my computer’s USB connection, 2 was a no go.) You’ll need to power the servos via a 5v power supply if you attach more than 1. You do NOT need to wire both servos to start testing. Just start with one servo.

Just stick with the example sketch to get things up and running. Also, do NOT attempt to reuse an existing Parent Device that already has child devices associated with it. Start with a fresh Parent Device so it only has the Child Servo devices.

I have mapped the standard ST “Switch Level” capability (0 to 99) into servo motor angles (0 to 180). Both values are displayed on the Child Servo device detail page in the ST Classic Mobile App. You will change the slider (switch level) from 0 to 99%, which will then correspond to the servo moving from 0 to 180 degrees.

Good luck with your project!

1 Like

Does this also work for Motors?

Thank you so much for service support

It works for standard Servo Motors. That’s it. That’s what you asked for. Use it. Enjoy.

This is what I tested with

https://m.ebay.com/itm/10x-9G-SG90-Micro-Servo-Motor-For-RC-Robot-Helicopter-Airplane-Aircraf-Car-Boat/331962676921?epid=526041964&hash=item4d4a8476b9:g:kEgAAOSwmLlX16qO

These do not have a lot of torque, so you may need larger, more powerful ones.

This is what I want to end up controlling with SmartThings

Sorry Bob. Pictures are helpful, but I have no idea what specific devices you’re showing.

The last time we spoke about your automated vents project, you said you wanted SERVO MOTOR control. That is what I delivered.

Yes I know I appreciate that but found out by talking to a couple Electronics engineers that that was not the way to go. would have started with this vent but it was too expensive at the time. If I figure out how to run a motor with SmartThings I will let you know. My next project in the works will be smart blinds.

Hey All,

I have an couple of analog inputs looking at the water levels in some tanks, I am wanting to see the readout as a bar of come sort, I have been trying to use the ‘water’ sensors in ST_Anything, but they just seem to be a binary dry/wet? Any suggestions of what ‘widget/sensor’ type to use?

Thanks!

The easiest ST_Anything device to use for this is the PS_Voltage sensor. This allows you to scale any analog input into whatever engineering units you want. You can then take the “Child Voltage Sensor” DTH and make a customized one that suits your needs. You can manually assign your custom DTH after the Child Voltage device is automatically created.

Does that make sense? Let me know if you have any questions.

Here is the documentation for the PS_Voltage device so you can configure it correctly in the sketch’s setup() routine:

//  Summary:  PS_Voltage is a class which implements the SmartThings "Voltage Measurement" device capability.
//			  It inherits from the st::PollingSensor class.  The current version uses an analog input to measure the 
//			  voltage on an anlog input pin and then scale it to engineering units.
//
//			  The last four arguments of the constructor are used as arguments to an Arduino map() function which 
//			  is used to scale the analog input readings (e.g. 0 to 1024) to Engineering Units before sending to SmartThings. 
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_Voltage sensor1("voltage1", 120, 0, PIN_VOLTAGE, 0, 1023, 0.0, 5.0);
//
//			  st::PS_Voltage() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- byte pin - REQUIRED - the Arduino Pin to be used as an analog input
//				- double s_l - OPTIONAL - first argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - minimum raw AI value
//				- double s_h - OPTIONAL - second argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - maximum raw AI value
//				- double m_l - OPTIONAL - third argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Min (or Max if inverting)
//				- double m_h - OPTIONAL - fourth argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Max (or Min if inverting)
//				- byte numSamples - OPTIONAL - defaults to 1, number of analog readings to average per scheduled reading of the analog input
//				- byte filterConstant - OPTIONAL - Value from 5% to 100% to determine how much filtering/averaging is performed 100 = none (default), 5 = maximum
//
//            Filtering/Averaging
//
//				Filtering the value sent to ST is performed per the following equation
//
//				filteredValue = (filterConstant/100 * currentValue) + ((1 - filterConstant/100) * filteredValue) 
//