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!

  • evranch@lemmy.ca
    link
    fedilink
    arrow-up
    3
    ·
    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.