Jluc
July 31, 2026, 12:04pm
1
In the discussion, the AI indicates humidity levels in the kitchen where no sensor or probe is present.
AI’s response to the question: « Humidity in the house »
The humidity in the house is 52.0% in the living room, 51.7% in bedroom 1, 52.2% in bedroom 3, 52.3% in the kitchen, 52.5% in the bathroom, 52.7% in the technical duct, 52.8% on the north balcony, and 52.9% on the south balcony.
I also have a small issue:
Everything is wrong: the sent GET request is not correct
Thanks for your feedback, it helps me iterate on these silly little bugs
I made a fix PR:
master ← claude/gladys-ai-agent-feedback-am8ux3
ouvert 07:57AM - 01 Aug 26 UTC
### Description
This PR adds age tracking to sensor readings exposed to the LLM… , helping it distinguish between live measurements and stale values from sensors that have stopped reporting (dead batteries, unplugged devices, etc.).
**Key changes:**
1. **New `formatAge()` function** in `formatValue.js` that calculates how long ago a sensor value was last updated, returning compact formats like `'12min'`, `'3h'`, or `'6d'`. Returns `null` when the timestamp is missing or invalid.
2. **Updated `formatValue()` function** to include an `age` field in its output alongside `value` and `unit`. This provides the LLM with temporal context for every sensor reading.
3. **Improved empty state handling** in `buildSchemas.js` for the `device.get-state` tool. When no devices match the query, the tool now explicitly tells the LLM "no device is configured" instead of returning an empty list, preventing the model from hallucinating plausible values.
4. **Updated AI chat prompt** to clarify that the LLM should only report values present in tool results and never infer or estimate missing data.
All existing tests have been updated to expect the new `age` field, and comprehensive new tests cover:
- Age calculation in minutes, hours, and days
- Fresh values (0min)
- Future-dated values (treated as fresh due to clock skew)
- Missing or invalid timestamps (null age)
- Stale sensor tracking
### Checklist
- [x] Tests pass: All unit tests updated and new tests added for age tracking functionality
- [x] Linter and prettier pass
- [x] No breaking changes: The `age` field is additive; existing code consuming `value` and `unit` continues to work
https://claude.ai/code/session_01YHsCQc8ttFMpWzZAaYSwwn
## Summary by CodeRabbit
- **New Features**
- Sensor readings now display how long ago they were recorded.
- Clear messages appear when no matching devices or measurements are found.
- AI responses identify missing sensors, account for stale readings, and disclose incomplete tool results.
- **Bug Fixes**
- Prevented empty or misleading device-state responses when no results are available.
- Improved handling of missing, invalid, future, and outdated measurement timestamps.