Virtual device problem - value from solar battery not updating

Hi guys,

I have created a virtual device that should show me the % charge state of my solar battery (info comes from Sofar inverter - sofar app on Homey).

I think I’m doing something wrong because it’s not working :slight_smile:

Here is my simple flow:

I think there is something I’m not filling in correctly on the then card. The first empty bubble says “sensor” and the second one is “value”

I would like to get the battery % state on the Virtual Device card in the device overview.

Thanks!

I think the problem is that you are using 2 tags.

At this page is showed how to use virtual devices.
https://community.homey.app/t/howto-set-a-value-to-a-virtual-device/45883
There they use examples for temperature.
I tink that you must use neasure_battery as tekst.
But it depends on the capabilitys of your device.

If I am wrong there are more people reading here so the right answer will eventually show up…

1 Like

This works! Thanks :slight_smile:

However: the virtual device shows a battery logo:

image

But I would like it to display in a numeric value in %, do you know how to get this done?

Thanks for the assistance!

In that case you’ll need to use an advanced virtual device. Often you even don’t need flows to update the device values.

1 Like

Ok trying to get this to work :slight_smile:
I have this for the moment, but I need to fill in a BLLExpression (but the field is greyed out?


Am I on the right path? :slight_smile:

Thank you!

Nice!
Try using a Number field. The percentage is a numeric value (as shown).
“React” can be left empty (you can’t command a battery level).

Nice! Almost there! :slight_smile:

Now the only issue is that the value in the tile shows 2400% instead of 24% that is represented when you click the tile…

Thanks for your support!

Looks like the app is showing a 100x value, the web interface shows the correct value…

1 Like

The issue is: homey works with 0 to 1 values internally, and in flow cards. Somehow when you use % as unit, it multiplies the value with 100 to convert it into a % value.
The battery reports 0 to 100 probably, so you’ll have to add a / 100 (divide by 100) calculation.
On top of my head you’d enter $value/100 into the BLL field to solve it

You are the man :slight_smile: Thanks! This worked perfectly

1 Like

How do you make the BLL field available for input?

Don’t know, just enter something and see what happens
What Joske522 described as ‘grayed out’, this one:


isn’t grayed out, the red line even points to it being a mandatory field.

Kay, is your Q about number fields, or text fields?

Do these examples make sense?

I never understood: What is the difference between “Calculation BLL expression” and “BLL Expression” in the second picture?

@Rmb
Not much actually.
But the caculation field is required with multiple reflect devices to require a group calculation.
The first version with it, just used the BLL expression field and made it mandatory. But users than didnt notice why they couldn’t save it, if the left the field empty.

Also it gives you a change of writing a calculation to get one value of all devices, and then use that value to calculate with all grouped values.
So in some cases, it gives better readability.

Hi, thanks for your response. It is a number field, and BLL is not shown :slight_smile:
image

I thought so, but how do I address this calculated value?

The result from the Calculation field is available as $value in the Expression field.
$values is available in both fields.

1 Like

That is a well-kept secret😀

Well, its shown in the tooltip next to the fields.

1 Like

Yes, I see it right now :grin:
To be honest: it took me a while before I understood why sometimes there was one “BLL” field and sometimes two. The latter in the case one is reflecting more than 1 device/field. It is quite a sophisticated user interface.