Hi,
I am pulling data from an Alpha ESS inverter, using a custom node in Node Red. The values are polled by the node and populate sensors which i display in HA.
What I want to do however is create 2 new sensors, which record wattage (imported) and wattage (exported). This is represented by the node as either a positive value (200) or a negative value (-200). This part works as it should.
The issue is that the “less than” value when used in HA will work backwards, it shows as a negative value as the inverter has 1 CT. I would like to take this “less than” value and change it to a positive number, then, if inverter is exporting, the import should send 0 to the import sensor. If the inverter is importing, it should be send 0 to the export sensor.
Here is what I have so far:
[{"id":"c99cbbb8e48d5306","type":"tab","label":"Battery Storage","disabled":false,"info":"","env":[]},{"id":"aac032fbea181ea5","type":"ha-entity","z":"c99cbbb8e48d5306","name":"Grid Feed","server":"2278bc1a32e13768","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"b3_grid_feed"},{"property":"device_class","value":"power"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"W"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.grid","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":320,"y":100,"wires":[[]]},{"id":"7209d3d7fda1196b","type":"ha-entity","z":"c99cbbb8e48d5306","name":"Battery State of Charge","server":"2278bc1a32e13768","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"b3_battery_soc"},{"property":"device_class","value":"battery"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.battery.soc","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":370,"y":140,"wires":[[]]},{"id":"079216b83270ba48","type":"ha-entity","z":"c99cbbb8e48d5306","name":"Battery Load","server":"2278bc1a32e13768","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"b3_battery_load"},{"property":"device_class","value":"power"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"W"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.battery.load","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":330,"y":180,"wires":[[]]},{"id":"1ba9b87e8c963f3b","type":"ha-entity","z":"c99cbbb8e48d5306","name":"House Consumption","server":"2278bc1a32e13768","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"b3_house_consumption"},{"property":"device_class","value":"power"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"W"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.consumption","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":360,"y":60,"wires":[[]]},{"id":"c7ffecec2bda02eb","type":"change","z":"c99cbbb8e48d5306","name":"Battery Load","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.battery.load","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":240,"wires":[["ebc22e19088a3f4e"]]},{"id":"ebc22e19088a3f4e","type":"switch","z":"c99cbbb8e48d5306","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"0","vt":"str"},{"t":"lte","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":520,"y":240,"wires":[["feb337d065f2db13"],["0b50b7e24846053b"]]},{"id":"0b50b7e24846053b","type":"ha-entity","z":"c99cbbb8e48d5306","name":"b3_power_imported","server":"2278bc1a32e13768","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"b3_power_imported"},{"property":"device_class","value":"power"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"W"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":740,"y":260,"wires":[[]]},{"id":"feb337d065f2db13","type":"ha-entity","z":"c99cbbb8e48d5306","name":"b3_power_exported","server":"2278bc1a32e13768","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"b3_power_exported"},{"property":"device_class","value":"power"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"W"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":740,"y":220,"wires":[[]]},{"id":"2278bc1a32e13768","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"}]
Any ideas?
Thanks.