French Pollen Allergy risks

Spring is coming soon, the pollen is arriving :leaves: :tulip: :cherry_blossom: :herb:

Exemple retrieving information on Pollen Allergy risks with HTTP Binding (openHAB4)

Data source: Réseau National de Surveillance Aérobiologique (R.N.S.A.)

Things

Replace <numéro département> in the URL with your department number
Exemple: https://www.pollens.fr/risks/thea/counties/25

Thing http:url:Indice_Pollens "HTTP Indice pollens" [ baseURL="https://www.pollens.fr/risks/thea/counties/<numéro département>", refresh=86400, delay=0 ] {
    Channels:
        Type number : Indice "Indice Pollen" [ stateTransformation="JSONPATH:$.riskLevel" ]
        Type number : Urticacees "Indice Urticacées" [ stateTransformation="JSONPATH:$.risks[0].level" ]
        Type number : Tilleul "Indice Tilleul" [ stateTransformation="JSONPATH:$.risks[1].level" ]
        Type number : Saule "Indice Saule" [ stateTransformation="JSONPATH:$.risks[2].level" ]
        Type number : Platane "Indice Platane" [ stateTransformation="JSONPATH:$.risks[3].level" ]
        Type number : Plantain "Indice Plantain" [ stateTransformation="JSONPATH:$.risks[4].level" ]
        Type number : Peuplier "Indice Peuplier" [ stateTransformation="JSONPATH:$.risks[5].level" ]
        Type number : Oseille "Indice Oseille" [ stateTransformation="JSONPATH:$.risks[6].level" ]
        Type number : Olivier "Indice Olivier" [ stateTransformation="JSONPATH:$.risks[7].level" ]
        Type number : Noisetier "Indice Noisetier" [ stateTransformation="JSONPATH:$.risks[8].level" ]
        Type number : Graminees "Indice Graminées" [ stateTransformation="JSONPATH:$.risks[9].level" ]
        Type number : Frene "Indice FrĂȘne" [ stateTransformation="JSONPATH:$.risks[10].level" ]
        Type number : Cupressacees "Indice Cupressacées" [ stateTransformation="JSONPATH:$.risks[11].level" ]
        Type number : Chene "Indice ChĂȘne" [ stateTransformation="JSONPATH:$.risks[12].level" ]
        Type number : Chataignier "Indice ChĂątaignier" [ stateTransformation="JSONPATH:$.risks[13].level" ]
        Type number : Charme "Indice Charme" [ stateTransformation="JSONPATH:$.risks[14].level" ]
        Type number : Bouleau "Indice Bouleau" [ stateTransformation="JSONPATH:$.risks[15].level" ]
        Type number : Aulne "Indice Aulne" [ stateTransformation="JSONPATH:$.risks[16].level" ]
        Type number : Armoise "Indice Armoise" [ stateTransformation="JSONPATH:$.risks[17].level" ]
        Type number : Ambroisies "Indice Ambroisies" [ stateTransformation="JSONPATH:$.risks[18].level" ]
    }

YAML version of the Thing

UID: http:url:Indice_Pollens
label: HTTP Indice pollens
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://www.pollens.fr/risks/thea/counties/<numéro département>
  delay: 0
  stateMethod: GET
  refresh: 86400
  commandMethod: GET
  timeout: 3000
  bufferSize: 2048
channels:
  - id: last-failure
    channelTypeUID: http:request-date-time
    label: Last Failure
    configuration: {}
  - id: last-success
    channelTypeUID: http:request-date-time
    label: Last Success
    configuration: {}
  - id: Indice
    channelTypeUID: http:number
    label: Indice Pollen
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.riskLevel
  - id: Urticacees
    channelTypeUID: http:number
    label: Indice Urticacées
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[0].level
  - id: Tilleul
    channelTypeUID: http:number
    label: Indice Tilleul
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[1].level
  - id: Saule
    channelTypeUID: http:number
    label: Indice Saule
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[2].level
  - id: Platane
    channelTypeUID: http:number
    label: Indice Platane
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[3].level
  - id: Plantain
    channelTypeUID: http:number
    label: Indice Plantain
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[4].level
  - id: Peuplier
    channelTypeUID: http:number
    label: Indice Peuplier
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[5].level
  - id: Oseille
    channelTypeUID: http:number
    label: Indice Oseille
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[6].level
  - id: Olivier
    channelTypeUID: http:number
    label: Indice Olivier
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[7].level
  - id: Noisetier
    channelTypeUID: http:number
    label: Indice Noisetier
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[8].level
  - id: Graminees
    channelTypeUID: http:number
    label: Indice Graminées
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[9].level
  - id: Frene
    channelTypeUID: http:number
    label: Indice FrĂȘne
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[10].level
  - id: Cupressacees
    channelTypeUID: http:number
    label: Indice Cupressacées
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[11].level
  - id: Chene
    channelTypeUID: http:number
    label: Indice ChĂȘne
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[12].level
  - id: Chataignier
    channelTypeUID: http:number
    label: Indice ChĂątaignier
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[13].level
  - id: Charme
    channelTypeUID: http:number
    label: Indice Charme
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[14].level
  - id: Bouleau
    channelTypeUID: http:number
    label: Indice Bouleau
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[15].level
  - id: Aulne
    channelTypeUID: http:number
    label: Indice Aulne
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[16].level
  - id: Armoise
    channelTypeUID: http:number
    label: Indice Armoise
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[17].level
  - id: Ambroisies
    channelTypeUID: http:number
    label: Indice Ambroisies
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.risks[18].level

Items

Group Pollens "Pollens" <pollen> ["WebService"]
Number Pollens_Indice "Indice Pollens" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Indice", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Ambroisies "Indice Ambroisies" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Ambroisies", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Armoise "Indice Armoise" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Armoise", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Aulne "Indice Aulne" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Aulne", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Bouleau "Indice Bouleau" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Bouleau", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Charme "Indice Charme" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Charme", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Chataignier "Indice Chùtaignier" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Chataignier", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Cupressacees "Indice Cupressacées" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Cupressacees", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Chene "Indice ChĂȘne" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Chene", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=ElevĂ©"]}
Number Pollens_Frene "Indice FrĂȘne" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Frene", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=ElevĂ©"]}
Number Pollens_Graminees "Indice Graminées" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Graminees", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Noisetier "Indice Noisetier" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Noisetier", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Olivier "Indice Olivier" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Olivier", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Oseille "Indice Oseille" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Oseille", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Peuplier "Indice Peuplier" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Peuplier", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Plantain "Indice Plantain" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Plantain", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Platane "Indice Platane" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Platane", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Saule "Indice Saule" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Saule", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Tilleul "Indice Tilleul" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Tilleul", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}
Number Pollens_Urticacees "Indice Urticacées" <pollen> (Pollens) ["Point"] {channel="http:url:Indice_Pollens:Urticacees", stateDescription=""[options="0=Nul,1=Faible,2=Moyen,3=Elevé"]}

Widget

Marketplace

Github

Icons

pollen.svgpollen.svg
pollen-0.svgpollen-0.svg
pollen-1.svgpollen-1.svg
pollen-2.svgpollen-2.svg
pollen-3.svgpollen-3.svg

2 Likes

Great tutorial! Thanks for using the Marketplace too.

For those working with the UI, it would be great if you posted the YAML version of the Thing. It should work such that if you go to the Thing in MainUI and click the Code tab you should see a YAML translation of the JSON that represents the Thing.

If you don’t see all the Channels though that may not work for .things files unfortunately. If it does work it would make it easier for managed config users to adopt if you posted that too.

post updated with YAML version of the Thing

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.