This is not directly related to openHAB but certainly to DIY home automation in general.
Looking for recommendations to steer me in the right direction – what development environment are you using for your ESP8266/ESP32 projects?
I got into microcontrollers less than three months ago, but as an experienced programmer I outgrew the Arduino IDE within hours.
I spent some time trying to install Eclipse and the Arduino plug-in, but couldn’t get it working.
I then tried Sloeber, and I did get that working, so I settled on that and have been using it ever since.
Today, I discovered that the person who developed Sloeber actually abandoned it before I even started using it! Oops.
It works for me right now, but being abandonware it’s going to get long in the tooth eventually. Maybe it’s better to change sooner rather than later, before I get too attached to it.
Is anyone using PlatformIO?
Do you have anything else to recommend?
What part of the Arduino ide did you out grow? There are some fairly large projects that use the Arduino ide?
I have tried platform io but I still find the Arduino ide easier to use for most things I do. Platform has some better options if you like auto download of libraries and such possibly. Other than that can’t find any benefit.
For my own stuff I use ESPEasy firmware. If Tasmota supported analog sensors out of the box I’d use it instead as it has a central administration server which is pretty nice. I can easily export a config and import it on another device making cloning identical devices (e.g. temp/humidity/light sensors) super fast.
I could code everything myself. I actually do so on many projects on Arduino and ESPs for non-home automation projects. When I’ve done so I’ve used the plain old Arduino IDE. The code I need to write for these microcontrollers are rarely complex enough where I need much more than that.
For home automation though, having OTA updates and nice web pages to check status and logs, plus how quickly I can go from nothing to a working sensor or relay far outweighs any enjoyment I’d get from coding it myself. I’ll let someone else worry about the code that runs on the micro controllers and focus on the higher level problems of the home automation I’m building.
Why, several actually.
As a programming environment, the Arduino IDE is incredibly spartan.
- Visual Studio 6 (released in 1998) has code completion. Arduino IDE doesn’t. Especially when working on a different platform from what you’re used to, code completion saves a lot of time, because it makes the environment partly self-documenting.
- Arduino IDE doesn’t remember the hardware settings per sketch. That one surprised me actually. I’ve only been doing MCUs for less than three months but I already have 11 different MCU units in service, built from mostly individual projects but with shared base code. There will be more, I have drawers full, waiting. That brings us to…
- Library management. Being able to have have per-project preprocessor definitions and having them apply to libraries as well… Some public libraries require this, mind you. TFT_eSPI for example. You have to define the screen hardware by modifying header config files. Thus, the only way to use that same library from more than one project (with different hardware) is a per-project preprocessor definition.
There are probably more but any one of those three things is enough for me.
If you’re curious what the 11 in-service MCU’s are:
- Wemos D1 board
- IR emitter to control the air conditioner
- 1.3" TFT display
- 433 MHz receiver for remote controls
…three standalone ESP-01 modules, mostly for the challenge. 1MB Flash!
- IR Emitter in the housing of each of three ceiling fans.
- HTTP + UDP requests, and MQTT publishing when someone pushes my Ring doorbell.
- Triggered by a spare pole on the relay which switches power to the 220 volt AC door chime when the 24 volt AC ring circuit is pushed. Yes, 220 volt AC doorbells are actually standard here, and buttons + chimes are designed for it. Imagine 220 volt going straight to the button. Yikes! Anyway, ring has no API so this was the easiest and best way.
GateController and GateSlave
Two completely custom perfboards each with a NodeMCU, optocouplers, RS-485 transceivers. Controls my left and right main gates and keeps them in sync. There’s no way to link the original controllers. I will write this project up in detail some time, this one is worth a post in the “what did you automate today” thread.
- 433 MHz remote receiver. Receives signals from wall mounted remotes in the living room and two adjacent rooms (kitchen and server room). Notifies openHAB by MQTT.
- Mounted in and powered by a light fixture
- Sends a 433 MHz signal to WorkshopMCU instantly on power on
- Connects to WiFi and sends heartbeat to WorkshopMCU
- 433 MHz remote receiver.
- IR emitter
- When ceiling light is turned on, sets air conditioning to comfortable temperature (25C) and sends WakeOnLan to the sound system PC.
- When ceiling light is turned off, sets air conditioning to dehumidify only, and tells sound system PC to shut down.
Wemos D1 Mini
- Monitors the supply line of my webcam with a current hall effect sensor and notifies OpenHAB by MQTT.
- OpenHAB turns on bright lights when the camera is on. Both for security and convenience.
- Air conditioning uses 600 watts. Back of napkin calculation: forgetting to set the workshop air conditioner back to dehumidify for a single day would spend more electricity than running all these MCUs for two months.
- Could I reduce the number of MCUs by doubling up functions? Well, yes. But why? With MCUs being literally under 3 dollars (ESP-01 under $1.50), they’re cheaper than cable, not to mention it’s easy to maintain several devices with a good programming environment :).
- Drawers full of MCUs? Really? Yes, actually. Individually controlling 150-something pool lights is going to eat a few of them. I will be sure to document this when it is done .
@rlkoshak and miss out on all this fun?
Good thing people are different, this would be a boring world otherwise.
I am more of a hardware guy than a programmer I use Platform io and the openhab extension on VScode.
@leif I understand your problem. I also agree with your concerns. I have been burned by many of the things you site.
Love to know your findings. I tried platform io but I could not get a good handle on it. Had issues compiling simple sketches. I need to revisit but I won’t be doing much development till October when Christmas lights start being built.
If you already use VSCode with the openHAB extension for openHAB configuration, I recommend downloading the PlatformIO extension for VSCode - it looks much better than the stock Arduino IDE, and performs better than Atom with Platform IO.
There’s this awesome maker on youtube I follow. He has taught me many things and cost me lots of money in AliExpress orders . He has a clear Platform IO tutorial. I’ve watched it recreationally, but one rainy day some time soon, I will try to actually follow it and see how far I get.
I am indeed! First thing I did when starting with openHAB and trying to edit some rules.
+1 for ESPEasy - I used to develop my own code for my temp/humidity sensor, until I tried ESPEasy and realized it did everything I had coded and more (NodeMCU based MQTT multi-sensor with OLED display) - I recommend looking at it with your sensors - it might save you time better spent on automating more of your house
+1 for programio in vs code. I have been writing c code for many years and I can’t begin to describe how much I hate the arduino ide. Does not do things the standardise c way and no code suggestions which speed up development greatly. I’m trying both at the moment so at least I can say I have Given it a shot.
Yes I need to try this. The atom editor was my biggest problem with the original try
Hello, I also recommend VScode as it nicely integrates OpenHab and ESP coding into one environment. I also recommend Tasmota as the basic starting point for ESP8266 development. Yes, it runs on the Sonof hardware but also works fine on ESP8266 (minimal 1Mb) boards. It provides a nice GUI and is easily extendable. It comes with standard extensions for a lot of sensors.
+1 for VSCode+platformIO+openHAB. I integrated it with gitlab for ci/cd, i am very satisfied.
Alright, that’s a reassuring number of +1’s, I’m gonna have to try it soon. Maybe time to retire Sloeber then. Was fun while it lasted!
Just another +1 for platform Io. I switched to it about 4 months ago to cover all the stuff the espHome doesn’t cover.