12. Integrazione con Home Assistant
Version: 1.2.0
Date: 2025-12-24
Guida completa per integrare ACRouter con Home Assistant tramite MQTT Auto-Discovery.
Indice
- Panoramica
- Prerequisiti
- Configurazione
- Entità rilevate automaticamente
- Esempio di dashboard
- Automazioni
- Dashboard energetico
- Risoluzione dei problemi
Panoramica
ACRouter supporta MQTT Auto-Discovery, il che significa che Home Assistant crea automaticamente tutte le entità quando il dispositivo si connette. Nessuna configurazione YAML manuale necessaria!
Funzionalità
- Creazione automatica di dispositivi ed entità
- Sensori di monitoraggio della potenza in tempo reale
- Controllo della selezione della modalità
- Regolazione dei parametri (guadagno, soglia)
- Pulsante di arresto di emergenza
- Tracciamento della disponibilità (online/offline)
- Raggruppamento dei dispositivi con informazioni sul produttore
Prerequisiti
- Home Assistant installato e funzionante
- Broker MQTT (Mosquitto consigliato)
- Può essere il componente aggiuntivo Mosquitto di Home Assistant
- Oppure un broker esterno
- Integrazione MQTT configurata in Home Assistant
- ACRouter con MQTT abilitato
Configurazione
Passaggio 1: Installare il broker MQTT
Opzione A: Componente aggiuntivo Home Assistant (Consigliato)
- Andare su Impostazioni > Componenti aggiuntivi > Store
- Search for "Mosquitto broker"
- Fare clic su Installa
- Avviare il componente aggiuntivo
- Configurare le credenziali nella configurazione del componente
Opzione B: Broker esterno
Vedere 11_MQTT_GUIDE.md per la configurazione di Mosquitto.
Passaggio 2: Configurare l'integrazione MQTT
- Andare su Impostazioni > Dispositivi e servizi
- Click "Add Integration"
- Search for "MQTT"
- Inserire i dettagli del broker:
- Broker:
localhost(se si usa il componente aggiuntivo) o IP del broker - Porta:
1883 - Nome utente/Password (se configurati)
Passaggio 3: Configurare ACRouter
Tramite console seriale:
# Set broker URL
mqtt-broker mqtt://192.168.1.10:1883
# Set credentials (if required)
mqtt-user homeassistant
mqtt-pass your_password
# Set friendly device name
mqtt-device-name "Solar Router"
# Ensure HA Discovery is enabled
mqtt-ha-discovery 1
# Enable MQTT
mqtt-enable
Passaggio 4: Verificare il discovery
- Andare su Impostazioni > Dispositivi e servizi > MQTT
- Look for "ACRouter Solar" device
- Tutte le entità dovrebbero essere state create automaticamente
Entità rilevate automaticamente
Sensori
| Entità | Descrizione | Unità | Classe dispositivo |
|---|---|---|---|
sensor.acrouter_grid_power |
Potenza importazione/esportazione rete | W | power |
sensor.acrouter_solar_power |
Potenza di generazione solare | W | power |
sensor.acrouter_load_power |
Potenza di consumo del carico | W | power |
sensor.acrouter_voltage |
Tensione AC | V | voltage |
sensor.acrouter_dimmer |
Livello del dimmer | % | - |
sensor.acrouter_wifi_signal |
Intensità del segnale WiFi | dBm | signal_strength |
Select
| Entità | Descrizione | Opzioni |
|---|---|---|
select.acrouter_router_mode |
Modalità operativa del router | off, auto, eco, offgrid, manual, boost |
Numbers
| Entità | Descrizione | Intervallo |
|---|---|---|
number.acrouter_control_gain |
Guadagno del controllore P | 10–1000 |
number.acrouter_balance_threshold |
Banda morta di bilanciamento | 0–1000 W |
number.acrouter_manual_level |
Livello manuale del dimmer | 0–100% |
Buttons
| Entità | Descrizione |
|---|---|
button.acrouter_emergency_stop |
Arresto di emergenza |
button.acrouter_reboot |
Riavvio del dispositivo |
button.acrouter_refresh |
Aggiornamento forzato dei dati |
Informazioni sul dispositivo
Tutte le entità sono raggruppate sotto un singolo dispositivo con:
- Nome: ACRouter Solar (o nome personalizzato)
- Produttore: RBdimmer
- Modello: ACRouter
- Versione SW: 1.2.0
- URL di configurazione: http://device_ip
Esempio di dashboard
Scheda Lovelace YAML
type: entities
title: ACRouter Home Assistant Integration Guide — MQTT
entities:
- entity: select.acrouter_router_mode
name: Mode
- entity: sensor.acrouter_dimmer
name: Dimmer Level
- type: divider
- entity: sensor.acrouter_grid_power
name: Grid Power
- entity: sensor.acrouter_solar_power
name: Solar Power
- entity: sensor.acrouter_load_power
name: Load Power
- type: divider
- entity: sensor.acrouter_voltage
name: Voltage
- entity: sensor.acrouter_wifi_signal
name: WiFi Signal
Scheda indicatore per la potenza
type: gauge
entity: sensor.acrouter_grid_power
name: Grid Power
min: -3000
max: 3000
severity:
green: -3000
yellow: 0
red: 500
Scheda pulsante personalizzata
type: horizontal-stack
cards:
- type: button
entity: button.acrouter_emergency_stop
name: STOP
icon: mdi:stop
tap_action:
action: call-service
service: button.press
target:
entity_id: button.acrouter_emergency_stop
show_state: false
- type: button
entity: button.acrouter_reboot
name: Reboot
icon: mdi:restart
tap_action:
action: call-service
service: button.press
target:
entity_id: button.acrouter_reboot
show_state: false
Vista completa della dashboard
title: ACRouter Home Assistant Integration Guide — MQTT
views:
- title: Overview
cards:
- type: vertical-stack
cards:
- type: entities
title: Status
entities:
- entity: select.acrouter_router_mode
- entity: sensor.acrouter_dimmer
- entity: sensor.acrouter_voltage
- type: glance
title: Power
entities:
- entity: sensor.acrouter_grid_power
name: Grid
- entity: sensor.acrouter_solar_power
name: Solar
- entity: sensor.acrouter_load_power
name: Load
- type: entities
title: Settings
entities:
- entity: number.acrouter_control_gain
- entity: number.acrouter_balance_threshold
- entity: number.acrouter_manual_level
- type: horizontal-stack
cards:
- type: button
entity: button.acrouter_emergency_stop
name: Emergency Stop
icon: mdi:stop-circle
- type: button
entity: button.acrouter_refresh
name: Refresh
icon: mdi:refresh
Automazioni
Modalità Boost notturna (Tariffa ridotta)
alias: "Solar Router - Night Boost"
description: Integrate ACRouter solar power router with Home Assistant via MQTT. Covers MQTT discovery, energy dashboard, automations, and Lovelace dashboard cards.
trigger:
- platform: time
at: "23:00:00"
action:
- service: select.select_option
target:
entity_id: select.acrouter_router_mode
data:
option: "boost"
mode: single
Modalità automatica mattutina
alias: "Solar Router - Morning Auto"
description: Integrate ACRouter solar power router with Home Assistant via MQTT. Covers MQTT discovery, energy dashboard, automations, and Lovelace dashboard cards.
trigger:
- platform: time
at: "07:00:00"
action:
- service: select.select_option
target:
entity_id: select.acrouter_router_mode
data:
option: "auto"
mode: single
Arresto di emergenza per potenza elevata
alias: "Solar Router - Emergency High Power"
description: Integrate ACRouter solar power router with Home Assistant via MQTT. Covers MQTT discovery, energy dashboard, automations, and Lovelace dashboard cards.
trigger:
- platform: numeric_state
entity_id: sensor.acrouter_load_power
above: 3000
for:
seconds: 10
action:
- service: button.press
target:
entity_id: button.acrouter_emergency_stop
- service: notify.mobile_app
data:
message: "ACRouter emergency stop triggered - load exceeded 3000W"
mode: single
Notifica per disconnessione
alias: "Solar Router - Offline Alert"
description: Integrate ACRouter solar power router with Home Assistant via MQTT. Covers MQTT discovery, energy dashboard, automations, and Lovelace dashboard cards.
trigger:
- platform: state
entity_id: select.acrouter_router_mode
to: "unavailable"
for:
minutes: 5
action:
- service: notify.mobile_app
data:
message: "ACRouter is offline!"
title: "Solar Router Alert"
mode: single
Instradamento del surplus solare
alias: "Solar Router - Auto Enable on Surplus"
description: Integrate ACRouter solar power router with Home Assistant via MQTT. Covers MQTT discovery, energy dashboard, automations, and Lovelace dashboard cards.
trigger:
- platform: numeric_state
entity_id: sensor.acrouter_grid_power
below: -100
for:
minutes: 1
condition:
- condition: state
entity_id: select.acrouter_router_mode
state: "off"
action:
- service: select.select_option
target:
entity_id: select.acrouter_router_mode
data:
option: "auto"
mode: single
Dashboard energetico
Configurare i sensori di energia
I sensori di potenza di ACRouter possono essere integrati con il dashboard energetico di Home Assistant.
- Andare su Impostazioni > Dashboard > Energia
- Aggiungere consumo di rete:
sensor.acrouter_grid_power(quando positivo) - Aggiungere produzione solare:
sensor.acrouter_solar_power
Nota: Il dashboard energetico richiede sensori di energia (kWh), non sensori di potenza (W). Potrebbe essere necessario creare sensori template o utilizzare helper di integrazione.
Sensore template per l'energia (Opzionale)
# configuration.yaml
template:
- sensor:
- name: "ACRouter Grid Import Energy"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: >
{% set power = states('sensor.acrouter_grid_power') | float(0) %}
{% if power > 0 %}
{{ (power / 1000) | round(3) }}
{% else %}
0
{% endif %}
Risoluzione dei problemi
Dispositivo non rilevato
-
Check MQTT connection:
bash mqtt-status
Should showState: Connected -
Check HA Discovery enabled:
bash mqtt-ha-discovery 1 mqtt-publish -
Verificare l'integrazione MQTT in HA:
- Impostazioni > Dispositivi e servizi > MQTT
-
Click "Configure" > Check broker settings
-
Restart discovery:
bash mqtt-reconnect
Entities Show "Unavailable"
- Verificare che il dispositivo sia online:
- Controllare il topic
status/online -
Dovrebbe essere
online -
Check WiFi connection:
bash wifi-status -
Verificare la connessione al broker:
- Assicurarsi che il broker sia raggiungibile da HA
- Testare con mosquitto_sub
I valori non si aggiornano
-
Check publish interval:
bash mqtt-interval 5000 -
Force refresh:
bash mqtt-publish -
Check MQTT messages are being received:
bash mosquitto_sub -h broker_ip -t "acrouter/#" -v
La selezione della modalità non funziona
- Verificare la sottoscrizione al topic di comando:
-
Il dispositivo dovrebbe registrare:
MQTT: Command: mode = auto -
Verificare che la modalità sia valida:
-
Deve essere:
off,auto,eco,offgrid,manual,boost -
Verificare la compatibilità della modalità:
- Alcune modalità richiedono sensori specifici configurati
Vedi anche
- 11_MQTT_GUIDE.md – Configurazione MQTT e riferimento dei topic
- 04_ROUTER_MODES.md – Descrizione delle modalità del router
- Documentazione MQTT di Home Assistant
Ultimo aggiornamento: 2025-12-24