feat: full Home Assistant integration
- PHP: _fireHaWebhook(), _sendHaNotify(), haInventorySensor(), haTestConnection()
- PHP: ha_sensor + ha_test routing actions
- PHP: getServerSettings() exposes ha_token (consistent with tts_token)
- PHP: saveSettings() handles all HA_* env keys (url, token, tts_entity, webhook_id, events, notify_service, expiry_days)
- PHP: bringAddItems(), shoppingAdd(), updateInventory() fire shopping_add / stock_update webhooks
- Cron: daily HA expiry/expired webhook + push notify with flag-file guard
- HTML: 🏠 Settings tab button + full HA panel (connection, TTS, webhook, notify, sensor cards)
- JS: serverKeys + loadSettingsUI extended with HA fields
- JS: _applyHaSettingsUI(), _loadHaTab(), _renderHaSensorYaml()
- JS: onHaEnabledChange(), testHaConnection(), applyHaTtsPreset()
- JS: saveHaSettings(), copyHaSensorYaml(), showHaWebhookHelp()
- JS: _buildHaTtsRequest() for HA media_player TTS
- JS: speakCookingStep() now supports HA TTS as first-priority path
- JS: onTtsEngineChange() fixed to show server section for both 'server' and 'custom'
- Translations: settings.ha.* (52 keys) in all 5 languages (it/en/de/fr/es)
- .env.example: HA_ENABLED/URL/TOKEN/TTS_ENTITY/WEBHOOK_ID/EVENTS/NOTIFY_SERVICE/EXPIRY_DAYS
- docs/wiki/Home-Assistant.md: new wiki page (REST sensors, webhooks, TTS, push notify, troubleshooting)
- README: HA integration highlighted as first feature block
This commit is contained in:
@@ -868,6 +868,60 @@
|
||||
"forecast_label": "Forecast low-stock products",
|
||||
"auto_add_label": "Auto-add to list when",
|
||||
"auto_add_suffix": "remaining in stock (0 = only when empty)"
|
||||
},
|
||||
"ha": {
|
||||
"tab": "Home Assistant",
|
||||
"title": "Home Assistant",
|
||||
"hint": "Connect EverShelf to Home Assistant for automations, push notifications and REST sensors.",
|
||||
"enabled": "Enable Home Assistant integration",
|
||||
"connection_title": "Connection",
|
||||
"url_label": "Home Assistant URL",
|
||||
"url_placeholder": "http://192.168.1.50:8123",
|
||||
"url_hint": "Base URL of your Home Assistant instance (e.g. http://homeassistant.local:8123).",
|
||||
"token_label": "Long-Lived Access Token",
|
||||
"token_hint": "Generate from HA Profile → Security → Long-Lived Access Tokens.",
|
||||
"token_placeholder": "eyJhbGci...",
|
||||
"token_saved": "Token saved (hidden for security)",
|
||||
"test_btn": "Test connection",
|
||||
"test_ok": "Connected to {version}",
|
||||
"test_fail": "Connection failed: {error}",
|
||||
"test_bad_token": "HA reachable but token is invalid",
|
||||
"testing": "Testing…",
|
||||
"error_no_url": "Please enter the Home Assistant URL first.",
|
||||
"tts_title": "TTS on Smart Speaker",
|
||||
"tts_hint": "Read recipe steps aloud on a Home Assistant media player.",
|
||||
"tts_entity_label": "Media player entity ID",
|
||||
"tts_entity_placeholder": "media_player.living_room",
|
||||
"tts_entity_hint": "Entity ID of the HA media player. Find it in HA: Developer Tools → States.",
|
||||
"tts_platform_label": "TTS platform",
|
||||
"tts_platform_speak": "tts.speak (recommended)",
|
||||
"tts_platform_notify": "notify.* (notification service)",
|
||||
"tts_apply_btn": "Apply HA preset to TTS tab",
|
||||
"tts_apply_hint": "Pre-fills the TTS tab with the Home Assistant URL and token.",
|
||||
"tts_preset_applied": "HA preset applied to TTS tab.",
|
||||
"webhook_title": "Webhook Automations",
|
||||
"webhook_hint": "Send data to Home Assistant when pantry events occur. Create an HA automation with a Webhook trigger and paste the generated ID here.",
|
||||
"webhook_id_label": "Webhook ID",
|
||||
"webhook_id_placeholder": "evershelf_webhook_abc123",
|
||||
"webhook_id_hint": "ID of the webhook created in HA. Copy from: HA → Settings → Automations → Create → Webhook Trigger.",
|
||||
"webhook_events_label": "Notify on these events",
|
||||
"event_expiry": "Expiring products (daily)",
|
||||
"event_shopping": "Item added to shopping list",
|
||||
"event_stock": "Stock level updated",
|
||||
"expiry_days_label": "Expiry lead time (days)",
|
||||
"expiry_days_hint": "Send the expiry alert N days before the expiry date.",
|
||||
"webhook_help": "In HA: Settings → Automations → Create automation → Trigger: Webhook → copy the generated ID above.",
|
||||
"notify_title": "Push Notifications",
|
||||
"notify_hint": "Send push notifications to your phone via a Home Assistant notify service.",
|
||||
"notify_service_label": "Notify service",
|
||||
"notify_service_placeholder": "notify.mobile_app_my_phone",
|
||||
"notify_service_hint": "HA notify service name (e.g. notify.mobile_app_phone). Leave empty to disable.",
|
||||
"sensor_title": "REST Sensors",
|
||||
"sensor_hint": "Add to configuration.yaml to create EverShelf sensors in Home Assistant.",
|
||||
"sensor_copy_btn": "Copy YAML",
|
||||
"sensor_copied": "YAML copied to clipboard!",
|
||||
"save_btn": "Save HA settings",
|
||||
"ha_hint": "If you use Home Assistant, use the Home Assistant tab to configure TTS, webhooks and sensors."
|
||||
}
|
||||
},
|
||||
"expiry": {
|
||||
|
||||
Reference in New Issue
Block a user