Vai al contenuto

Integrazione openHAB

Di seguito viene descritta l'integrazione in openHAB, in modo da poter elaborare facilmente le informazioni sui rifiuti nella tua Smart Home.

Installare le dipendenze

Per il collegamento servono DUE cose! Da un lato l'HTTP Binding e dall'altro (per l'elaborazione dei dati) il JSONPATH Data Transformation Service. HTTP Binding (si apre in una nuova scheda) / JSONPATH Data Transformation (si apre in una nuova scheda).

openHAB HTTP Binding
Installare l'HTTP Binding in openHAB

Creare un Thing

Crea un HTTP Thing e configuralo come segue (codice) – Tieni presente che negli header non possono essere trasmessi caratteri speciali. Scrivi ad es. "ue" invece di "ü".

UID: http:url:xxxxxxx
label: Binable
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://binable.app/api/fetch
  delay: 0
  stateMethod: POST
  refresh: 21600
  commandMethod: POST
  contentType: text/plain
  timeout: 6000
  bufferSize: 2048
  headers:
    - "X-Address-Street=XXX"
    - "X-Address-HouseNumber=XXX"
    - "X-Address-Zip=XXX"
    - "X-Address-City=XXXX"
    - "X-Address-Country=DE"
channels:
  - id: residual_waste_last
    channelTypeUID: http:datetime
    label: Restmüll (letzte)
    description: ""
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.residualWaste.last
  - id: residual_waste_next
    channelTypeUID: http:datetime
    label: Restmüll (nächste)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.residualWaste.next
  - id: residual_waste_next_days
    channelTypeUID: http:number
    label: Restmüll (nächste) relative
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.residualWaste.nextDays
  - id: paper_last
    channelTypeUID: http:datetime
    label: Papier (letzte)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.paper.last
  - id: paper_next
    channelTypeUID: http:datetime
    label: Papier (nächste)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.paper.next
  - id: paper_next_days
    channelTypeUID: http:number
    label: Papier (nächste) relative
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.paper.nextDays
  - id: reusable_materials_last
    channelTypeUID: http:datetime
    label: Wertstoffe (letzte)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.reusableMaterials.last
  - id: reusable_materials_next
    channelTypeUID: http:datetime
    label: Wertstoffe (nächste)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.reusableMaterials.next
  - id: reusable_materials_next_days
    channelTypeUID: http:number
    label: Wertstoffe (nächste) relative
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.reusableMaterials.nextDays
  - id: bio_last
    channelTypeUID: http:datetime
    label: Bio (letzte)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.bio.last
  - id: bio_next
    channelTypeUID: http:datetime
    label: Bio (nächste)
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.bio.next
  - id: bio_next_days
    channelTypeUID: http:number
    label: Bio (nächste) relative
    description: null
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.bio.nextDays
#  - id: christmas_tree_last
#    channelTypeUID: http:datetime
#    label: Weihnachtsbaum (letzte)
#    description: null
#    configuration:
#      mode: READONLY
#      stateTransformation: JSONPATH:$.christmasTree.last
#  - id: christmas_tree_next
#    channelTypeUID: http:datetime
#    label: Weihnachtsbaum (nächste)
#    description: null
#    configuration:
#      mode: READONLY
#      stateTransformation: JSONPATH:$.christmasTree.next
#  - id: christmas_tree_next_days
#    channelTypeUID: http:number
#    label: Weihnachtsbaum (nächste) relative
#    description: null
#    configuration:
#      mode: READONLY
#      stateTransformation: JSONPATH:$.christmasTree.nextDays
Configurazione del Thing incl. Channel

Nota: attualmente esistono i seguenti tipi di rifiuti (etichetta / key): carta (paper), umido (bio), indifferenziata (residualWaste), materiali riciclabili (reusableMaterials), alberi di Natale (christmasTree), rifiuti pericolosi (toxic), pannolini (diaper) e sfalci di siepi (hedgeTreeTrimming)

Items

Crea gli Items in base ai rispettivi Channel.

Opzionale: formato della data

Puoi formattare correttamente la data creando una State Description, ad es. nella forma "%1$td.%1$tm.%1$tY". Per i giorni relativi si può usare anche questa State Description "%.0f giorno/i".

Fatto!

È tutto. Non ridurre il "delay", poiché richieste frequenti non sono necessarie.

← Panoramica delle integrazioni