chore: auto-merge develop → main
Triggered by: d9ebc51 fix: ha_sensor JOIN products for name/unit columns (was HTTP 500)
This commit is contained in:
+6
-3
@@ -1388,9 +1388,12 @@ function haInventorySensor(PDO $db): void {
|
|||||||
|
|
||||||
// Expiring items details
|
// Expiring items details
|
||||||
$expiringItems = $db->query(
|
$expiringItems = $db->query(
|
||||||
"SELECT name, quantity, unit, expiry_date FROM inventory
|
"SELECT p.name, i.quantity, p.unit, i.expiry_date
|
||||||
WHERE quantity > 0 AND expiry_date IS NOT NULL AND expiry_date BETWEEN date('now') AND date('now', '+7 days')
|
FROM inventory i
|
||||||
ORDER BY expiry_date ASC LIMIT 10"
|
JOIN products p ON p.id = i.product_id
|
||||||
|
WHERE i.quantity > 0 AND i.expiry_date IS NOT NULL
|
||||||
|
AND i.expiry_date BETWEEN date('now') AND date('now', '+7 days')
|
||||||
|
ORDER BY i.expiry_date ASC LIMIT 10"
|
||||||
)->fetchAll(PDO::FETCH_ASSOC);
|
)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$stateValue = match($sensor) {
|
$stateValue = match($sensor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user