Recomendations for IoT Device with OpenWrt

I am looking for recomendations on an IoT Topic:

Until now i used mozillas implementation of webthing-python.
But as it was layed down by mozilla by the end of last year and then this summer all major contributors turned away, i think i have to look around what is next to adopt as WIFI sensor node for my House.
As i always used OpenWRT as OS, it's the nearest to ask here, what solutions are around and what is used more widly...

:speech_balloon: I actualy would love to hear that there is some package that is installable with opkg and creates a basic ui in luci on my given device descriptors. I am open for a different programming language as well...

What I am looking for is a device specification makeing it easy to create API's which can be used with opensource transport tools like MQTT, Websockets, Webhooks, HTTP or anything else.

Please don't recomend services to me.

2 Likes

Contrary to normal IoT sensors, OpenWrt runs a full (albeit minified) linux environment, that has consequence on the system requirements and ultimately both the costs per sensor and power requirements (which in effect raises the operating costs as well). It's the switch between an MCU, to a full blown SOC.

There is a difference between an esp8266/ esp8285 or one of the various esp32 variants, and something like a Raspberry Pi Zero W or an Orange Pi Zero - what you gain in abstractions and hardware capabilities, deters you from lowest-level GPIO usage to some extent. Providing advice really is hard, especially without knowing what kind of IoT devices (sensors) exactly you are looking for, while you can certainly build a temperature, humidity, air pressure sensor or PIR motion detector with a RPi0-W or an Orange Pi Zero - it's hardly viable beyond a quantity of one (and even less once you take the power source (battery, solar, etc.) into account.

Openwrt devices are usually overkill for most IoT use, if you just want to run a sensor or a power switch or a RGB lamp it's much better to use a microcontroller with wifi/bluetooth/zigbee.
That is probably one of the reasons why that Mozilla project was abandoned.

There is this guide that allows to create webhooks on your OpenWrt device, but you will need to adapt the actions of course (as in the examples it is just doing this to act as relay for other IoT devices) https://github.com/z-george-ma/openwrt-iot

And this is a guide/script for using MQTT on OpenWrt as a IoT sensor device
https://github.com/dersimn/owrtwifi2mqtt (again it's for a specific use case so you will have to edit the script a bit to make it report whatever you actually wanted to report).
Most MQTT guides for OpenWrt are for broker use, so to be a gateway for IoT devices.

Imho if you have not bought devices to use for IoT yet, you should probably not use OpenWrt for that.

There is a very big community for microcontroller-based IoT devices, that provides opensource firmware for many brands of existing low-power IoT devices that use Wifi or Zigbee protocols to "liberate" them from the cloud and make them use MQTT/HTTP API/whatever, so I think you should probably just use that.
Either by buying a consumer device and reflashing it (similar to how OpenWrt works), or by buying a devboard and sensors separately, and doing a custom config for it.

Tasmota https://tasmota.github.io/docs/
and their supported device list https://templates.blakadder.com/

2 Likes

You all are right. I feel with you.

I use openWRT because of following constraints:

  • Security:
    -- A MCU has the problem that i have to do things i do not understand to secure my wifi password.
    -- Patches to threats: I can update my underlaying OS on a SoC to be as secure as possible, while relaying on work some verry good specialists do in faviour for me/the world.
  • Power:
    -- my SoC (MT7688N) takes about 1.3W, thats alot compared to what a MCU does, but its nothing compared to my Server, Laptop, NAS and all that gadgets I love and never power off.
    I do care about my Powerconsumption, but it's in no relation right now to the big consumers in my house, so adding 4-5 such SoC's is not worth giving up Security constraints i mentioned above.
  • I added a frontend to each local node with a framework that does not fit on a MCU. Setting up a Frontend on tiny storage space is extremely time consumeing, something i can not aford right now.

So, please don't take any of my explanations as an offense. Nobody has to share my oppinion if it does not fit for him/her. I whanted to give you the answer why i am searching for a framework on openWRT.

If there is any changes or you hear about something going on in this direction, please let me know.

Can you explain more what you mean here? What things you need to do to secure the wifi password?

With Tasmota project you have opensource firmware for the MCU and it can be easily updated (also "OTA" or "over the air" without need to connect a USB/programmer). As I said it is similar to OpenWrt, it's a project that develops and supports the opensource firmware for these devices.

Also a MCU firmware is tiny and has very little code, reducing attack surface by A LOT. This is one of the reasons why it also does not need many updates like OpenWrt that uses a full OS.

That is a bit strange for me. Why every node needs a frontend, aren't they all in the same network?

MCU-based systems are designed to be integrated with projects like OpenHAB or HomeAssistant (both available as Docker containers, among other things) that provide frontend and orchestration for the whole IoT swarm.

From the explanations you give, I think you do not know MCU-based IoT very well.
I know that you don't have the time to learn a new ecosystem, I know it takes time and you have better things to do than re-learning and re-building your home automation setup.
This is why I still took the time to find the other two guides for OpenWrt and try to answer your question. You have a "legacy" system to maintain, I know how that works.