Last active
March 8, 2022 09:28
-
-
Save bassicrob/19b6a16bba2bac1961b2bbc22d380d71 to your computer and use it in GitHub Desktop.
HA Node Red Flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "43f03a36.8fbb04", | |
"type": "tab", | |
"label": "Beer Stats", | |
"disabled": false, | |
"info": "This node copied from:\nhttps://gist.github.com/bassicrob/19b6a16bba2bac1961b2bbc22d380d71\n\nSee my other gists for TiltPi flow to publish the required data to MQTT, and Lovelace card view.\n\nCheers!!" | |
}, | |
{ | |
"id": "a4a624df.14dbc8", | |
"type": "function", | |
"z": "43f03a36.8fbb04", | |
"name": "ABV Calc", | |
"func": "var beer_og = msg.payload.beer_og\nvar beer_cg = msg.payload.beer_specific_gravity\nvar x = beer_og-beer_cg\n\nvar beer_abv = (x*131.25).toFixed(2);\nmsg.payload = Number(beer_abv)\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 820, | |
"y": 480, | |
"wires": [ | |
[ | |
"d4e4ddf0.bbc45", | |
"7f35f8d7.844598" | |
] | |
] | |
}, | |
{ | |
"id": "d4e4ddf0.bbc45", | |
"type": "debug", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"x": 1010, | |
"y": 400, | |
"wires": [] | |
}, | |
{ | |
"id": "4ecc807d.cdb6", | |
"type": "server-state-changed", | |
"z": "43f03a36.8fbb04", | |
"name": "Beer SG Current", | |
"server": "4a95221.a64d7dc", | |
"version": 1, | |
"exposeToHomeAssistant": false, | |
"haConfig": [ | |
{ | |
"property": "name", | |
"value": "" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
} | |
], | |
"entityidfilter": "sensor.beer_specific_gravity", | |
"entityidfiltertype": "exact", | |
"outputinitially": true, | |
"state_type": "num", | |
"haltifstate": "", | |
"halt_if_type": "str", | |
"halt_if_compare": "is", | |
"outputs": 1, | |
"output_only_on_state_change": true, | |
"x": 210, | |
"y": 480, | |
"wires": [ | |
[ | |
"1db9d60e.2b3b8a" | |
] | |
] | |
}, | |
{ | |
"id": "737fb7d3.3bcef8", | |
"type": "server-state-changed", | |
"z": "43f03a36.8fbb04", | |
"name": "Beer OG", | |
"server": "4a95221.a64d7dc", | |
"version": 1, | |
"exposeToHomeAssistant": false, | |
"haConfig": [ | |
{ | |
"property": "name", | |
"value": "" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
} | |
], | |
"entityidfilter": "input_number.beer_og", | |
"entityidfiltertype": "exact", | |
"outputinitially": true, | |
"state_type": "num", | |
"haltifstate": "", | |
"halt_if_type": "str", | |
"halt_if_compare": "is", | |
"outputs": 1, | |
"output_only_on_state_change": true, | |
"x": 200, | |
"y": 540, | |
"wires": [ | |
[ | |
"5d29086b.fa16e8" | |
] | |
] | |
}, | |
{ | |
"id": "a50d2331.d7079", | |
"type": "debug", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"x": 990, | |
"y": 620, | |
"wires": [] | |
}, | |
{ | |
"id": "e0e1ca6d.458968", | |
"type": "inject", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "", | |
"payload": "1.061", | |
"payloadType": "num", | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"x": 250, | |
"y": 620, | |
"wires": [ | |
[ | |
"8863699b.96e0a8" | |
] | |
] | |
}, | |
{ | |
"id": "8863699b.96e0a8", | |
"type": "change", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"rules": [ | |
{ | |
"t": "move", | |
"p": "payload", | |
"pt": "msg", | |
"to": "payload.beer_specific_gravity", | |
"tot": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 490, | |
"y": 460, | |
"wires": [ | |
[ | |
"499d473a.64fba8" | |
] | |
] | |
}, | |
{ | |
"id": "5d29086b.fa16e8", | |
"type": "change", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"rules": [ | |
{ | |
"t": "move", | |
"p": "payload", | |
"pt": "msg", | |
"to": "payload.beer_og", | |
"tot": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 490, | |
"y": 500, | |
"wires": [ | |
[ | |
"499d473a.64fba8" | |
] | |
] | |
}, | |
{ | |
"id": "499d473a.64fba8", | |
"type": "join", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"mode": "custom", | |
"build": "merged", | |
"property": "payload", | |
"propertyType": "msg", | |
"key": "topic", | |
"joiner": "\\n", | |
"joinerType": "str", | |
"accumulate": true, | |
"timeout": "", | |
"count": "2", | |
"reduceRight": false, | |
"reduceExp": "", | |
"reduceInit": "", | |
"reduceInitType": "", | |
"reduceFixup": "", | |
"x": 660, | |
"y": 480, | |
"wires": [ | |
[ | |
"a4a624df.14dbc8", | |
"7c34023a.e867fc" | |
] | |
] | |
}, | |
{ | |
"id": "7f35f8d7.844598", | |
"type": "mqtt out", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "beer/abv/", | |
"qos": "", | |
"retain": "", | |
"broker": "4a3476ef.967ca8", | |
"x": 980, | |
"y": 480, | |
"wires": [] | |
}, | |
{ | |
"id": "1db9d60e.2b3b8a", | |
"type": "traffic", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"property_allow": "payload", | |
"filter_allow": "start", | |
"ignore_case_allow": true, | |
"negate_allow": false, | |
"send_allow": false, | |
"property_stop": "payload", | |
"filter_stop": "stop", | |
"ignore_case_stop": true, | |
"negate_stop": false, | |
"send_stop": false, | |
"default_start": false, | |
"differ": false, | |
"x": 470, | |
"y": 380, | |
"wires": [ | |
[ | |
"8863699b.96e0a8" | |
] | |
] | |
}, | |
{ | |
"id": "72d5420f.aa19ec", | |
"type": "inject", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "", | |
"payload": "start", | |
"payloadType": "str", | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"x": 150, | |
"y": 360, | |
"wires": [ | |
[ | |
"1db9d60e.2b3b8a" | |
] | |
] | |
}, | |
{ | |
"id": "66a8c367.bfd94c", | |
"type": "inject", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "", | |
"payload": "stop", | |
"payloadType": "str", | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"x": 150, | |
"y": 320, | |
"wires": [ | |
[ | |
"1db9d60e.2b3b8a" | |
] | |
] | |
}, | |
{ | |
"id": "52046b5c.97e3f4", | |
"type": "server-state-changed", | |
"z": "43f03a36.8fbb04", | |
"name": "Enable Logging", | |
"server": "4a95221.a64d7dc", | |
"version": 1, | |
"exposeToHomeAssistant": false, | |
"haConfig": [ | |
{ | |
"property": "name", | |
"value": "" | |
}, | |
{ | |
"property": "icon", | |
"value": "" | |
} | |
], | |
"entityidfilter": "switch.beer_logging", | |
"entityidfiltertype": "exact", | |
"outputinitially": true, | |
"state_type": "str", | |
"haltifstate": "", | |
"halt_if_type": "str", | |
"halt_if_compare": "is", | |
"outputs": 1, | |
"output_only_on_state_change": true, | |
"x": 120, | |
"y": 400, | |
"wires": [ | |
[ | |
"2f800f36.d40ca" | |
] | |
] | |
}, | |
{ | |
"id": "6a00937b.8c4abc", | |
"type": "mqtt in", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "beer/logging/state/", | |
"qos": "2", | |
"datatype": "utf8", | |
"broker": "4a3476ef.967ca8", | |
"x": 110, | |
"y": 260, | |
"wires": [ | |
[ | |
"1db9d60e.2b3b8a" | |
] | |
] | |
}, | |
{ | |
"id": "da7bcf24.3fbdb", | |
"type": "comment", | |
"z": "43f03a36.8fbb04", | |
"name": "ABV = (og – fg) * 131.25", | |
"info": "", | |
"x": 810, | |
"y": 520, | |
"wires": [] | |
}, | |
{ | |
"id": "1e37df5e.26ec21", | |
"type": "comment", | |
"z": "43f03a36.8fbb04", | |
"name": "Att = (og – fg) / (og-1)", | |
"info": "", | |
"x": 800, | |
"y": 640, | |
"wires": [] | |
}, | |
{ | |
"id": "7c34023a.e867fc", | |
"type": "function", | |
"z": "43f03a36.8fbb04", | |
"name": "Attenuation Calc", | |
"func": "var beer_og = msg.payload.beer_og\nvar beer_cg = msg.payload.beer_specific_gravity\nvar x = beer_og-beer_cg\n\nvar beer_att = ((x/(beer_og-1))*100).toFixed(2);\nmsg.payload = Number(beer_att)\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 840, | |
"y": 580, | |
"wires": [ | |
[ | |
"a50d2331.d7079", | |
"bc4ef9f5.a0cd88" | |
] | |
] | |
}, | |
{ | |
"id": "9acccf37.e2cb7", | |
"type": "inject", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "", | |
"payload": "1.061", | |
"payloadType": "num", | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"x": 270, | |
"y": 680, | |
"wires": [ | |
[ | |
"5d29086b.fa16e8" | |
] | |
] | |
}, | |
{ | |
"id": "bc4ef9f5.a0cd88", | |
"type": "mqtt out", | |
"z": "43f03a36.8fbb04", | |
"name": "", | |
"topic": "beer/att/", | |
"qos": "", | |
"retain": "", | |
"broker": "4a3476ef.967ca8", | |
"x": 1020, | |
"y": 580, | |
"wires": [] | |
}, | |
{ | |
"id": "2f800f36.d40ca", | |
"type": "change", | |
"z": "43f03a36.8fbb04", | |
"name": "Start Stop", | |
"rules": [ | |
{ | |
"t": "change", | |
"p": "payload", | |
"pt": "msg", | |
"from": "on", | |
"fromt": "str", | |
"to": "start", | |
"tot": "str" | |
}, | |
{ | |
"t": "change", | |
"p": "payload", | |
"pt": "msg", | |
"from": "off", | |
"fromt": "str", | |
"to": "stop", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 280, | |
"y": 400, | |
"wires": [ | |
[ | |
"1db9d60e.2b3b8a" | |
] | |
] | |
}, | |
{ | |
"id": "4a95221.a64d7dc", | |
"type": "server", | |
"z": "", | |
"name": "Home Assistant", | |
"legacy": false, | |
"rejectUnauthorizedCerts": true, | |
"ha_boolean": "", | |
"connectionDelay": false, | |
"cacheJson": true | |
}, | |
{ | |
"id": "4a3476ef.967ca8", | |
"type": "mqtt-broker", | |
"z": "", | |
"name": "", | |
"broker": "192.168.10.33", | |
"port": "1883", | |
"clientid": "", | |
"usetls": false, | |
"compatmode": true, | |
"keepalive": "60", | |
"cleansession": true, | |
"birthTopic": "", | |
"birthQos": "0", | |
"birthPayload": "", | |
"closeTopic": "", | |
"closeQos": "0", | |
"closePayload": "", | |
"willTopic": "", | |
"willQos": "0", | |
"willPayload": "" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Absolutely love what you have done here! I had started work on this myself and was using a homeassistant camera card to pull the graph from the google sheet but this implementation is just fabulous. Great work sir!