|
11 | 11 | "y": 140, |
12 | 12 | "wires": [ |
13 | 13 | { |
14 | | - "id": "96c080c3c196de2a" |
| 14 | + "id": "63fc5dfacf242fc0" |
15 | 15 | } |
16 | 16 | ] |
17 | 17 | } |
|
115 | 115 | }, |
116 | 116 | { |
117 | 117 | "l": { |
118 | | - "en-US": "ToBattery", |
119 | | - "de": "Zu Batterie" |
| 118 | + "en-US": "ToBattery (To/From combined)", |
| 119 | + "de": "Zu Batterie (Zu/Von kombiniert)" |
120 | 120 | }, |
121 | 121 | "v": "ToBattery" |
122 | 122 | }, |
123 | 123 | { |
124 | 124 | "l": { |
125 | | - "en-US": "Battery%+ToBattery", |
126 | | - "de": "Battery% + Zu Batterie" |
| 125 | + "en-US": "Battery%+ToBattery (To/From combined)", |
| 126 | + "de": "Battery% + Zu Batterie (Zu/Von kombiniert)" |
127 | 127 | }, |
128 | 128 | "v": "B%+ToBattery" |
129 | 129 | }, |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | }, |
| 199 | + { |
| 200 | + "name": "ToHouseIncludeBattery", |
| 201 | + "type": "str", |
| 202 | + "value": "Yes", |
| 203 | + "ui": { |
| 204 | + "icon": "font-awesome/fa-battery", |
| 205 | + "label": { |
| 206 | + "de": "Zu Haus", |
| 207 | + "en-US": "To house" |
| 208 | + }, |
| 209 | + "type": "select", |
| 210 | + "opts": { |
| 211 | + "opts": [ |
| 212 | + { |
| 213 | + "l": { |
| 214 | + "de": "Mit Batterie", |
| 215 | + "en-US": "include Battery" |
| 216 | + }, |
| 217 | + "v": "Yes" |
| 218 | + }, |
| 219 | + { |
| 220 | + "l": { |
| 221 | + "de": "Ohne Batterie", |
| 222 | + "en-US": "exclude Battery" |
| 223 | + }, |
| 224 | + "v": "No" |
| 225 | + } |
| 226 | + ] |
| 227 | + } |
| 228 | + } |
| 229 | + }, |
199 | 230 | { |
200 | 231 | "name": "3. multi icon", |
201 | 232 | "type": "str", |
|
207 | 238 | "opts": [ |
208 | 239 | { |
209 | 240 | "l": { |
210 | | - "en-US": "FromGrid", |
211 | | - "de": "Von Netz" |
| 241 | + "en-US": "FromGrid (From/To combined)", |
| 242 | + "de": "Von Netz (Von/Zu kombiniert)" |
212 | 243 | }, |
213 | 244 | "v": "FromGrid" |
214 | 245 | }, |
|
396 | 427 | } |
397 | 428 | } |
398 | 429 | }, |
399 | | - { |
400 | | - "name": "To battery input", |
401 | | - "type": "str", |
402 | | - "value": "NotInverted", |
403 | | - "ui": { |
404 | | - "label": { |
405 | | - "de": "Zu Batterie eingang" |
406 | | - }, |
407 | | - "type": "select", |
408 | | - "opts": { |
409 | | - "opts": [ |
410 | | - { |
411 | | - "l": { |
412 | | - "de": "Nicht invertiert", |
413 | | - "en-US": "Not Inverted" |
414 | | - }, |
415 | | - "v": "NotInverted" |
416 | | - }, |
417 | | - { |
418 | | - "l": { |
419 | | - "de": "Invertiert", |
420 | | - "en-US": "Inverted" |
421 | | - }, |
422 | | - "v": "Inverted" |
423 | | - } |
424 | | - ] |
425 | | - } |
426 | | - } |
427 | | - }, |
428 | 430 | { |
429 | 431 | "name": "Grid cost €/kWh", |
430 | 432 | "type": "num", |
|
718 | 720 | ], |
719 | 721 | "meta": { |
720 | 722 | "module": "@gitmacer/node-red-fritzsolardisplay", |
721 | | - "version": "2.1.4", |
| 723 | + "version": "2.2.2", |
722 | 724 | "author": "Tim Oberle", |
723 | 725 | "desc": "Show your current (solar) power information on your Fritzfon", |
724 | 726 | "keywords": "energy,live,image,bild,solar,display,monitor,avm,fritzbox,fritzfon,power,meter,usage,phone,webcam,c5,c6,anzeige,photovoltaik,solaranzeige,gitmacer" |
|
740 | 742 | "initialize": "", |
741 | 743 | "finalize": "", |
742 | 744 | "libs": [], |
743 | | - "x": 1810, |
| 745 | + "x": 1770, |
744 | 746 | "y": 140, |
745 | 747 | "wires": [ |
746 | 748 | [ |
|
759 | 761 | "initialize": "", |
760 | 762 | "finalize": "", |
761 | 763 | "libs": [], |
762 | | - "x": 1560, |
| 764 | + "x": 1520, |
763 | 765 | "y": 140, |
764 | 766 | "wires": [ |
765 | 767 | [ |
|
829 | 831 | "initialize": "", |
830 | 832 | "finalize": "", |
831 | 833 | "libs": [], |
832 | | - "x": 1220, |
| 834 | + "x": 1180, |
833 | 835 | "y": 140, |
834 | 836 | "wires": [ |
835 | 837 | [ |
|
848 | 850 | "initialize": "", |
849 | 851 | "finalize": "", |
850 | 852 | "libs": [], |
851 | | - "x": 860, |
| 853 | + "x": 820, |
852 | 854 | "y": 140, |
853 | 855 | "wires": [ |
854 | 856 | [ |
|
861 | 863 | "type": "function", |
862 | 864 | "z": "774cc0ad6b18a8e3", |
863 | 865 | "name": "calculate toHouse", |
864 | | - "func": "if (msg.solarUnit == \"W\" && msg.fromGridUnit == \"W\" && msg.toHouse === undefined && Number.isFinite(msg.solar) && Number.isFinite(msg.fromGrid)) {\n if (msg.fromGrid < 0){\n msg.toHouse = msg.solar + msg.fromGrid;\n }\n else{\n msg.toHouse = msg.solar\n }\n \n if (msg.toBattery > 0 && Number.isFinite(msg.toBattery)) {\n msg.toHouse = msg.toHouse - msg.toBattery;\n }\n msg.toHouseUnit = \"W\";\n}\nelse if (msg.solarUnit == \"kWh\" && msg.toGridUnit == \"kWh\" && msg.toHouse === undefined && Number.isFinite(msg.solar) && Number.isFinite(msg.toGrid))\n{\n msg.toHouse = msg.solar - msg.toGrid;\n msg.toHouseUnit = \"kWh\";\n}\nelse if (msg.solarUnit == \"€\" && msg.toGridUnit == \"€\" && msg.toHouse === undefined && Number.isFinite(msg.solar) && Number.isFinite(msg.toGrid)) {\n msg.toHouse = msg.solar - msg.toGrid;\n msg.toHouseUnit = \"€\";\n}\nreturn msg;", |
| 866 | + "func": "let includeBattery = env.get(\"ToHouseIncludeBattery\") == \"Yes\";\n\nif (msg.solarUnit == \"W\" && msg.fromGridUnit == \"W\" && msg.toHouse === undefined && Number.isFinite(msg.solar) && Number.isFinite(msg.fromGrid)) {\n msg.toHouse = msg.solar\n\n if (msg.toHouse < 0) {\n msg.toHouse = 0;\n }\n\n if (includeBattery && msg.toHouse > msg.house + msg.combinedToBattery) {\n msg.toHouse = msg.house + msg.combinedToBattery;\n }\n else if (!includeBattery && msg.toHouse > msg.house){\n msg.toHouse = msg.house;\n }\n\n msg.toHouseUnit = \"W\";\n}\nelse if (msg.solarUnit == \"kWh\" && msg.toGridUnit == \"kWh\" && msg.toHouse === undefined && Number.isFinite(msg.solar) && Number.isFinite(msg.toGrid))\n{\n msg.toHouse = msg.solar - msg.toGrid;\n\n if (!includeBattery && msg.toHouse > msg.house){\n msg.toHouse = msg.house;\n }\n\n msg.toHouseUnit = \"kWh\";\n}\nelse if (msg.solarUnit == \"€\" && msg.toGridUnit == \"€\" && msg.toHouse === undefined && Number.isFinite(msg.solar) && Number.isFinite(msg.toGrid)) {\n msg.toHouse = msg.solar - msg.toGrid;\n msg.toHouseUnit = \"€\";\n}\nreturn msg;", |
865 | 867 | "outputs": 1, |
866 | 868 | "noerr": 0, |
867 | 869 | "initialize": "", |
868 | 870 | "finalize": "", |
869 | 871 | "libs": [], |
870 | | - "x": 1050, |
| 872 | + "x": 1010, |
871 | 873 | "y": 140, |
872 | 874 | "wires": [ |
873 | 875 | [ |
|
886 | 888 | "initialize": "", |
887 | 889 | "finalize": "", |
888 | 890 | "libs": [], |
889 | | - "x": 300, |
| 891 | + "x": 120, |
890 | 892 | "y": 140, |
891 | 893 | "wires": [ |
892 | 894 | [ |
|
27112 | 27114 | "initialize": "", |
27113 | 27115 | "finalize": "", |
27114 | 27116 | "libs": [], |
27115 | | - "x": 650, |
| 27117 | + "x": 610, |
27116 | 27118 | "y": 140, |
27117 | 27119 | "wires": [ |
27118 | 27120 | [ |
@@ -36758,11 +36760,11 @@ |
36758 | 36760 | "initialize": "", |
36759 | 36761 | "finalize": "", |
36760 | 36762 | "libs": [], |
36761 | | - "x": 450, |
| 36763 | + "x": 270, |
36762 | 36764 | "y": 140, |
36763 | 36765 | "wires": [ |
36764 | 36766 | [ |
36765 | | - "57978a63f95fc33c" |
| 36767 | + "81b698f1cb92cd95" |
36766 | 36768 | ] |
36767 | 36769 | ] |
36768 | 36770 | }, |
|
36777 | 36779 | "initialize": "", |
36778 | 36780 | "finalize": "", |
36779 | 36781 | "libs": [], |
36780 | | - "x": 1350, |
| 36782 | + "x": 1310, |
36781 | 36783 | "y": 140, |
36782 | 36784 | "wires": [ |
36783 | 36785 | [ |
@@ -50921,21 +50923,21 @@ |
50921 | 50923 | ] |
50922 | 50924 | }, |
50923 | 50925 | { |
50924 | | - "id": "96c080c3c196de2a", |
| 50926 | + "id": "81b698f1cb92cd95", |
50925 | 50927 | "type": "function", |
50926 | 50928 | "z": "774cc0ad6b18a8e3", |
50927 | | - "name": "Invert toBattery", |
50928 | | - "func": "if (Number.isFinite(msg.toBattery) && env.get(\"To battery input\") == \"Inverted\"){\n msg.toBattery *= -1;\n}\n\nreturn msg;", |
| 50929 | + "name": "combine", |
| 50930 | + "func": "msg.combinedToBattery = msg.toBattery;\nif ((Number.isFinite(msg.toBattery) || Number.isFinite(msg.fromBattery)) //atleast one is a number\n && typeof msg.toBattery != \"string\" && typeof msg.fromBattery != \"string\" //none is a string\n && msg.toBatteryUnit == msg.fromBatteryUnit) //same unit\n{\n msg.combinedToBattery = (msg.toBattery ?? 0) - (msg.fromBattery ?? 0);\n}\nmsg.combinedToBattery = msg.combinedToBattery ?? 0;\n\nlet combineBattery = env.get(\"1. multi icon\") != \"FromToBattery\";\nif (combineBattery //combined selected\n && (Number.isFinite(msg.toBattery) || Number.isFinite(msg.fromBattery)) //atleast one is a number\n && typeof msg.toBattery != \"string\" && typeof msg.fromBattery != \"string\" //none is a string\n && msg.toBatteryUnit == msg.fromBatteryUnit) //same unit\n{\n msg.toBattery = (msg.toBattery ?? 0) - (msg.fromBattery ?? 0);\n delete msg.fromBattery;\n}\n\nlet combineGrid = env.get(\"3. multi icon\") == \"FromGrid\";\nif (combineGrid //combined selected\n && (Number.isFinite(msg.fromGrid) || Number.isFinite(msg.toGrid)) //atleast one is a number\n && typeof msg.fromGrid != \"string\" && typeof msg.toGrid != \"string\" //none is a string\n && msg.fromGridUnit == msg.toGridUnit) //same unit\n{\n msg.fromGrid = (msg.fromGrid ?? 0) - (msg.toGrid ?? 0);\n delete msg.toGrid;\n}\n\nreturn msg;", |
50929 | 50931 | "outputs": 1, |
50930 | 50932 | "noerr": 0, |
50931 | 50933 | "initialize": "", |
50932 | 50934 | "finalize": "", |
50933 | 50935 | "libs": [], |
50934 | | - "x": 140, |
| 50936 | + "x": 420, |
50935 | 50937 | "y": 140, |
50936 | 50938 | "wires": [ |
50937 | 50939 | [ |
50938 | | - "63fc5dfacf242fc0" |
| 50940 | + "57978a63f95fc33c" |
50939 | 50941 | ] |
50940 | 50942 | ] |
50941 | 50943 | } |
|
0 commit comments