Kedze bol v novsich verziach experimentalneho HACS goodwe addonu pridany priamo switch na zapnutie/vypnutie exportu, neni nutne nastavovat akekolvek extra scripty aby to prepinalo.
V Node-red mozete (aj v HA) zavolat priamo ten novo pridany switch.
a kedze som uz nemohol upravit svoj predosly prispevok, robim novy.
upravil som nejake veci, a to ze pri zapornych cenach nastavi export limit na 100W zaroven zapina export_limit switch + posle push notifikaciu na mobil
Kód: Vybrat vše
[{"id":"0a1b98319f992658","type":"server-state-changed","z":"eb86c30ba27dfe81","name":"get SPOT price","server":"35221851.1b8d28","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.current_spot_electricity_price","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":200,"wires":[["f5091fa893e1ab11"]]},{"id":"af48d1139035e83d","type":"api-call-service","z":"eb86c30ba27dfe81","name":"Set inverter limit to 5.6KW","server":"35221851.1b8d28","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.goodwe_grid_export_limit"],"data":"{\"value\":5600}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":200,"wires":[["73032f2cf251b801"]]},{"id":"59f29d44845f5350","type":"switch","z":"eb86c30ba27dfe81","name":"if spot price > 0.54kc","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0.540","vt":"str"},{"t":"lt","v":"0.540","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":220,"wires":[["64d2505f0163fd76"],["17937c4268f43f90"]]},{"id":"87b5f6be26c26356","type":"inject","z":"eb86c30ba27dfe81","name":"manual price 3.45kc","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3.45","payloadType":"str","x":150,"y":260,"wires":[["f5091fa893e1ab11"]]},{"id":"023bc186279ac6a6","type":"api-call-service","z":"eb86c30ba27dfe81","name":"Set inverter limit to 100W","server":"35221851.1b8d28","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.goodwe_grid_export_limit"],"data":"{\"value\":100}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":300,"wires":[["f784bcbb169ee3ac"]]},{"id":"73032f2cf251b801","type":"change","z":"eb86c30ba27dfe81","name":"set msg.","rules":[{"t":"set","p":"payload","pt":"msg","to":"FVE - export ENABLED","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":200,"wires":[["ed0a871d30f16ca6"]]},{"id":"f784bcbb169ee3ac","type":"change","z":"eb86c30ba27dfe81","name":"set msg.","rules":[{"t":"set","p":"payload","pt":"msg","to":"FVE - export DISABLE","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":300,"wires":[["ed0a871d30f16ca6"]]},{"id":"87129503.c7b358","type":"rbe","z":"eb86c30ba27dfe81","name":"spam protection","func":"deadband","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":760,"y":200,"wires":[["6fe7d5ce85c61a87"]]},{"id":"64d2505f0163fd76","type":"change","z":"eb86c30ba27dfe81","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":200,"wires":[["87129503.c7b358"]]},{"id":"17937c4268f43f90","type":"change","z":"eb86c30ba27dfe81","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":240,"wires":[["87129503.c7b358"]]},{"id":"7627472a7d81e7bb","type":"inject","z":"eb86c30ba27dfe81","name":"manual price -0.45kc","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-0.85","payloadType":"str","x":150,"y":300,"wires":[["f5091fa893e1ab11"]]},{"id":"6fe7d5ce85c61a87","type":"switch","z":"eb86c30ba27dfe81","name":"compare 1/0","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":770,"y":240,"wires":[["af48d1139035e83d","04913b35b16e32dd"],["023bc186279ac6a6","dcfadcb187b8b060"]]},{"id":"ed0a871d30f16ca6","type":"join","z":"eb86c30ba27dfe81","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"-","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1390,"y":220,"wires":[["4f71d277d44f3d7b"]]},{"id":"137f9cab04092820","type":"debug","z":"eb86c30ba27dfe81","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1610,"y":260,"wires":[]},{"id":"4f71d277d44f3d7b","type":"template","z":"eb86c30ba27dfe81","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.status}} (Spot price: {{payload.price}} kč)","output":"str","x":1400,"y":260,"wires":[["aba2d977233ec576"]]},{"id":"23f41711f2f4bcd7","type":"change","z":"eb86c30ba27dfe81","name":"spot price","rules":[{"t":"set","p":"topic","pt":"msg","to":"price","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":160,"wires":[["ed0a871d30f16ca6"]]},{"id":"dcfadcb187b8b060","type":"api-call-service","z":"eb86c30ba27dfe81","name":"Export limit switch ON","server":"35221851.1b8d28","version":5,"debugenabled":true,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.goodwe_grid_export_limit_switch"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1000,"y":340,"wires":[[]]},{"id":"04913b35b16e32dd","type":"api-call-service","z":"eb86c30ba27dfe81","name":"Export limit switch OFF","server":"35221851.1b8d28","version":5,"debugenabled":true,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.goodwe_grid_export_limit_switch"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":240,"wires":[[]]},{"id":"f98f1fe9cee83945","type":"api-call-service","z":"eb86c30ba27dfe81","name":"Phone Notification","server":"35221851.1b8d28","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_pixel_7","areaId":[],"deviceId":[],"entityId":[],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","output_location":"payload","output_location_type":"msg","x":1630,"y":300,"wires":[[]]},{"id":"aba2d977233ec576","type":"function","z":"eb86c30ba27dfe81","name":"Prep Notification","func":"msg.payload = \n{\n \"data\": \n {\n \"title\": \"Energy export status\", \n \"message\": msg.payload\n }\n}\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1420,"y":300,"wires":[["f98f1fe9cee83945","137f9cab04092820"]]},{"id":"dc4171d2325c4c1d","type":"junction","z":"eb86c30ba27dfe81","x":360,"y":160,"wires":[["23f41711f2f4bcd7"]]},{"id":"f5091fa893e1ab11","type":"junction","z":"eb86c30ba27dfe81","x":300,"y":220,"wires":[["59f29d44845f5350","dc4171d2325c4c1d"]]},{"id":"35221851.1b8d28","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"10","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"","enableGlobalContextStore":true}]