Pvoutput API not behaving

I am trying to moderate the value of power on my gas consumption system. I have always used a statement to ensure the lowest value will be 1 watt but I need to limit the maximum power now as I occasionally get a huge spike, so I have added a second line to the Currentcost.ini file - so I have:-

rule=if(power > 33000) power = 33000;
rule=if(power < 1) power = 1.00;

The second line seems to work (I never get less than 1 watt) but the first line seems to not work as I am getting values greater than 33000 watts.

Does anyone know what might be wrong?

There can only be one rule line in the config and the last one is used.

Try -

rule=if (power > 33000) power = 33000; else if (power < 1) power = 1;

Many thanks BB - that works fine.
It follows that it seems multiple statements for (say) power are not allowed in the script as I don’t think there was anything wrong with my format.