Exemple retrieving the Ecogaz signal with HTTP Binding (openHAB4)
Source des données : Open Data Réseaux Énergies (ODRÉ)
Things
Thing http:url:EcoGaz "HTTP Indice EcoGaz" [ baseURL="https://odre.opendatasoft.com/api/explore/v2.1/catalog/datasets/signal-ecogaz/records?order_by=gas_day DESC&limit=6", refresh=30000, delay=0 ] {
Channels:
Type string : Aujoudhui "Aujourd'hui" [ escapedUrl=true, stateTransformation="JSONPATH:$.results[5].couleur_du_signal_fr" ]
Type string : Demain "Demain" [ escapedUrl=true, stateTransformation="JSONPATH:$.results[4].couleur_du_signal_fr" ]
Type string : ApresDemain "Après demain" [ escapedUrl=true, stateTransformation="JSONPATH:$.results[3].couleur_du_signal_fr" ]
Type string : Jour3 "3ème jour" [ escapedUrl=true, stateTransformation="JSONPATH:$.results[2].couleur_du_signal_fr" ]
Type string : Jour4 "4ème jour" [ escapedUrl=true, stateTransformation="JSONPATH:$.results[1].couleur_du_signal_fr" ]
Type string : Jour5 "5ème jour" [ escapedUrl=true, stateTransformation="JSONPATH:$.results[0].couleur_du_signal_fr" ]
}
YAML version of the Thing
UID: http:url:EcoGaz
label: HTTP Indice EcoGaz
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: https://odre.opendatasoft.com/api/explore/v2.1/catalog/datasets/signal-ecogaz/records?order_by=gas_day
DESC&limit=6
delay: 0
stateMethod: GET
refresh: 30000
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: Aujoudhui
channelTypeUID: http:string
label: Aujourd'hui
configuration:
mode: READWRITE
stateTransformation: JSONPATH:$.results[5].couleur_du_signal_fr
escapedUrl: true
- id: Demain
channelTypeUID: http:string
label: Demain
configuration:
mode: READWRITE
stateTransformation: JSONPATH:$.results[4].couleur_du_signal_fr
escapedUrl: true
- id: ApresDemain
channelTypeUID: http:string
label: Après demain
configuration:
mode: READWRITE
stateTransformation: JSONPATH:$.results[3].couleur_du_signal_fr
escapedUrl: true
- id: Jour3
channelTypeUID: http:string
label: 3ème jour
configuration:
mode: READWRITE
stateTransformation: JSONPATH:$.results[2].couleur_du_signal_fr
escapedUrl: true
- id: Jour4
channelTypeUID: http:string
label: 4ème jour
configuration:
mode: READWRITE
stateTransformation: JSONPATH:$.results[1].couleur_du_signal_fr
escapedUrl: true
- id: Jour5
channelTypeUID: http:string
label: 5ème jour
configuration:
mode: READWRITE
stateTransformation: JSONPATH:$.results[0].couleur_du_signal_fr
escapedUrl: true
Items
Group EcoGaz "EcoGaz" <if:material-symbols:mode-heat> ["WebService"]
String EcoGaz_Aujourdhui "Aujourd'hui" <if:material-symbols:mode-heat> (EcoGaz) ["Point"] {channel="http:url:EcoGaz:Aujoudhui", stateDescription=""[options="Vert=Normale,Jaune=Elevée,Orange=Tendue,Rouge=Très tendue"]}
String EcoGaz_Demain "Demain" <if:material-symbols:mode-heat> (EcoGaz) ["Point"] {channel="http:url:EcoGaz:Demain", stateDescription=""[options="Vert=Normale,Jaune=Elevée,Orange=Tendue,Rouge=Très tendue"]}
String EcoGaz_ApresDemain "Après demain" <if:material-symbols:mode-heat> (EcoGaz) ["Point"] {channel="http:url:EcoGaz:ApresDemain", stateDescription=""[options="Vert=Normale,Jaune=Elevée,Orange=Tendue,Rouge=Très tendue"]}
String EcoGaz_Jour3 "3ème jour" <if:material-symbols:mode-heat> (EcoGaz) ["Point"] {channel="http:url:EcoGaz:Jour3", stateDescription=""[options="Vert=Normale,Jaune=Elevée,Orange=Tendue,Rouge=Très tendue"]}
String EcoGaz_Jour4 "4ème jour" <if:material-symbols:mode-heat> (EcoGaz) ["Point"] {channel="http:url:EcoGaz:Jour4", stateDescription=""[options="Vert=Normale,Jaune=Elevée,Orange=Tendue,Rouge=Très tendue"]}
String EcoGaz_Jour5 "5ème jour" <if:material-symbols:mode-heat> (EcoGaz) ["Point"] {channel="http:url:EcoGaz:Jour5", stateDescription=""[options="Vert=Normale,Jaune=Elevée,Orange=Tendue,Rouge=Très tendue"]}
Icons
Widget