yinglilac
yinglilac

Registered on 2月前

Answer
1
Article
0
Follower
0

I've seen

I’ve experimented with a similar setup using RTOS-based IoT devices, and one pattern that works well is structuring the system around producer–consumer threads. For instance, the temperature sensor thread can act as the producer, pushing readings into a message queue, while an MQTT thread consumes that data and publishes it to Home Assistant.

A possible layout could be:

  • Sensor thread – polls the temperature every few seconds and pushes data to a queue
  • Control thread – decides whether to toggle relays based on the setpoint
  • Network/MQTT thread – manages Wi-Fi connectivity and publishes/subscribes to topics
  • UI/display thread – updates the screen without blocking other operations

Create
Post