Olen / lovelace-flower-card

Lovelace Flower Card to match the custom plant integration

Home Page:https://github.com/Olen/homeassistant-plant/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some of meter logic seems to be 'wonky'?

iMiMx opened this issue · comments

commented

End up with some strange meters, I don't think it's just browser caching:

Far-end shows as coloured, when it shouldn't - and you end up with a mix of red and green

image

Checked with the latest Beta5 release.

commented

Thanks, I'll look into it.

I don't have a full picture of the TS-code yet, so maybe @marcokreeft87 is able to shed som light on this too.

Hmm this was working in the version I delivered Screenshot_20231012_120928_Home Assistant.jpg

commented

It seems to work most of the time, but I have seen the same occational glitches, that goes away again after some time.

Maybe the getdata is called too often?

I tried some fixes for the width of the meters, but some labels might be just too big

image

commented

The prior version loses the units, when needed, it seems - screenshot from mobile app:

IMG_4317

Ah that helps, lets try that :)

I've made a PR, it already better that the previous version. But I can't get all bars to be the same width when one of the labels is bigger. Constant percentages doesnt seem to be the solution here. Display flex is responsive, but maybe too responsive.. For the small card its working perfectly now tho

Seeing some similar issues with the latest beta

image

commented

If you are able to catch this, please provide some more debug info (from javascript console).

Hi Olen,

Sorry I am a layman - what do you you need exactly from the console?
I know how to get there but not sure what you want.
I have like 12 plants, so high likelihood of one of them showing the issue.
Just tell me what you need and I'll get the info from the console.

Edit: from what I can see, the elements are getting the wrong colour here.

<div class="attribute tooltip ">
            <div class="tip" style="text-align:center;"><!--?lit$012416503$-->illuminance: 3618.0 lx<br>(800 ~ 27000 lx)</div>
            <ha-icon></ha-icon>
            <div class="meter red">
                <span style="width: 100%;" class="bad"></span>
            </div>
            <div class="meter green">
                <span class="bad" style="width:10.755725190839694%;"></span>
            </div>
            <div class="meter red">
                <span class="bad" style="width:100%;"></span>
            </div>
            <span class="header"><span class="value"><!--?lit$012416503$-->3618.0</span>&nbsp;<span class="unit"><!--?lit$012416503$-->lx</span></span>
        </div>
<div class="attribute tooltip ">
            <div class="tip" style="text-align:center;"><!--?lit$012416503$-->conductivity: 826.0 µS/cm<br>(300 ~ 1000 µS/cm)</div>
            <ha-icon></ha-icon>
            <div class="meter red">
                <span style="width: 100%;" class="bad"></span>
            </div>
            <div class="meter green">
                <span class="bad" style="width:75.14285714285714%;"></span>
            </div>
            <div class="meter red">
                <span class="bad" style="width:100%;"></span>
            </div>
            <span class="header"><span class="value"><!--?lit$012416503$-->826.0</span>&nbsp;<span class="unit"><!--?lit$012416503$-->µS/cm</span></span>
        </div>

Hi,

I also experienced the same for a few weeks. Wanted to check if there is any update on the concern, or if there is something I could provide in terms of logs or configuration.

here is another example a few minutes later

Flower Card: v2023.10.5-beta2
Home Assistant Plant: v2023.10.0

Home Assistant 2023.10.5
Supervisor 2023.10.1
Operating System 11.1
Frontend 20231005.0 - latest

commented

I am not sure if this is visible in the logs, but creating a release with some more debug logging could probably reveal it.
I'll see if I am able to create a beta release with added debug output.

Hi @Olen,
I kindly wanted to check if you had any time to look into that issue. Happy to provide some more debugging input if you let me know what you would require.

Not sure if that helps in the analysis, but it seems that for the parameter "soil_moisture" I'm not facing that kind of issue. This could also only be a coincidence. However, I was setting different values via the developer tool and haven't ever experienced any issue in the display of the "moisture" level.

commented

I pushed a new test-release. Not sure it fixes this, but I hope so.

It is hard to debug, as it only happens sometimes. If anyone experience this permanently - even with the latest flower-card.js, please provide some debug info and some output from the browser debugger to try to pinpoint what css attributes the different parts of the graph has.

Thank you for looking into this. But I still have the same kind of issue as before even after upgrading to the latest v2024.1.0-beta4.
Attached please see some further logs.

image

CSS Attributes

commented

I just pushed a beta (5) with LOTS of debug info.
If you have this card by itself on a dashboard, what does the browser console say about your conductivity?
Max, Min, Value and Available?

commented

After looking at the code, I am especially interessted in what your "max" is

Does that screenshot help? It seems that the needed variables/values for the evaluation are available and correct.
max / i is 1300.

image

commented

... but why?!?

u is clearly less than i

Why then is line 313 resulting in "bad" and line 316 resulting in "100%"?

Or is there some string-int conversion that fails here? But why only for certain measurements?
I could try to cast all the values to floats...

commented

Sorry for the betas - but now I cast all the values, so they should be ok.
Please test the latest vesion from master

commented

Only limited testing for me so far, but I think you might have cracked it - much appreciated.

commented

Great.
I'll make another release then. Fingers crossed

I can also confirm that the latest change seems to have fixed the issue. At least I haven’t experienced it since then.

Thank you again for fixing it 😊