this post was submitted on 28 Aug 2023
59 points (100.0% liked)

Free and Open Source Software

17768 readers
45 users here now

If it's free and open source and it's also software, it can be discussed here. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 

Are there any decent open source alternatives or should I be looking to go down the building route?

I am a coding newbie so would be a bit daunting!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 1 year ago

Honestly I do all my IoT stuff in plain code, it's actually simpler IMO than trying to use a graphical functional block type interface like NodeRed. And it's a good way for you to get into coding in a way that you can work with real systems in a fairly safe way.

Check out Python's MQTT library, you can build an event driven MQTT handler pretty easily. You set a list of topics you want to subscribe to and then when a message arrives it will call the message handling function. You can check the topic/payload and act on it as you want, publish other messages or perform other operations.

I like distributed control systems myself where individual nodes subscribe to each other and communicate directly (through the MQTT broker) when possible, plus a couple Python scripts running on the broker system to coordinate operations that can't be easily managed that way.

For example an "sundown" topic can be published by a light sensor in the evening, and then either individual lights can subscribe to it and respond, or a script subscribes and iterates through a list of all the lights that are supposed to be on and sends them a power on command. The first option works with custom built endpoints, the second works to integrate Tasmota or similar where several different node devices may exist with different command schema.