pacemaker82 / PredBat-Table-Card

A custom Predbat table card that allows flexible column management and styling
7 stars 1 forks source link

1.5.1.8 Getting shortened Chg/Dis statii with latest predbat release #19

Closed gcoan closed 2 months ago

gcoan commented 2 months ago

Despite being in landscape on my ipad I am seeing the Charge/Discharge statii truncated today.

Looks like predbat html plan is truncating the text which must be a new thing in the main() branch. Can the table card revert this?

IMG_0901

Previous predbat version:

IMG_0896

Looking at the code for the main branch, there are new columns added for CO2, some of the labels change in debug mode, and several of the status text labels have been truncated:

        if plan_debug:
            html += "<td><b>PV kWh (10%)</b></td>"
            html += "<td><b>Load kWh (10%)</b></td>"
        else:
            html += "<td><b>PV kWh</b></td>"
            html += "<td><b>Load kWh</b></td>"
        if self.num_cars > 0:
            html += "<td><b>Car kWh</b></td>"
        if self.iboost_enable:
            html += "<td><b>iBoost kWh</b></td>"
        html += "<td><b>SOC %</b></td>"
        html += "<td><b>Cost</b></td>"
        html += "<td><b>Total</b></td>"
        if self.carbon_enable:
            html += "<td><b>CO2 g/kWh</b></td>"
            html += "<td><b>CO2 kg</b></td>"
        html += "</tr>"
…
                if limit > 0.0:
                    if self.set_charge_freeze and (limit == self.reserve):
                        state = "FrzChrg&rarr;"
                        state_color = "#EEEEEE"
                        limit_percent = soc_percent
                    elif limit_percent == soc_percent_min_window:
                        state = "HoldChrg&rarr;"
                        state_color = "#34DBEB"
                    elif limit_percent < soc_percent_min_window:
                        state = "NoChrg&searr;"
                        state_color = "#FFFFFF"
                    else:
                        state = "Chrg&nearr;"
                        state_color = "#3AEE85"
                    if self.charge_window_best[charge_window_n]["start"] in self.manual_charge_times:
                        state += " &#8526;"
                    show_limit = str(limit_percent)

            if discharge_window_n >= 0:
                limit = self.discharge_limits_best[discharge_window_n]
                if limit < 100 and limit > soc_percent_max_window:
                    if state == soc_sym:
                        state = ""
                    if state:
                        state += "</td><td bgcolor=#AAAAAA>"  # charging and freeze discharging in same slot, split the state into two
                        split = True
                    else:
                        state_color = "#AAAAAA"
                    state += "FrzDis&rarr;"
                elif limit < 100:
                    if state == soc_sym:
                        state = ""
                    if state:
                        state += "</td><td bgcolor=#FFFF00>"  # charging and discharging in the same slot
                        split = True
                    else:
                        state_color = "#FFFF00"
                    state += "Dis&searr;"
pacemaker82 commented 2 months ago

If I turn on debug mode I am not seeing any difference in the original predbat plan column descriptions. What else do I need to do to trigger this outcome in the original plan exactly?

gcoan commented 2 months ago

You need to be using the predbat version that’s on main, not the public release but it’ll be doubtless published soon by Trefor On 23 Apr 2024 at 14:00 +0100, pacemaker82 @.***>, wrote:

If I turn on debug mode I am not seeing any difference in the original predbat plan column descriptions. What else do I need to do to trigger this outcome in the original plan exactly? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

pacemaker82 commented 2 months ago

so is it using these truncated status's only if the new CO2 columns is added, or all the time now?

pacemaker82 commented 2 months ago

could you try this? https://github.com/pacemaker82/PredBat-Table-Card/releases/tag/v1.5.1.10

gcoan commented 2 months ago

Trefor has added/is adding new capability to plan charging when "greenest" https://github.com/springfall2008/batpred/issues/980

Needs I think the National Grid integration (which I don't have at present), and then its another switch to enable it.

If enabled then you get two extra columns in the html plan from what I've seen of the code.

But looks like with the extra columns Trefor has decided to shorten the statii labels to ensure the plan fits onto a page. This change to the labels is permanent regardless of whether those columns are shown or not.

I'm trying the version on main to see if it improves a 'stuck in hold charge' I experienced last night and noticed that the labels had changed today.

Trying the 1.15.1.10, it displays charge and hold charge OK image

pacemaker82 commented 2 months ago

ok well it looks like my fix fixed it anyway and is backwards compatible too.

gcoan commented 2 months ago

Fixed for Discharge as well

gcoan commented 2 months ago

Don't seem to be able to reopen this

Just noticed force discharge is truncated image

pacemaker82 commented 2 months ago

@gcoan should be fixed in https://github.com/pacemaker82/PredBat-Table-Card/releases/tag/v1.5.2.1

gcoan commented 2 months ago

@pacemaker82 old text:

image

Which I definitely didn't like.

New text:

image

I'm not massively loving the length of the new text, worried it'll scroll the plan unnecessarily, but could maybe live with it. FreezeChrg now looks odd in comparison, as 'Freeze Charge' is no longer than 'Force Discharge'

'Freeze Discharge' in full is of course getting even longer ...

pacemaker82 commented 2 months ago

screenshots are the same, can you provide the comparison image so I have context?

gcoan commented 2 months ago

Doh!

Here's the new screen

image

pacemaker82 commented 2 months ago

is the best or expected option to show "Force Chrg" and "Force Dischrg" ?

gcoan commented 2 months ago

I don't know. It's a trade off of space vs readability

How about

Freeze Charge Freeze Dischrg Force Charge Force Dischrg

?

gcoan commented 2 months ago

Looking again

FreezeChrg looks OK and doesn't push the width too much but both the Force's do make the column wider.

Of course Freeze Discharge is going to be the widest possible one. So maybe find the shortest acceptable version of that and work backwards image

pacemaker82 commented 2 months ago

I'm going to adjust to "Force Dischrg" and leave the rest

gcoan commented 2 months ago

this looks a lot better than the standard Predbat statii labels that are too truncated now in my view

Could split FreezeChrg into two words but then that'd be inconsistent with FreezeDischrg which is getting too long anyway

Thanks