[RELEASE] OmniThing v0.8.2 - ESP8266/ESP32/RaspberryPi/Linux/Windows - A cross-platform successor to ST_Anything - Web-based Configuration Tool

Hi Daniel,

Apologies - stuck again… I used to be able to code, but back in the VB days, so the question I’m asking is probably really stupid…
I’m attempting to compile on Windows. I have Visual Studio installed with CMake. I’ve checked out the code from GitHub, but I can’t work out how to compile…
This is likely down to the fact that I don’t know how to use Visual Studio or CMake - Apologies.
On opening I had one error in the error list window:

Severity Code Description Project File Line Suppression State
Error CMake Error at C:\Users\james.heath\Source\Repos\OmniThing\CMakeLists.txt:2 (project):
Generator

Visual Studio 15 2017

could not find any instance of Visual Studio. OmniThing C:\Users\james.heath\Source\Repos\OmniThing\CMakeLists.txt 2

And the Install & Compile options under the Build menu are greyed out.

Aha -
It looks like if you download VS now, it downloads VS 2019.
You’ve specified the generator in “CMakeSettings.json” - if I delete that, it remakes it correctly and seemed to compile, or at least gets further…

I do get this error though:

1> [CMake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
1> [CMake] Please set them or make sure they are set and tested correctly in the CMake files:
1> [CMake] ws2_32_LIBRARY_PATH
1> [CMake] linked by target “OmniThing” in directory C:/Users/james.heath/source/repos/OmniThing

So I’m still getting something wrong…

EDIT: I’ve done a bit more digging.
The command " find_library(ws2_32_LIBRARY_PATH ws2_32)"
appears to be failing to find ws2_32.lib
However these do exist in various forms under “C:\Program Files (x86)\Windows Kits\10\Lib”

I’m stumped & a bit out of my depth!!

Hello Daniel,

Thanks. I will tried but the website http://omnithing.net/ is not accessible

regards

See the post 2 above.

@Ej3359 @jamesxheath - omnithing.net is back online

1 Like

Hi James,

I just tried rebuilding with VS 2017, and that’s working correctly, so maybe it’s a 2019 issue. I admit I have been neglecting the windows build due to lack of people using it.

What build target are you using? I think I’ve done all my testing targeting 64 bit, so if you’re trying 32 bit check if 64 works.

Thanks Dan,

I’m using 64 bit.
I know I really ought to be doing everything in Linux, and I hope to move to a Pi at some point - I already have a windows box running 24/7 though and it’s what I know!
For now, I’ve gone down the temporary route of writing my own code for the windows side of things, grabbing & parsing the data and slinging it via cURL at ST_Anything, as I have that running & understand the syntax.
The plan was to get that going and then move to Omnithing in the future (probably on Linux).
I’ve hit an issue outside of ST though - on 2 test PCs, everything works fine, but on the target PC I can’t get the remote SD card to map to a drive - something is knackered with webDAV. Ho hum!

Thanks again - I’ll be back in the future!

James

Thanks Daniel,

I can export JSONConfig but the are some trouble to download Arduino headers (empty file) ou arduino sketch (downlad doesn’t run)

Regard

The sketch download feature should now be working again.

Thanks Daniel

Momentary device with TimedOutputBool work fine :slight_smile:

@leinax

Hi. I am looking forward to migrating over from STAnything to OmniThing.

Question: Is there an ultrasonic sensor device or can you help me understand how to configure this device using the current capabilities?

The application is a door sensor. When the distance measured is < x the door is open; greater than x; the door is closed.

Thanks again for this great platform.

Hi Curt,

Which specific ultrasonic sensor are you intending to use? I haven’t written any support for one yet.

I am using an HC-SR04.

If there is a way you can ‘show’ me how you do this I’d love to give it a try. Especially if it helps you, since you seem to be doing this with very little help.

Thanks for all of your great work.

I think I have an HC-SR04 lying around that I could try adding support for in the next week or so. If you would like to try adding support for it yourself, I’d welcome the contribution.

Are you planning to run this on an ESP32/8266 or on a raspberry pi? I ask because I doubt this will work reliably on the Pi due to the seemingly tight timing requirements outlined in the datasheet. I think for the pi it would be better to use one of the out of tree kernel drivers available for it in combination with OmniThing’s command parsing to read the distance measurements.

For ESP support, we just need to add a new file to src/embedded_common/lib called something like hcsr04.cpp . It would derive from the class called InputFloat and would return the measured distance in its getFloat() method. Elsewhere we could handle the conversion from the float to a boolean based on it being greater than or equal to a range.

Edit: It actually looks like there’s now an in-tree kernel driver for the module here https://github.com/torvalds/linux/blob/master/drivers/iio/proximity/srf04.c

I’ll run this on an ESP.

Is there a similar device in the library you would start with?

I’ll give it a try.

One thing that has held me back is I haven’t been able to figure out the architecture of the Omnithing platform. I am new to this level of programming on the Arduino/ESP devices.

src/arduino/lib/AnalogInputPinArduino.cpp is an example of a simple InputFloat type. src/embedded_common/lib/DhtReader.cpp shows how you can use gpios in a platform-independent way using DigitalInputPin::create() and DigitalOutputPin::create(). You will need a function to create your class from json (see AnalogInputPinArduino’s createFromJson function).

Edit: Also see the readme for a more general explanation of OmniThing’s design and architecture. You will need to follow the Arduino build instructions to make local changes. There is also a section called “Contributing to OmniThing” that includes several tips.

1 Like

Thx. Will keep working.

Daniel,
Thanks for the advice and suggestions. This is painfully slow because I am trying to learn OmniThing and this type of coding at the same time. That being said I am plugging away because I really do want to learn to do this.

The HCSR-04 has two pins. The first is the trigger pin which starts an ultrasonic ping. The second is the echo pin which returns a numeric value containing the duration in microseconds from the sending of the ping to the reception of its echo off of an object. This duration is then converted to distance or volume through some basic formulas.

I can get this to work in a “stand alone” fashion on an ESP3286 with a simple sketch but properly integrating it into OmniThing is my challenge.

My assumption is that in the hcsr04.cpp file I need to create the trigger pin as an digital output that is pulled low/high/low and to create and read a digital input that is read to obtain the duration. Is this roughly correct?

Thanks for nudging me forward.

Curt

Hi Curt,

Yes, see the inputPin and outputPin initialization in DhtReader.cpp’s constructor for an example of using the digital input/output create() functions. Eventually you’ll need a function to parse a json configuration which will have the gpio pin numbers you need. Then you’ll initialize class members using those supplied pins (see DhtReader.cpp’s createFromJson function for an example).

You’ll need to implement the readFloat() function for the hcsr04 class (which will be a class derived from the InputFloat class). In that readFloat() function you can do the trigger and echo pin handling to read the distance, convert it to a float, and return that as the value. See AnalogInputPin.cpp for how to implement an InputFloat.

1 Like

Thanks for the quick reply

Firstly, thank you to everyone for the development of this project and support. You guys are the best.

I am trying to build a very simple ESP8266 temperature and humidity sensor for my shed using a DHT22 module. Physical wiring is good, and it seems to be talking to my SmartThings hub. App setup looks good. The problem is that the sensor doesn’t seem to actually be reading any actual data. The app is reporting that the room temperature is 59 degrees Fahrenheit and the humidity is 1.3%. Those numbers feel wildly inaccurate. My Nest says that the hallway temperature 15 feet away is 69 and the humidity is 43%.

I did some tinkering with the config.json, and I suspect that I screwed up the maxVoltage values. Here’s my config:

{
    "NetworkReceiver": {
        "type": "NetworkManagerEsp8266",
        "port": 8090,
        "ssid": "MyNetwork",
        "password": "MyPassword"
    },
    "NetworkSender": {
        "type": "NetworkManagerEsp8266",
        "port": 39500,
        "ip": "192.168.1.109",
        "ssid": "MyNetwork",
        "password": "MyPassword"
    },
    "CompositePeriphs": [
        {
            "type": "DhtReader",
            "name": "ShedDHT",
            "pin": 13,
            "pullup": true,
            "dht11": false
        }
    ],
    "Devices": [
        {
            "triggers": [
                {
                    "interval": 5000,
                    "offset": 5000,
                    "command": "poll"
                }
            ],
            "subscriptions": [
                {
                    "source": "ShedHumid",
                    "event": null,
                    "command": "poll"
                }
            ],
            "type": "RelativeHumidityMeasurement",
            "name": "ShedHumid",
            "input": {
                "type": "AnalogInputPinArduino",
                "pin": 13,
                "minVoltage": 1,
                "maxVoltage": 3.3
            }
        },
        {
            "triggers": [
                {
                    "interval": 5000,
                    "offset": 5000,
                    "command": "poll"
                }
            ],
            "subscriptions": [
                {
                    "source": "ShedTemp",
                    "event": null,
                    "command": "poll"
                }
            ],
            "type": "TemperatureMeasurement",
            "name": "ShedTemp",
            "input": {
                "type": "AnalogInputPinArduino",
                "pin": 13,
                "minVoltage": 1,
                "maxVoltage": 15
            }
        }
    ]
}

When I used the web config tool, I used 3.3 as the maxVoltage of ShedHumid because the VIN pin of the sensor is connected to the 3.3 pin of the ESP8266. I honestly don’t know where the 15 for the ShedTemp came from. Bad copy/paste? Sheer stupidity?

Does anyone see any glaringly obvious errors? Have I correctly pinpointed the problem?

Many thanks!

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.