Passa al contenuto

← Guida MQTT | Indice

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

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

  1. Home Assistant installato e funzionante
  2. Broker MQTT (Mosquitto consigliato)
  3. Può essere il componente aggiuntivo Mosquitto di Home Assistant
  4. Oppure un broker esterno
  5. Integrazione MQTT configurata in Home Assistant
  6. ACRouter con MQTT abilitato



Configurazione


Passaggio 1: Installare il broker MQTT

Opzione A: Componente aggiuntivo Home Assistant (Consigliato)

  1. Andare su Impostazioni > Componenti aggiuntivi > Store
  2. Search for "Mosquitto broker"
  3. Fare clic su Installa
  4. Avviare il componente aggiuntivo
  5. 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

  1. Andare su Impostazioni > Dispositivi e servizi
  2. Click "Add Integration"
  3. Search for "MQTT"
  4. Inserire i dettagli del broker:
  5. Broker: localhost (se si usa il componente aggiuntivo) o IP del broker
  6. Porta: 1883
  7. Nome utente/Password (se configurati)


Passaggio 3: Configurare ACRouter

Tramite console seriale:

bash
# 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

  1. Andare su Impostazioni > Dispositivi e servizi > MQTT
  2. Look for "ACRouter Solar" device
  3. 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

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

yaml
type: gauge
entity: sensor.acrouter_grid_power
name: Grid Power
min: -3000
max: 3000
severity:
  green: -3000
  yellow: 0
  red: 500


Scheda pulsante personalizzata

yaml
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

yaml
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)

yaml
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

yaml
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

yaml
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

yaml
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

yaml
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.

  1. Andare su Impostazioni > Dashboard > Energia
  2. Aggiungere consumo di rete: sensor.acrouter_grid_power (quando positivo)
  3. 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)

yaml
# 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

  1. Check MQTT connection:
    bash mqtt-status
    Should show State: Connected

  2. Check HA Discovery enabled:
    bash mqtt-ha-discovery 1 mqtt-publish

  3. Verificare l'integrazione MQTT in HA:

  4. Impostazioni > Dispositivi e servizi > MQTT
  5. Click "Configure" > Check broker settings

  6. Restart discovery:
    bash mqtt-reconnect


Entities Show "Unavailable"

  1. Verificare che il dispositivo sia online:
  2. Controllare il topic status/online
  3. Dovrebbe essere online

  4. Check WiFi connection:
    bash wifi-status

  5. Verificare la connessione al broker:

  6. Assicurarsi che il broker sia raggiungibile da HA
  7. Testare con mosquitto_sub


I valori non si aggiornano

  1. Check publish interval:
    bash mqtt-interval 5000

  2. Force refresh:
    bash mqtt-publish

  3. Check MQTT messages are being received:
    bash mosquitto_sub -h broker_ip -t "acrouter/#" -v


La selezione della modalità non funziona

  1. Verificare la sottoscrizione al topic di comando:
  2. Il dispositivo dovrebbe registrare: MQTT: Command: mode = auto

  3. Verificare che la modalità sia valida:

  4. Deve essere: off, auto, eco, offgrid, manual, boost

  5. Verificare la compatibilità della modalità:

  6. Alcune modalità richiedono sensori specifici configurati



Vedi anche


Ultimo aggiornamento: 2025-12-24

← Guida MQTT | Indice