[Nut-upsdev] new variable

Arjen de Korte nut+devel at de-korte.org
Thu Oct 1 07:23:37 UTC 2009


Citeren "Kiss Gabor (Bitman)" <kissg op ssg.ki.iif.hu>:

> Battery is fully charged. Suddenly Utility power breaks.
> In the modell the battery.current parameter is set to -42 amper.
> After half an hour battery is empty. battery.current=0.
> Then power returns. +1.3 A is assigned to the variable.
> Battery is slowly recharged (in 16 hours).
>
> The question is: how could I tune the above values (42 and 1.3)
> instead of wiring hard into the program code?

As I told you, by making them a R/W variable. Have a look at the  
docs/new-drivers and look for 'dstate_setflags'.

> I though I need some config file that contains this:
> battery.current: 42.0
> battery.current.recharge: 1.3
> etc.

Not recommended. Any variables from the configuration files require  
reloading the driver. It is probably much easier to make this a R/W  
variable, so that you can modify it on the fly via 'upsrw'.

> Actually battery.current.recharge would not be advertised by the driver.

In that case, you can name it as you please, although we certainly  
don't recommend parameters that are hidden.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list