Closed wranglatang closed 2 years ago
That's the way the number comes out of the inverter via modbus. Negative is import, so your sensor is reporting as designed. The way I like to think about it, if it's positive that's good as I'm making money, if it's negative not so good as I'm losing money! If you really want it round the other way I guess you could always create a new template sensor to multiply by -1. Or possibly change the scale in your code above to -0.001? Not sure if that will work with the scale parameter, and also the losses sensor if you have that configured will then go crazy ape with the change of sign.
As @Daibutt says - that's best thought of as "grid power exported", so a negative number is importing from grid, positive number is exporting.
Did you rename the sensor at all, or is that the default when it was installed? I thought that sensor was called Grid CT (as in the CT clamp reading, following Fox's naming conventions).
Thanks both for your feedback. I have tired setting the scale to -0.001 and it doesn't make any difference.
@StealthChesnut Your explantion makes sense if you look at it as a "Grid Power Export" Sensor. However this behaviour is different to many other devices such as the shelly and a Solax Inverter that I also have. Both of these show positive numbers when consuming from grid and negative when feeding back.
@wranglatang I felt the same way, if I've understood you correctly - it seemed to me it reads better the other way round. So I now have this sensor to reverse the grid reading, starting from the sensor named Grid CT as @StealthChesnut describes. This is my code to reverse it...
my_grid_ct:
friendly_name: "Grid CT Inverse"
unit_of_measurement: 'kW'
device_class: power
value_template: >
{{ states('sensor.grid_ct') | float(default=0) * -1 }}
And I use it on a statistics graph and this gauge... (Export negative yellow, Import positive red)
I hope that's of some help.
I stand corrected. ive just left my sensor for a bit and setting the Scaling to -0.001 seem to work!! so no need for an additional sensor here!
This sensor is (as @Daibutt says) just giving the raw data from the inverter as it's supplied. There are also two more sensors that use this as a data source and convert it to more "useable" readings:
feed_in_power:
friendly_name: "FeedIn power"
unit_of_measurement: 'kW'
device_class: power
value_template: >
{% if (states('sensor.grid_ct') | float(default=0) ) > 0 %}
{{ states('sensor.grid_ct') | float(default=0) * 1 }} {% else %}
0
{% endif %}
grid_consumption:
friendly_name: "Grid consumption"
unit_of_measurement: 'kW'
device_class: power
value_template: >
{% if (states('sensor.grid_ct') | float(default=0) ) < 0 %}
{{ states('sensor.grid_ct') | float(default=0) * -1 }}
{% else %}
0
{% endif %}
If you've followed the install instructions then you should also have these available for more UI-friendly numbers. I won't be changing the underlying sensor as it's what Fox have decided is correct.
Hello, I have connected my inverted to home assistant using LAN and one of the sensors seems to be backwards:
As you will see during the night the value is a Minus but in the day its possitive. I would expect it to be opposite I.E returning to grid should be a negative number.
I have looked at the foxess app and that is reporting Returning to grid correctly. Here is the configuration in HA for the parameter: