Add Si7021 cabin temperature and humidity to the heater node #89
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/heater-si7021-sensor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds an Si7021 (I2C 0x40) to NODE_HEATER, reported as two readouts at indices 11 (temperature) and 12 (humidity). Adds
EP_HUMIDITY(0x16) and semantic class 0x2D humidity to the spec and code. No codec changes;vectors/frames.jsonis untouched.The driver is non-blocking: it sends the measure command, reads about 25 ms later, and repeats every 10 s. A NACK or bad CRC reports Fault; nothing read yet reports Unknown.
The Home Assistant integration (separate repo) needs 0x16 and 0x2D added. Until then it falls back to the generic readout band.
Tested:
pio test -e nativeandpio run -e node_heater. Not tested on hardware.Ticket: CCS-WHP-11
Three things to fix, one to check.
@ -211,6 +211,7 @@ registry — and never travel on the bus.| 0x13 | `EP_ENERGY` | in | Cumulative Wh || 0x14 | `EP_SETTING` | out | Adjustable value the node stores and restores at boot || 0x15 | `EP_COUNTER` | in | Dimensionless count, raw || 0x16 | `EP_HUMIDITY` | in | Relative humidity |Line 257 (semantic class table for 0x20-0x3F) still ends at
0x2C percentage. Add0x2D humidity. The spec is authoritative and must match the code in this PR.@ -0,0 +52,4 @@return !readConversion();}if (everStarted_ && now - startedAt_ < conversionIntervalMs) return false;startedAt_ = now;Bus-failure path is untested and cannot be: the state machine lives in the Arduino-only TU. Not blocking, but the Fault/recovery logic (converting_ reset, retry only after the 10 s interval) has no coverage. Consider moving the state machine behind a small read/write interface if you want it tested.
@ -84,1 +91,4 @@node.addEndpoint(&warmUpWait, "Twait warm up");node.addEndpoint(&cabinTemperature, "Cabin temperature");node.addEndpoint(&cabinHumidity, "Cabin humidity");Please confirm on hardware or from the XIAO C3 pinout that default
Wire.begin()pins (D4/D5) are free on this node: D0/D1 are the heater UART and the MCP2515 uses SPI. Nothing in the PR or docs says which pins the Si7021 is wired to; one line in the spec's heater section would help.@ -17,3 +17,3 @@EndpointType::TankLevel, EndpointType::Voltage, EndpointType::Current, EndpointType::Power, EndpointType::Soc,EndpointType::Orientation, EndpointType::Heater, EndpointType::AlarmSensor, EndpointType::Energy, EndpointType::Setting,EndpointType::Counter,EndpointType::Counter, EndpointType::Humidity,Nothing pins
SemanticClass::Humidity == 0x2D.test_presentation.cpp:54pins 0x2C the same way; add 0x2D there. Also fix the column alignment on this line (EndpointType::Counter, EndpointType::Humidity); run clang-format.Minor: humidity_ in lib/node-runtime/src/si7021.h defaults to the int16 unknown sentinel (0x8000), but the endpoint is uint16 and the fault path uses u16Fault. Before the first reading it reports 0x8000 with status Unknown. Status saves it, but initialise humidity_ with u16Unknown to match. Nothing else to act on.