Hassio Node-RED Air Quality Control
This example shows a home-automation flow that reads PM2.5 levels from three air-purifier sensors and converts them into fan-speed commands for Home Assistant. Using the HA poll-state node, it samples living, bedroom, and library sensors every two minutes, marks one input as "small" via a change node, and applies a linear formula in a function node to map fine-dust readings to a discrete fan-speed range. A switch node routes zero values to the fan.turn_off service, while positive speeds trigger the fan.turn_on service, both via api-call-service nodes, with entity names derived from the sensor topic through string replacement.