Map battery level to %

Yes, that is good idea, for now I have used JS transformation on the title to show percentage, that is fine and when I go to details I have generated another binding with voltage showings. That is perfect for now.
Thanks for support bud!

Hello,

Iā€™m also turning aroundā€¦
I want to closely monitor my thermal cranes (thermostats) batteries.
They range from 3v (new) to 2.2v (emptyā€¦would require an alarm).

So my range goes from 2.2 to 3ā€¦and I would like to display it at the levels:

  • 2.2v = empty
  • 2.4v
  • 2.6v
  • 2.8v
  • 3.0v= full

As a perfect newbie I really donā€™t understand all the proposals about transform/proxy/othersā€¦ :frowning:
Would anyone have a real life example to share ?

Tx!

What actual state do your Items take up? This influences paths available to you.

The battery level is fetched per 0.1 volt.

What actual state do your Items take up?
Perhaps show us an events.log entry.

Or use a 2nd item with range 0-100, standard icons and a rule to trigger upon changes of your original value and to convert it instead of using a transformation. That rule can also issue a warning right away.

Here you go:

2020-11-01 16:41:46.519 [vent.ItemStateChangedEvent] - VanneSalleDeJeu_4_BatteryState changed from NULL to 2.80 V

2020-11-01 17:24:32.551 [vent.ItemStateChangedEvent] - VanneCouloir1erTage_4_BatteryState changed from NULL to 2.30 V

Okay, your Items are quantity types - they have units. You need to know that for your rules and transformations.

The constraint is that dynamic icons only work for 0-100 and only in integer steps, i.e. you get the same icon for 2.1 as 2.9.
So you will have to use a dummy Item with scaled value, as @mstormi suggests.

Optionally, you can add a transformation to un-scale the dummy state for a display text.

Tx.

Could you guide me in setting up that ā€œdummy item with scaled valueā€ ?

see

Not as evident as you think it is :slight_smile:

I keepthinkingā€¦
in my sitemap: Text item=ThermostatSalon_2_BatteryState icon=ā€œbatterieā€

Where ThermostatSalon_2_BatteryState givesthe value used by the dynamic icon ā€œbatterieā€.

Iā€™m an absolute noob when it comes to put my ideas in a ā€œscriptā€ ā€¦ I keep searching

What weā€™re saying is that Item is no use in your sitemap. Youā€™ve decided you want icons to work a certain way, and that cannot happen using the values that Item takes.

So you need to make another Item that can have a range of values that you can use with icons, and you put that Item on your sitemap instead.

A rule can listen for changes in your original Item, and do some maths on the value and place the scales value into your new dummy Item.