jasonacox / Powerwall-Dashboard

Grafana Monitoring Dashboard for Tesla Solar and Powerwall Systems
MIT License
268 stars 57 forks source link

Add Tool for Node Red Upload to PVoutput #44

Open damclarkd opened 2 years ago

damclarkd commented 2 years ago

Node Red JSON. Adapted from original here: https://forum.pvoutput.org/t/nodered-home-assistant-uploader/2472

[{"id":"24befeed.0cb5f2","type":"tab","label":"pvoutput","disabled":false,"info":""},{"id":"ab922e29.c77f7","type":"api-current-state","z":"24befeed.0cb5f2","name":"Daily Solar (Watt hours)","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pvoutput_daily_solar_energy_wh_v1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":360,"y":130,"wires":[["eca1effa.95a05"]]},{"id":"48a83575.9c7a9c","type":"join","z":"24befeed.0cb5f2","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"12","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":760,"y":50,"wires":[["99438705.c661e8"]]},{"id":"eca1effa.95a05","type":"change","z":"24befeed.0cb5f2","name":"V1","rules":[{"t":"set","p":"topic","pt":"msg","to":"v1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":130,"wires":[["48a83575.9c7a9c"]]},{"id":"17526967.a07137","type":"api-current-state","z":"24befeed.0cb5f2","name":"Total Solar Power (Watts)","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pvoutput_solar_now_watts_v2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":360,"y":180,"wires":[["21c59578.da1c0a"]]},{"id":"a50a6ebe.4e214","type":"api-current-state","z":"24befeed.0cb5f2","name":"Daily Consumed (Watt hours)","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pvoutput_daily_load_energy_wh_v3","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":370,"y":230,"wires":[["6363034f.3ac2ec"]]},{"id":"f6d9d089.0c42d","type":"api-current-state","z":"24befeed.0cb5f2","name":"Consumed Power (Watts)","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pvoutput_load_now_watts_v4","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":360,"y":280,"wires":[["853e698f.ac7f88"]]},{"id":"7fd1ce58.84e1a","type":"api-current-state","z":"24befeed.0cb5f2","name":"Temperature","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.weewx_out_temp","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":320,"y":330,"wires":[["5580eb68.666464"]]},{"id":"e5e9e6d9.dd8f38","type":"api-current-state","z":"24befeed.0cb5f2","name":"Battery Flow","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pw_battery_now_watts","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":320,"y":380,"wires":[["4e6cb33e.56467c"]]},{"id":"21c59578.da1c0a","type":"change","z":"24befeed.0cb5f2","name":"V2","rules":[{"t":"set","p":"topic","pt":"msg","to":"v2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":180,"wires":[["48a83575.9c7a9c"]]},{"id":"6363034f.3ac2ec","type":"change","z":"24befeed.0cb5f2","name":"V3","rules":[{"t":"set","p":"topic","pt":"msg","to":"v3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":230,"wires":[["48a83575.9c7a9c"]]},{"id":"853e698f.ac7f88","type":"change","z":"24befeed.0cb5f2","name":"V4","rules":[{"t":"set","p":"topic","pt":"msg","to":"v4","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":280,"wires":[["48a83575.9c7a9c"]]},{"id":"5580eb68.666464","type":"change","z":"24befeed.0cb5f2","name":"V5","rules":[{"t":"set","p":"topic","pt":"msg","to":"v5","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":330,"wires":[["48a83575.9c7a9c"]]},{"id":"4e6cb33e.56467c","type":"change","z":"24befeed.0cb5f2","name":"V7","rules":[{"t":"set","p":"topic","pt":"msg","to":"v7","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":380,"wires":[["48a83575.9c7a9c"]]},{"id":"99438705.c661e8","type":"function","z":"24befeed.0cb5f2","name":"Set API key here 1","func":"msg.action = msg.payload;\nmsg.headers = { \n 'X-Pvoutput-Apikey': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n 'X-Pvoutput-SystemId': 'xxxxx',\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":110,"wires":[["d19b860d.981778"]]},{"id":"d19b860d.981778","type":"function","z":"24befeed.0cb5f2","name":"Set up data","func":"msg.action = msg.payload;\n\nmsg.url = \"http://pvoutput.org/service/r2/addstatus.jsp\";\n\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":160,"wires":[["172a0ac0.cd35c5"]]},{"id":"172a0ac0.cd35c5","type":"http request","z":"24befeed.0cb5f2","name":"Post","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":820,"y":230,"wires":[["ea2bee87.e3fec"]]},{"id":"ea2bee87.e3fec","type":"debug","z":"24befeed.0cb5f2","name":"headercheck","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":840,"y":300,"wires":[]},{"id":"cebb4284.5ca53","type":"moment","z":"24befeed.0cb5f2","name":"Date","topic":"d","input":"","inputType":"date","inTz":"America/Phoenix","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYYMMDD","locale":"en_US","output":"payload","outputType":"msg","outTz":"America/Phoenix","x":580,"y":50,"wires":[["48a83575.9c7a9c"]]},{"id":"82eeed4d.79b77","type":"moment","z":"24befeed.0cb5f2","name":"Time","topic":"t","input":"","inputType":"date","inTz":"America/Phoenix","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm","locale":"en_US","output":"payload","outputType":"msg","outTz":"America/Phoenix","x":580,"y":90,"wires":[["48a83575.9c7a9c"]]},{"id":"5c728c9391f35fc7","type":"change","z":"24befeed.0cb5f2","name":"V10","rules":[{"t":"set","p":"topic","pt":"msg","to":"v10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":530,"wires":[["48a83575.9c7a9c"]]},{"id":"dadd8e0b80625855","type":"api-current-state","z":"24befeed.0cb5f2","name":"Grid Flow","server":"ab5c60b7.4683c","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pw_grid_now_watts","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":310,"y":530,"wires":[["5c728c9391f35fc7"]]},{"id":"d755097002895038","type":"api-current-state","z":"24befeed.0cb5f2","name":"Battery Charge","server":"ab5c60b7.4683c","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.nr_pw_battery_adj_charge","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":330,"y":480,"wires":[["d9d8d95b45d1ed96"]]},{"id":"d9d8d95b45d1ed96","type":"change","z":"24befeed.0cb5f2","name":"V9","rules":[{"t":"set","p":"topic","pt":"msg","to":"v9","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":480,"wires":[["48a83575.9c7a9c"]]},{"id":"ee44f8ec9909a834","type":"cronplus","z":"24befeed.0cb5f2","name":"5 minute schedule","outputField":"payload","timeZone":"America/Phoenix","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"date","payload":"","expressionType":"cron","expression":"20 5,10,15,20,25,30,35,40,45,50,55,59 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":140,"y":40,"wires":[["cebb4284.5ca53","82eeed4d.79b77","ab922e29.c77f7","17526967.a07137","a50a6ebe.4e214","f6d9d089.0c42d","7fd1ce58.84e1a","e5e9e6d9.dd8f38","d755097002895038","dadd8e0b80625855","7c1f84d1cfb8005b","5d6915d164e92aa8"]]},{"id":"7c1f84d1cfb8005b","type":"api-current-state","z":"24befeed.0cb5f2","name":"Home Load","server":"cbbf6ce3.4f5eb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pvoutput_load_now_watts_v4","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","x":320,"y":430,"wires":[["2534d64b99a4b06f"]]},{"id":"2534d64b99a4b06f","type":"change","z":"24befeed.0cb5f2","name":"V8","rules":[{"t":"set","p":"topic","pt":"msg","to":"v8","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":430,"wires":[["48a83575.9c7a9c"]]},{"id":"5d6915d164e92aa8","type":"api-current-state","z":"24befeed.0cb5f2","name":"Solar Gen","server":"ab5c60b7.4683c","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pvoutput_solar_now_watts_v2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":310,"y":580,"wires":[["da639c2d641674b1"]]},{"id":"da639c2d641674b1","type":"change","z":"24befeed.0cb5f2","name":"V12","rules":[{"t":"set","p":"topic","pt":"msg","to":"v12","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":580,"wires":[["48a83575.9c7a9c"]]},{"id":"cbbf6ce3.4f5eb","type":"server","name":"Home Assistant","version":2,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30},{"id":"ab5c60b7.4683c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
Screen Shot 2022-06-26 at 13 31 16
jasonacox commented 2 years ago

Thanks @damclarkd - I'm sure others in the community could use this.

This is the first time using NodeRed but I seem to be doing something wrong importing your JSON. What am I missing?

image
damclarkd commented 2 years ago

Not doing anything wrong. You just don’t have some of the elements downloaded into your Node Red.

All these are added/managed from the Node Red Pallette Manager

Cronplus - https://flows.nodered.org/node/node-red-contrib-cron-plus https://flows.nodered.org/node/node-red-contrib-cron-plus

Moment - https://flows.nodered.org/node/node-red-contrib-moment https://flows.nodered.org/node/node-red-contrib-moment

API Current State - https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket

This HA Websocket collection is specific to using entities from HA. How I am using them in this case is to get the current state of each entity I want to push up to PVOutput.

Adding these nodes to your instance should then clear all the unknown node types. The entities you use in api-current-state will need to be changed to your data. If your data does not come from HA, you will need to replace those nodes with whatever your data sources are.

HTH,

Cheers Dennis

On Jul 4, 2022, at 14:52, Jason Cox @.***> wrote:

Thanks @damclarkd https://github.com/damclarkd - I'm sure others in the community could use this.

This is the first time using NodeRed but I seem to be doing something wrong importing your JSON. What am I missing?

https://user-images.githubusercontent.com/836718/177219375-109799c5-d9ec-4714-860c-a956108609d3.png — Reply to this email directly, view it on GitHub https://github.com/jasonacox/Powerwall-Dashboard/issues/44#issuecomment-1174414035, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5WU5JM47WKZANIG2Q5X6LVSNMIVANCNFSM5Z4PFBSQ. You are receiving this because you were mentioned.