VigiEau French water restrictions

Our water tables are low, so we all need to be careful with our water consumption. Stay informed about your local situation with VigiEau French Data

Exemple retrieving information with HTTP Binding (openHAB4)


Data source: : Donnée Sécheresse - Propluvia

API: https://api.vigieau.gouv.fr/reglementation?lon=3.16265&lat=43.37829&commune=34148&profil=exploitation

Github API

Query parameters

Name Description
lon, lat Coordinates of the location
commune INSEE code of the commune to which you are attached
profil User category for restrictions list (particulier, exploitation, collectivite, entreprise)

Things

in the URL replace

  • < latitude > and < longitude > with your coordinates of the location
  • < code insee > with your INSEE code of the commune to which you are attached
  • < profil > with your user category for restrictions list (particulier, exploitation, collectivite, entreprise)

French_VigiEau.things

Thing http:url:VigiEau "HTTP VigiEau" [ baseURL="https://api.vigieau.beta.gouv.fr/reglementation?lon=< latitude >&lat=< longitude >&commune=< code insee >&profil=< profil >", refresh=43200, delay=0 ] {
    Channels:
        Type datetime : Debut_validite "Début validité" [ stateTransformation="JSONPATH:$.arrete.dateDebutValidite" ]
        Type datetime : Fin_validite "Fin validité" [ stateTransformation="JSONPATH:$.arrete.dateFinValidite" ]
        Type string : Niveau_Alerte "Niveau Alerte" [ stateTransformation="JSONPATH:$.niveauAlerte" ]
        Type string : Arrete_restriction "Arrêté de restriction" [ stateTransformation="JSONPATH:$.arrete.cheminFichier" ]
        Type string : Arrete_cadre_prefectoral "Arrêté cadre préfectoral" [ stateTransformation="JSONPATH:$.arrete.cheminFichierArreteCadre" ]
    }

YAML version

UID: http:url:VigiEau
label: HTTP VigiEau
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://api.vigieau.beta.gouv.fr/reglementation?lon=< latitude >&lat=< longitude >&commune=< code insee >&profil=< profil >
  delay: 0
  stateMethod: GET
  refresh: 43100
  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: Debut_validite
    channelTypeUID: http:datetime
    label: Début validité
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.arrete.dateDebutValidite
  - id: Fin_validite
    channelTypeUID: http:datetime
    label: Fin validité
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.arrete.dateFinValidite
  - id: Niveau_Alerte
    channelTypeUID: http:string
    label: Niveau Alerte
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.niveauAlerte
  - id: Arrete_restriction
    channelTypeUID: http:string
    label: Arrêté de restriction
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.arrete.cheminFichier
  - id: Arrete_cadre_prefectoral
    channelTypeUID: http:string
    label: Arrêté cadre préfectoral
    configuration:
      mode: READWRITE
      stateTransformation: JSONPATH:$.arrete.cheminFichierArreteCadre

Items

French_VigiEau.items

Group VigiEau "VigiEau" <vigieau> ["WebService"]
DateTime VigiEau_Debut_validite "Début validité" <f7:calendar> (VigiEau) ["Point"] {channel="http:url:VigiEau:Debut_validite", stateDescription=""[pattern="%1$te %1$tb"]}
DateTime VigiEau_Fin_validite "Fin validité" <f7:calendar> (VigiEau) ["Point"] {channel="http:url:VigiEau:Fin_validite", stateDescription=""[pattern="%1$te %1$tb"]}
String VigiEau_Niveau_Alerte "Niveau Alerte" <f7:drop_triangle_fill> (VigiEau) ["Point"] {channel="http:url:VigiEau:Niveau_Alerte"}
String VigiEau_Arrete_restriction "Arrêté de restriction" <f7:doc_plaintext> (VigiEau) ["Point"] {channel="http:url:VigiEau:Arrete_restriction"}
String VigiEau_Arrete_cadre_prefectoral "Arrêté cadre préfectoral" <f7:doc_plaintext> (VigiEau) ["Point"] {channel="http:url:VigiEau:Arrete_cadre_prefectoral"}

Rule

French_VigiEau(Rules).yaml

configuration: {}
triggers:
  - id: "1"
    configuration:
      thingUID: http:url:VigiEau
      status: UNKNOWN
    type: core.ThingStatusUpdateTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: VigiEau_Niveau_Alerte
      state: Aucune restriction
    type: core.ItemStateUpdateAction
  - inputs: {}
    id: "3"
    configuration:
      itemName: VigiEau_Arrete_cadre_prefectoral
      state: Aucune restriction
    type: core.ItemStateUpdateAction
  - inputs: {}
    id: "4"
    configuration:
      itemName: VigiEau_Arrete_restriction
      state: Aucune restriction
    type: core.ItemStateUpdateAction

Widget

Marketplace

Github





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