Home Assistant – Beispiel-Anlage

1
MQTT-Integration hinzufügen über EinstellungenGeräte & DiensteIntegration hinzufügenMQTT auswählen.
2
Broker-Zugangsdaten im Einrichtungsdialog eintragen:
Brokercbnode.at
Port8883
Benutzername0012AB34
Passwort
Client IDcbnode-0012AB34
Sicherheitshinweis: Diese Daten sind vertraulich und Ihrer Anlage eindeutig zugeordnet. Teilen Sie sie nicht mit Dritten und bewahren Sie heruntergeladene Dateien sicher auf. Bei Verdacht auf Kompromittierung können Sie Zugangsdaten jederzeit im Portal neu generieren.
3
CA-Zertifikat hinterlegen im Feld "CA Zertifikat":
ca.pem
4
Speichern – Home Assistant verbindet sich mit dem Broker.
5
Entities anlegen, zum Beispiel in der configuration.yaml (oder über MQTT-Integration → Entität hinzufügen):
binary_sensor:
  - platform: mqtt
    name: "Ajax Hub Scharf"
    state_topic: "ajax/hubs/0012AB34/hub/status/armed"
    payload_on: "1"
    payload_off: "0"

sensor:
  - platform: mqtt
    name: "Ajax Akku Zentrale"
    state_topic: "ajax/hubs/0012AB34/hub/status/battery"
    unit_of_measurement: "%"
MQTT Passwort

configuration.yaml Beispiele (MQTT)

Alternativ (oder ergänzend zur Integrations-Einrichtung) lassen sich Entities auch manuell definieren:

binary_sensor:
  - platform: mqtt
    name: "Beispiel-Anlage Scharf"
    state_topic: "ajax/hubs/0012AB34/hub/status/armed"
    payload_on: "1"
    payload_off: "0"

switch:
  - platform: mqtt
    name: "Plug DEVICE_ID"
    state_topic: "ajax/hubs/0012AB34/devices/DEVICE_ID/status/switch_state"
    command_topic: "ajax/hubs/0012AB34/devices/DEVICE_ID/command/switch"
    payload_on: "1"
    payload_off: "0"
    state_on: "1"
    state_off: "0"

sensor:
  - platform: mqtt
    name: "Melder DEVICE_ID Batterie"
    state_topic: "ajax/hubs/0012AB34/devices/DEVICE_ID/status/battery"
    unit_of_measurement: "%"
  - platform: mqtt
    name: "Melder DEVICE_ID Temperatur"
    state_topic: "ajax/hubs/0012AB34/devices/DEVICE_ID/status/temp"
    unit_of_measurement: "°C"

Alternative
REST API

Statt MQTT kann Home Assistant Ajax Bridge auch rein über die REST API ansprechen (Status-Abfrage per Polling alle 30s statt Echtzeit-Push).

sensor:
  # Hub Status (polling alle 30s)
  - platform: rest
    name: "Beispiel-Anlage Status"
    resource: https://cbnode.at/api/v1/hub/0012AB34/status
    headers:
      X-Api-Key: "IHR_API_KEY"
    value_template: "{{ value_json.mode }}"
    scan_interval: 30

  # Gruppen Status
  - platform: rest
    name: "Beispiel-Anlage Gruppen"
    resource: https://cbnode.at/api/v1/hub/0012AB34/groups
    headers:
      X-Api-Key: "IHR_API_KEY"
    value_template: "{{ value_json.count }} Gruppen"
    json_attributes:
      - groups
    scan_interval: 30

rest_command:
  # Hub gesamt scharf/unscharf
  ajax_hub_command:
    url: https://cbnode.at/api/v1/hub/0012AB34/command
    method: POST
    headers:
      X-Api-Key: "IHR_API_KEY"
      Content-Type: application/json
    payload: '{"command": "{{ command }}"}'

  # Einzelne Gruppe steuern
  ajax_group_command:
    url: "https://cbnode.at/api/v1/hub/0012AB34/groups/{{ group_id }}/command"
    method: POST
    headers:
      X-Api-Key: "IHR_API_KEY"
      Content-Type: application/json
    payload: '{"command": "{{ command }}"}'

  # Gerät bypass
  ajax_bypass:
    url: "https://cbnode.at/api/v1/hub/0012AB34/devices/{{ device_id }}/bypass"
    method: POST
    headers:
      X-Api-Key: "IHR_API_KEY"
      Content-Type: application/json
    payload: '{"bypass": {{ bypass }}}'

# Verwendung in Skripten:
script:
  gruppe_arm:
    sequence:
      - service: rest_command.ajax_group_command
        data: {group_id: "00000001", command: "ARM"}
  gruppe_disarm:
    sequence:
      - service: rest_command.ajax_group_command
        data: {group_id: "00000001", command: "DISARM"}

Vollständige Endpoint- und Topic-Referenz siehe REST API.