Skip to content

Instantly share code, notes, and snippets.

@toneomgomg
Created January 25, 2022 17:34
Show Gist options
  • Save toneomgomg/296a88a350d5b5a103ec055ef6e98a82 to your computer and use it in GitHub Desktop.
Save toneomgomg/296a88a350d5b5a103ec055ef6e98a82 to your computer and use it in GitHub Desktop.
Bensinpriser API
[
{
"id": "f2280f6a96c5c43c",
"type": "tab",
"label": "Bensinpriser API",
"disabled": false,
"info": "",
"env": []
},
{
"id": "4271641ebaf2fb54",
"type": "inject",
"z": "f2280f6a96c5c43c",
"name": "Once / hour",
"props": [
{
"p": "payload"
}
],
"repeat": "3600",
"crontab": "",
"once": true,
"onceDelay": "10",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 160,
"wires": [
[
"6bed8d410d2beb1e"
]
]
},
{
"id": "6bed8d410d2beb1e",
"type": "http request",
"z": "f2280f6a96c5c43c",
"name": "API request",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://www.henrikhjelm.se/api/getdata.php?lan=orebro-lan",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": false,
"x": 310,
"y": 160,
"wires": [
[
"6cca6e572d2248a6"
]
]
},
{
"id": "6cca6e572d2248a6",
"type": "function",
"z": "f2280f6a96c5c43c",
"name": "OKQ8 Kopparberg",
"func": "msg = [\n {\n payload: msg.payload.orebrolan_OKQ8_LjusnarsbergKata_Dahlstroms_Vag_1_Kopparberg__etanol\n },\n {\n payload: msg.payload.orebrolan_OKQ8_LjusnarsbergKata_Dahlstroms_Vag_1_Kopparberg__diesel,\n },\n {\n payload: msg.payload.orebrolan_OKQ8_LjusnarsbergKata_Dahlstroms_Vag_1_Kopparberg__95\n },\n]\nreturn msg;",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 160,
"wires": [
[
"99a2df0489dc33b2"
],
[
"ca913ad92ab12ef1"
],
[
"3239638b3e418684"
]
],
"outputLabels": [
"Etanol",
"Diesel",
"95-Oktan"
]
},
{
"id": "99a2df0489dc33b2",
"type": "ha-entity",
"z": "f2280f6a96c5c43c",
"name": "sensor.okq8_kopparberg_etanol",
"server": "450ad165dd77c3a2",
"version": 2,
"debugenabled": false,
"outputs": 1,
"entityType": "sensor",
"config": [
{
"property": "name",
"value": "okq8_kopparberg_etanol"
},
{
"property": "device_class",
"value": ""
},
{
"property": "icon",
"value": "mdi:gas-station"
},
{
"property": "unit_of_measurement",
"value": "SEK"
},
{
"property": "state_class",
"value": ""
},
{
"property": "last_reset",
"value": ""
}
],
"state": "payload",
"stateType": "msg",
"attributes": [],
"resend": true,
"outputLocation": "payload",
"outputLocationType": "none",
"inputOverride": "allow",
"outputOnStateChange": false,
"outputPayload": "$entity().state ? \"on\": \"off\"",
"outputPayloadType": "jsonata",
"x": 850,
"y": 100,
"wires": [
[]
]
},
{
"id": "ca913ad92ab12ef1",
"type": "ha-entity",
"z": "f2280f6a96c5c43c",
"name": "sensor.okq8_kopparberg_diesel",
"server": "450ad165dd77c3a2",
"version": 2,
"debugenabled": false,
"outputs": 1,
"entityType": "sensor",
"config": [
{
"property": "name",
"value": "okq8_kopparberg_diesel"
},
{
"property": "device_class",
"value": ""
},
{
"property": "icon",
"value": "mdi:gas-station"
},
{
"property": "unit_of_measurement",
"value": "SEK"
},
{
"property": "state_class",
"value": ""
},
{
"property": "last_reset",
"value": ""
}
],
"state": "payload",
"stateType": "msg",
"attributes": [],
"resend": true,
"outputLocation": "payload",
"outputLocationType": "none",
"inputOverride": "allow",
"outputOnStateChange": false,
"outputPayload": "$entity().state ? \"on\": \"off\"",
"outputPayloadType": "jsonata",
"x": 850,
"y": 160,
"wires": [
[]
]
},
{
"id": "3239638b3e418684",
"type": "ha-entity",
"z": "f2280f6a96c5c43c",
"name": "sensor.okq8_kopparberg_95_oktan",
"server": "450ad165dd77c3a2",
"version": 2,
"debugenabled": false,
"outputs": 1,
"entityType": "sensor",
"config": [
{
"property": "name",
"value": "okq8_kopparberg_95_oktan"
},
{
"property": "device_class",
"value": ""
},
{
"property": "icon",
"value": "mdi:gas-station"
},
{
"property": "unit_of_measurement",
"value": "SEK"
},
{
"property": "state_class",
"value": ""
},
{
"property": "last_reset",
"value": ""
}
],
"state": "payload",
"stateType": "msg",
"attributes": [],
"resend": true,
"outputLocation": "payload",
"outputLocationType": "none",
"inputOverride": "allow",
"outputOnStateChange": false,
"outputPayload": "$entity().state ? \"on\": \"off\"",
"outputPayloadType": "jsonata",
"x": 840,
"y": 220,
"wires": [
[]
]
},
{
"id": "58c674bea2cd3390",
"type": "comment",
"z": "f2280f6a96c5c43c",
"name": "README",
"info": "Info: https://www.henrikhjelm.se/api/",
"x": 140,
"y": 40,
"wires": []
},
{
"id": "840444ed6d7e1511",
"type": "comment",
"z": "f2280f6a96c5c43c",
"name": "CHANGELOG",
"info": "# 2021-01-25\n- Created",
"x": 290,
"y": 40,
"wires": [],
"icon": "node-red/alert.svg"
},
{
"id": "89ea80d93e4ab535",
"type": "comment",
"z": "f2280f6a96c5c43c",
"name": "customize: packages/customize/fuel.yaml",
"info": "",
"x": 820,
"y": 40,
"wires": []
},
{
"id": "450ad165dd77c3a2",
"type": "server",
"name": "Home Assistant",
"version": 2,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": true,
"heartbeatInterval": "30"
}
]
# =============================================================================
# Bensinpriser API
# =============================================================================
packages_customize_fuel:
homeassistant:
customize:
# ========================================================================
# Node-RED: [Bensinpriser API]
# ========================================================================
sensor.okq8_kopparberg_etanol:
friendly_name: "Etanol (OKQ8)"
sensor.okq8_kopparberg_diesel:
friendly_name: "Diesel (OKQ8)"
sensor.okq8_kopparberg_95_oktan:
friendly_name: "95 Oktan (OKQ8)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment