Closed gulli1986 closed 1 year ago
Hi,
I thought I should examine this carefully now, since I have gotten the same question before. I found that there is a bug. All my sensors are returning consumption in W, but I am treating it as kW.
If your situation is the same, you can fix this in the Reduction Actions node, function getConsumption, the first part of the if, change to:
return sensor.state / 1000
If you are using fixed values or functions, make sure they also result in kW, as that is what is used.
I haven't tried this, so this is what I find by just looking at the code, but I think this will be right.
Please try and give feedback.
Thanks @ottopaulsen . I agree with you, it looks like everything needs to be in kW
.
My problem is that some of my sensors report W
and some report kW
so I cannot use the workaround you mentioned above.
As of now I made a template to convert all my sensors from W
to kW
in HA but I thought maybe it could be possible to read the sensor unit in the getConsumption function and either return sensor.state
or sensor.state / 1000
based on the unit?
Isn't there a way to create a sensor based on another sensor where you divide the value by 1000?
There is in HA using a template which I did. Not sure how this could be implemented in Node Red without creating a new sensor in HA.
That was the idea, creating a new sensor in HA.
Closing this issue. Creating a new sensor in HA in kW as a workaround.
Hello @ottopaulsen , just updated to the new capacity grid after the last powersaver update. Here I can see the following in the code:
function getConsumption(consumption) {
if (typeof consumption === "string") {
const sensor = ha.states[consumption];
return sensor.state / 1000;
} else if (typeof consumption === "number") {
return consumption;
} else if (typeof consumption === "function") {
return consumption();
} else {
node.warn("Config error: consumption has illegal type: " + typeof consumption);
return 0;
}
}
It looks like you have divided the output by 1000. Is that because all your sensors are reporting in W
?
I converted all my sensors to kW
so I guess I can remove the /1000
?
Solved, needed to remove /1000
Hello,
Looking at the documentation for the capacity part of the grid tariff and have a question regarding the
Reduction Actions
.Do the
entity id
of theconsumption variable
need to be reporting consumption in a specific unit, i.ekW
? I have some sensors reporting inW
, some other reporting inkW
. For me it looks like I need to make the conversion so that everything is inkW
, is that correct?