Sensor to convert station pressure to SLP
This commit is contained in:
146
flows.json
146
flows.json
@ -2876,6 +2876,24 @@
|
|||||||
"w": 1072,
|
"w": 1072,
|
||||||
"h": 202
|
"h": 202
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "f5eea6eac47f79a8",
|
||||||
|
"type": "group",
|
||||||
|
"z": "ebd5561c4f077718",
|
||||||
|
"name": "Station Pressure to SLP",
|
||||||
|
"style": {
|
||||||
|
"label": true
|
||||||
|
},
|
||||||
|
"nodes": [
|
||||||
|
"e8dbc16027e1addb",
|
||||||
|
"350e11750f05c353",
|
||||||
|
"7da31d8bd0d544bd"
|
||||||
|
],
|
||||||
|
"x": 794,
|
||||||
|
"y": 859,
|
||||||
|
"w": 712,
|
||||||
|
"h": 82
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "fba69dfc80829db7",
|
"id": "fba69dfc80829db7",
|
||||||
"type": "junction",
|
"type": "junction",
|
||||||
@ -5849,6 +5867,47 @@
|
|||||||
"resend": false,
|
"resend": false,
|
||||||
"debugEnabled": false
|
"debugEnabled": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "8f61788e0c4471e1",
|
||||||
|
"type": "ha-entity-config",
|
||||||
|
"server": "9e87348d.9c1c48",
|
||||||
|
"deviceConfig": "",
|
||||||
|
"name": "Home Tempest Local SLP",
|
||||||
|
"version": 6,
|
||||||
|
"entityType": "sensor",
|
||||||
|
"haConfig": [
|
||||||
|
{
|
||||||
|
"property": "name",
|
||||||
|
"value": "Home Tempest Local SLP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "icon",
|
||||||
|
"value": "mdi:gauge"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "entity_picture",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "entity_category",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "device_class",
|
||||||
|
"value": "atmospheric_pressure"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "unit_of_measurement",
|
||||||
|
"value": "inHg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "state_class",
|
||||||
|
"value": "measurement"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resend": false,
|
||||||
|
"debugEnabled": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "afead614fabc01bb",
|
"id": "afead614fabc01bb",
|
||||||
"type": "function",
|
"type": "function",
|
||||||
@ -33690,6 +33749,93 @@
|
|||||||
"y": 1340,
|
"y": 1340,
|
||||||
"wires": []
|
"wires": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "e8dbc16027e1addb",
|
||||||
|
"type": "function",
|
||||||
|
"z": "ebd5561c4f077718",
|
||||||
|
"g": "f5eea6eac47f79a8",
|
||||||
|
"name": "Pressure Conversion",
|
||||||
|
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst temp_F = states['sensor.home_tempest_temperature'].state\nconst elevation_ft = 693\n\n// Get the pressure from the payload\nlet pressure_inHg = msg.payload\n\nif (isNaN(pressure_inHg)) {\n node.error(\"Invalid pressure value in msg.payload: \" + msg.payload)\n msg.payload = null\n return null\n}\n\n// Convert pressure from inHg to hPa\nlet pressure_hPa = pressure_inHg * 33.8639\n\n// Convert temperature to °C\nlet temp_C = (temp_F - 32) * (5 / 9)\n\n// Convert elevation from feet to meters\nlet elevation_m = elevation_ft / 3.28084\n\n// Apply the barometric formula\nlet slp = pressure_hPa * Math.pow(\n 1 - ((0.0065 * elevation_m) / (temp_C + (0.0065 * elevation_m) + 273.15)),\n -5.257\n)\n\n// Optional: Convert back to inHg\nlet slp_inHg = slp / 33.8639\n\n// Round both values\nslp = Math.round(slp * 100) / 100\nslp_inHg = Math.round(slp_inHg * 100) / 100\n\n// Return the SLP value\nmsg.payload = slp_inHg\n\nnode.status({fill:'Success',shape:'dot',text:'green'})\n\nreturn msg\n",
|
||||||
|
"outputs": 1,
|
||||||
|
"timeout": 0,
|
||||||
|
"noerr": 0,
|
||||||
|
"initialize": "",
|
||||||
|
"finalize": "",
|
||||||
|
"libs": [],
|
||||||
|
"x": 1120,
|
||||||
|
"y": 900,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"7da31d8bd0d544bd"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "350e11750f05c353",
|
||||||
|
"type": "server-state-changed",
|
||||||
|
"z": "ebd5561c4f077718",
|
||||||
|
"g": "f5eea6eac47f79a8",
|
||||||
|
"name": "Station Pressure",
|
||||||
|
"server": "9e87348d.9c1c48",
|
||||||
|
"version": 6,
|
||||||
|
"outputs": 1,
|
||||||
|
"exposeAsEntityConfig": "",
|
||||||
|
"entities": {
|
||||||
|
"entity": [
|
||||||
|
"sensor.home_tempest_air_pressure"
|
||||||
|
],
|
||||||
|
"substring": [],
|
||||||
|
"regex": []
|
||||||
|
},
|
||||||
|
"outputInitially": false,
|
||||||
|
"stateType": "num",
|
||||||
|
"ifState": "",
|
||||||
|
"ifStateType": "str",
|
||||||
|
"ifStateOperator": "is",
|
||||||
|
"outputOnlyOnStateChange": true,
|
||||||
|
"for": "0",
|
||||||
|
"forType": "num",
|
||||||
|
"forUnits": "minutes",
|
||||||
|
"ignorePrevStateNull": false,
|
||||||
|
"ignorePrevStateUnknown": false,
|
||||||
|
"ignorePrevStateUnavailable": false,
|
||||||
|
"ignoreCurrentStateUnknown": true,
|
||||||
|
"ignoreCurrentStateUnavailable": true,
|
||||||
|
"outputProperties": [
|
||||||
|
{
|
||||||
|
"property": "payload",
|
||||||
|
"propertyType": "msg",
|
||||||
|
"value": "",
|
||||||
|
"valueType": "entityState"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"x": 900,
|
||||||
|
"y": 900,
|
||||||
|
"wires": [
|
||||||
|
[
|
||||||
|
"e8dbc16027e1addb"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "7da31d8bd0d544bd",
|
||||||
|
"type": "ha-sensor",
|
||||||
|
"z": "ebd5561c4f077718",
|
||||||
|
"g": "f5eea6eac47f79a8",
|
||||||
|
"name": "Home Tempest Local SLP",
|
||||||
|
"entityConfig": "8f61788e0c4471e1",
|
||||||
|
"version": 0,
|
||||||
|
"state": "payload",
|
||||||
|
"stateType": "msg",
|
||||||
|
"attributes": [],
|
||||||
|
"inputOverride": "allow",
|
||||||
|
"outputProperties": [],
|
||||||
|
"x": 1370,
|
||||||
|
"y": 900,
|
||||||
|
"wires": [
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "1f7af146c06b8b85",
|
"id": "1f7af146c06b8b85",
|
||||||
"type": "ha-select",
|
"type": "ha-select",
|
||||||
|
Reference in New Issue
Block a user