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": "Prognose für bald leere Produkte",
|
||||
"auto_add_label": "Automatisch hinzufügen wenn",
|
||||
"auto_add_suffix": "im Lager verbleibend (0 = nur wenn leer)"
|
||||
},
|
||||
"ha": {
|
||||
"tab": "Home Assistant",
|
||||
"title": "Home Assistant",
|
||||
"hint": "Verbinde EverShelf mit Home Assistant für Automationen, Push-Benachrichtigungen und REST-Sensoren.",
|
||||
"enabled": "Home Assistant-Integration aktivieren",
|
||||
"connection_title": "Verbindung",
|
||||
"url_label": "Home Assistant URL",
|
||||
"url_placeholder": "http://192.168.1.50:8123",
|
||||
"url_hint": "Basis-URL deiner Home Assistant-Instanz (z.B. http://homeassistant.local:8123).",
|
||||
"token_label": "Long-Lived Access Token",
|
||||
"token_hint": "Erstelle unter HA-Profil → Sicherheit → Langlebige Zugangstoken.",
|
||||
"token_placeholder": "eyJhbGci...",
|
||||
"token_saved": "Token gespeichert (aus Sicherheitsgründen verborgen)",
|
||||
"test_btn": "Verbindung testen",
|
||||
"test_ok": "Verbunden mit {version}",
|
||||
"test_fail": "Verbindung fehlgeschlagen: {error}",
|
||||
"test_bad_token": "HA erreichbar, aber Token ist ungültig",
|
||||
"testing": "Teste…",
|
||||
"error_no_url": "Bitte zuerst die Home Assistant URL eingeben.",
|
||||
"tts_title": "TTS auf Smart Speaker",
|
||||
"tts_hint": "Rezeptschritte auf einem Home Assistant Media Player vorlesen.",
|
||||
"tts_entity_label": "Media Player Entity ID",
|
||||
"tts_entity_placeholder": "media_player.wohnzimmer",
|
||||
"tts_entity_hint": "Entity-ID des HA-Media-Players. Zu finden unter HA: Entwicklertools → Zustände.",
|
||||
"tts_platform_label": "TTS-Plattform",
|
||||
"tts_platform_speak": "tts.speak (empfohlen)",
|
||||
"tts_platform_notify": "notify.* (Benachrichtigungsdienst)",
|
||||
"tts_apply_btn": "HA-Voreinstellung auf TTS-Tab anwenden",
|
||||
"tts_apply_hint": "Füllt den TTS-Tab mit der Home Assistant URL und dem Token aus.",
|
||||
"tts_preset_applied": "HA-Voreinstellung auf TTS-Tab angewendet.",
|
||||
"webhook_title": "Webhook-Automationen",
|
||||
"webhook_hint": "Sende Daten an Home Assistant, wenn Ereignisse in der Vorratskammer auftreten.",
|
||||
"webhook_id_label": "Webhook-ID",
|
||||
"webhook_id_placeholder": "evershelf_webhook_abc123",
|
||||
"webhook_id_hint": "ID des in HA erstellten Webhooks. Kopiere aus: HA → Einstellungen → Automationen → Erstellen → Webhook-Auslöser.",
|
||||
"webhook_events_label": "Benachrichtige bei diesen Ereignissen",
|
||||
"event_expiry": "Ablaufende Produkte (täglich)",
|
||||
"event_shopping": "Artikel zur Einkaufsliste hinzugefügt",
|
||||
"event_stock": "Lagerbestand aktualisiert",
|
||||
"expiry_days_label": "Ablaufwarnung im Voraus (Tage)",
|
||||
"expiry_days_hint": "Sende die Ablaufwarnung N Tage vor dem Ablaufdatum.",
|
||||
"webhook_help": "In HA: Einstellungen → Automationen → Automation erstellen → Auslöser: Webhook → ID kopieren.",
|
||||
"notify_title": "Push-Benachrichtigungen",
|
||||
"notify_hint": "Sende Push-Benachrichtigungen über einen Home Assistant notify-Dienst.",
|
||||
"notify_service_label": "Notify-Dienst",
|
||||
"notify_service_placeholder": "notify.mobile_app_mein_handy",
|
||||
"notify_service_hint": "Name des HA-notify-Dienstes (z.B. notify.mobile_app_phone). Leer lassen zum Deaktivieren.",
|
||||
"sensor_title": "REST-Sensoren",
|
||||
"sensor_hint": "Zur configuration.yaml hinzufügen, um EverShelf-Sensoren in Home Assistant zu erstellen.",
|
||||
"sensor_copy_btn": "YAML kopieren",
|
||||
"sensor_copied": "YAML in die Zwischenablage kopiert!",
|
||||
"save_btn": "HA-Einstellungen speichern",
|
||||
"ha_hint": "Wenn du Home Assistant verwendest, nutze den Home Assistant-Tab für TTS, Webhooks und Sensoren."
|
||||
}
|
||||
},
|
||||
"expiry": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -821,6 +821,60 @@
|
||||
"forecast_label": "Previsión de productos por agotar",
|
||||
"auto_add_label": "Añadir automáticamente cuando",
|
||||
"auto_add_suffix": "restante en stock (0 = solo cuando se agota)"
|
||||
},
|
||||
"ha": {
|
||||
"tab": "Home Assistant",
|
||||
"title": "Home Assistant",
|
||||
"hint": "Conecta EverShelf a Home Assistant para automatizaciones, notificaciones push y sensores REST.",
|
||||
"enabled": "Activar integración con Home Assistant",
|
||||
"connection_title": "Conexión",
|
||||
"url_label": "URL de Home Assistant",
|
||||
"url_placeholder": "http://192.168.1.50:8123",
|
||||
"url_hint": "URL base de tu instancia de Home Assistant.",
|
||||
"token_label": "Token de acceso de larga duración",
|
||||
"token_hint": "Genera desde Perfil HA → Seguridad → Tokens de acceso de larga duración.",
|
||||
"token_placeholder": "eyJhbGci...",
|
||||
"token_saved": "Token guardado (oculto por seguridad)",
|
||||
"test_btn": "Probar conexión",
|
||||
"test_ok": "Conectado a {version}",
|
||||
"test_fail": "Conexión fallida: {error}",
|
||||
"test_bad_token": "HA accesible pero el token no es válido",
|
||||
"testing": "Probando…",
|
||||
"error_no_url": "Por favor, introduce primero la URL de Home Assistant.",
|
||||
"tts_title": "TTS en altavoz inteligente",
|
||||
"tts_hint": "Lee los pasos de la receta en un reproductor de medios de Home Assistant.",
|
||||
"tts_entity_label": "Entity ID del reproductor multimedia",
|
||||
"tts_entity_placeholder": "media_player.salon",
|
||||
"tts_entity_hint": "ID de entidad del reproductor multimedia HA. Encuéntralo en HA: Herramientas para desarrolladores → Estados.",
|
||||
"tts_platform_label": "Plataforma TTS",
|
||||
"tts_platform_speak": "tts.speak (recomendado)",
|
||||
"tts_platform_notify": "notify.* (servicio de notificaciones)",
|
||||
"tts_apply_btn": "Aplicar preset HA a la pestaña TTS",
|
||||
"tts_apply_hint": "Pre-rellena la pestaña TTS con la URL y el token de Home Assistant.",
|
||||
"tts_preset_applied": "Preset HA aplicado a la pestaña TTS.",
|
||||
"webhook_title": "Automatizaciones Webhook",
|
||||
"webhook_hint": "Envía datos a Home Assistant cuando ocurren eventos en la despensa.",
|
||||
"webhook_id_label": "ID de Webhook",
|
||||
"webhook_id_placeholder": "evershelf_webhook_abc123",
|
||||
"webhook_id_hint": "ID del webhook creado en HA. Copia desde: HA → Ajustes → Automatizaciones → Crear → Disparador Webhook.",
|
||||
"webhook_events_label": "Notificar en estos eventos",
|
||||
"event_expiry": "Productos próximos a caducar (diario)",
|
||||
"event_shopping": "Artículo añadido a la lista de compras",
|
||||
"event_stock": "Nivel de stock actualizado",
|
||||
"expiry_days_label": "Antelación de caducidad (días)",
|
||||
"expiry_days_hint": "Enviar alerta de caducidad N días antes de la fecha.",
|
||||
"webhook_help": "En HA: Ajustes → Automatizaciones → Crear automatización → Disparador: Webhook → copia el ID generado.",
|
||||
"notify_title": "Notificaciones push",
|
||||
"notify_hint": "Envía notificaciones push a tu teléfono mediante un servicio notify de Home Assistant.",
|
||||
"notify_service_label": "Servicio notify",
|
||||
"notify_service_placeholder": "notify.mobile_app_mi_telefono",
|
||||
"notify_service_hint": "Nombre del servicio notify de HA. Déjalo vacío para desactivar.",
|
||||
"sensor_title": "Sensores REST",
|
||||
"sensor_hint": "Añade a configuration.yaml para crear sensores de EverShelf en Home Assistant.",
|
||||
"sensor_copy_btn": "Copiar YAML",
|
||||
"sensor_copied": "¡YAML copiado al portapapeles!",
|
||||
"save_btn": "Guardar ajustes HA",
|
||||
"ha_hint": "Si usas Home Assistant, utiliza la pestaña Home Assistant para configurar TTS, webhooks y sensores."
|
||||
}
|
||||
},
|
||||
"expiry": {
|
||||
|
||||
@@ -821,6 +821,60 @@
|
||||
"forecast_label": "Prévision des produits bientôt épuisés",
|
||||
"auto_add_label": "Ajouter automatiquement quand",
|
||||
"auto_add_suffix": "restant en stock (0 = seulement quand épuisé)"
|
||||
},
|
||||
"ha": {
|
||||
"tab": "Home Assistant",
|
||||
"title": "Home Assistant",
|
||||
"hint": "Connectez EverShelf à Home Assistant pour les automations, les notifications push et les capteurs REST.",
|
||||
"enabled": "Activer l'intégration Home Assistant",
|
||||
"connection_title": "Connexion",
|
||||
"url_label": "URL Home Assistant",
|
||||
"url_placeholder": "http://192.168.1.50:8123",
|
||||
"url_hint": "URL de base de votre instance Home Assistant.",
|
||||
"token_label": "Jeton d'accès longue durée",
|
||||
"token_hint": "Générez depuis Profil HA → Sécurité → Jetons d'accès longue durée.",
|
||||
"token_placeholder": "eyJhbGci...",
|
||||
"token_saved": "Jeton enregistré (masqué pour des raisons de sécurité)",
|
||||
"test_btn": "Tester la connexion",
|
||||
"test_ok": "Connecté à {version}",
|
||||
"test_fail": "Connexion échouée : {error}",
|
||||
"test_bad_token": "HA accessible mais le jeton est invalide",
|
||||
"testing": "Test en cours…",
|
||||
"error_no_url": "Veuillez d'abord saisir l'URL de Home Assistant.",
|
||||
"tts_title": "TTS sur enceinte connectée",
|
||||
"tts_hint": "Lisez les étapes de recette sur un media player Home Assistant.",
|
||||
"tts_entity_label": "Entity ID du lecteur multimédia",
|
||||
"tts_entity_placeholder": "media_player.salon",
|
||||
"tts_entity_hint": "Entity ID du lecteur multimédia HA. Disponible dans HA : Outils développeur → États.",
|
||||
"tts_platform_label": "Plateforme TTS",
|
||||
"tts_platform_speak": "tts.speak (recommandé)",
|
||||
"tts_platform_notify": "notify.* (service de notification)",
|
||||
"tts_apply_btn": "Appliquer le preset HA à l'onglet TTS",
|
||||
"tts_apply_hint": "Pré-remplit l'onglet TTS avec l'URL et le jeton de Home Assistant.",
|
||||
"tts_preset_applied": "Preset HA appliqué à l'onglet TTS.",
|
||||
"webhook_title": "Automations Webhook",
|
||||
"webhook_hint": "Envoyez des données à Home Assistant lors d'événements dans le garde-manger.",
|
||||
"webhook_id_label": "ID Webhook",
|
||||
"webhook_id_placeholder": "evershelf_webhook_abc123",
|
||||
"webhook_id_hint": "ID du webhook créé dans HA. Copiez depuis : HA → Paramètres → Automations → Créer → Déclencheur Webhook.",
|
||||
"webhook_events_label": "Notifier pour ces événements",
|
||||
"event_expiry": "Produits expirant bientôt (quotidien)",
|
||||
"event_shopping": "Article ajouté à la liste de courses",
|
||||
"event_stock": "Niveau de stock mis à jour",
|
||||
"expiry_days_label": "Préavis d'expiration (jours)",
|
||||
"expiry_days_hint": "Envoyer l'alerte d'expiration N jours avant la date d'expiration.",
|
||||
"webhook_help": "Dans HA : Paramètres → Automations → Créer → Déclencheur : Webhook → copier l'ID généré.",
|
||||
"notify_title": "Notifications push",
|
||||
"notify_hint": "Envoyez des notifications push sur votre téléphone via un service notify de Home Assistant.",
|
||||
"notify_service_label": "Service notify",
|
||||
"notify_service_placeholder": "notify.mobile_app_mon_telephone",
|
||||
"notify_service_hint": "Nom du service notify HA. Laissez vide pour désactiver.",
|
||||
"sensor_title": "Capteurs REST",
|
||||
"sensor_hint": "Ajoutez à configuration.yaml pour créer des capteurs EverShelf dans Home Assistant.",
|
||||
"sensor_copy_btn": "Copier le YAML",
|
||||
"sensor_copied": "YAML copié dans le presse-papiers !",
|
||||
"save_btn": "Enregistrer les paramètres HA",
|
||||
"ha_hint": "Si vous utilisez Home Assistant, utilisez l'onglet Home Assistant pour configurer TTS, webhooks et capteurs."
|
||||
}
|
||||
},
|
||||
"expiry": {
|
||||
|
||||
@@ -868,6 +868,60 @@
|
||||
"forecast_label": "Previsione prodotti in esaurimento",
|
||||
"auto_add_label": "Aggiungi automaticamente quando",
|
||||
"auto_add_suffix": "rimasto in magazzino (0 = solo quando esaurito)"
|
||||
},
|
||||
"ha": {
|
||||
"tab": "Home Assistant",
|
||||
"title": "Home Assistant",
|
||||
"hint": "Collega EverShelf a Home Assistant per automazioni, notifiche push e sensori REST.",
|
||||
"enabled": "Abilita integrazione Home Assistant",
|
||||
"connection_title": "Connessione",
|
||||
"url_label": "URL Home Assistant",
|
||||
"url_placeholder": "http://192.168.1.50:8123",
|
||||
"url_hint": "URL del tuo server Home Assistant (es. http://homeassistant.local:8123).",
|
||||
"token_label": "Long-Lived Access Token",
|
||||
"token_hint": "Genera da Profilo HA → Sicurezza → Token di accesso a lungo termine.",
|
||||
"token_placeholder": "eyJhbGci...",
|
||||
"token_saved": "Token salvato (non mostrato per sicurezza)",
|
||||
"test_btn": "Testa connessione",
|
||||
"test_ok": "Connesso a {version}",
|
||||
"test_fail": "Connessione fallita: {error}",
|
||||
"test_bad_token": "HA raggiungibile ma token non valido",
|
||||
"testing": "Test in corso…",
|
||||
"error_no_url": "Inserisci prima l'URL di Home Assistant.",
|
||||
"tts_title": "TTS su Speaker Smart",
|
||||
"tts_hint": "Leggi i passi delle ricette su un media player di Home Assistant.",
|
||||
"tts_entity_label": "Entity ID media player",
|
||||
"tts_entity_placeholder": "media_player.living_room",
|
||||
"tts_entity_hint": "Entity ID del media player su cui vuoi la voce. Puoi trovarlo in HA: Strumenti per sviluppatori → Stati.",
|
||||
"tts_platform_label": "Piattaforma TTS",
|
||||
"tts_platform_speak": "tts.speak (raccomandato)",
|
||||
"tts_platform_notify": "notify.* (servizio notifiche)",
|
||||
"tts_apply_btn": "Applica preset HA al tab TTS",
|
||||
"tts_apply_hint": "Pre-compila il tab TTS con l'URL e il token di Home Assistant.",
|
||||
"tts_preset_applied": "Preset HA applicato al tab TTS.",
|
||||
"webhook_title": "Automazioni Webhook",
|
||||
"webhook_hint": "Invia dati a Home Assistant quando avvengono eventi nella dispensa. Crea un'automazione in HA con trigger Webhook e copia l'ID generato.",
|
||||
"webhook_id_label": "Webhook ID",
|
||||
"webhook_id_placeholder": "evershelf_webhook_abc123",
|
||||
"webhook_id_hint": "ID del webhook creato in HA. Copia da: HA → Impostazioni → Automazioni → Crea → Trigger Webhook.",
|
||||
"webhook_events_label": "Notifica per questi eventi",
|
||||
"event_expiry": "Prodotti in scadenza (giornaliero)",
|
||||
"event_shopping": "Aggiunta alla lista della spesa",
|
||||
"event_stock": "Aggiornamento scorte",
|
||||
"expiry_days_label": "Anticipo scadenze (giorni)",
|
||||
"expiry_days_hint": "Invia la notifica di scadenza N giorni prima della data di scadenza.",
|
||||
"webhook_help": "In HA: Impostazioni → Automazioni → Crea automazione → Trigger: Webhook → copia l'ID generato qui sopra.",
|
||||
"notify_title": "Notifiche Push",
|
||||
"notify_hint": "Invia notifiche push al tuo telefono tramite il servizio notify di Home Assistant.",
|
||||
"notify_service_label": "Servizio notify",
|
||||
"notify_service_placeholder": "notify.mobile_app_mio_telefono",
|
||||
"notify_service_hint": "Nome del servizio notify HA (es. notify.mobile_app_phone). Lascia vuoto per disabilitare.",
|
||||
"sensor_title": "Sensori REST",
|
||||
"sensor_hint": "Aggiungi a configuration.yaml per creare sensori EverShelf in Home Assistant.",
|
||||
"sensor_copy_btn": "Copia YAML",
|
||||
"sensor_copied": "YAML copiato negli appunti!",
|
||||
"save_btn": "Salva impostazioni HA",
|
||||
"ha_hint": "Se usi Home Assistant, usa il tab Home Assistant per configurare TTS, webhook e sensori."
|
||||
}
|
||||
},
|
||||
"expiry": {
|
||||
|
||||
Reference in New Issue
Block a user