logo elektroda
logo elektroda
X
logo elektroda

OpenBeken Charts Driver - configurable and flexible measurement history on your device

p.kaczmarek2 4638 65
ADVERTISEMENT
  • #61 21261598
    max4elektroda
    Level 20  
    jkwim wrote:
    One issue that I found when the chart is working is that the bottom part of the screen cannot be kept without scrolling back to chart window.

    Yes, I see what you mean.
    We will need to change the "redrawing". Actually the chart is destroyed and a new instance is created.
    I think I already have a solution, will open an PR soon and post it here.
    In my test I could change this to "update" the chart, which doesn't seem to refocus to the chart.

    Added after 1 [hours] 29 [minutes]:

    Please try the builds from PR #1389.
    For this does redrawing w/o setting the focus on the chart ...

    Web page with line chart and navigation buttons.
  • ADVERTISEMENT
  • #62 21261957
    jkwim
    Level 12  
    Will give it a try
    Thanks

    Added after 11 [hours] 32 [minutes]:

    Upgraded to OpenBK7231T_App_1389_merge_b1e0d8dd960f.

    It works fine now.

    Thanks for your quick update.
  • ADVERTISEMENT
  • #63 21262367
    max4elektroda
    Level 20  
    Thanks for your feedback!

    @p.kaczmarek2: Just found a nasty little "bug" with charts: When setting things, we don't care for the indexes, so the device might crash on wrong input.

    Windows emulator e.g. will crash if you define a single value graph
    chart_create 96 1 1 and later do
    chart_addNow 10 20. Same will happen, if you later call
    chart_setVar 1 "XX" "YY"

    We should check for "<=numVars" or "<=numAxes" before setting them.

    I would propose to do this in the "calling commands" (CMD_Chart_SetAxis/CMD_Chart_SetVar/CMD_Chart_AddNow/CMD_Chart_Add) and mayby, just to be sure, also in the code actually doing the settings (Chart_SetAxis/Chart_SetVar/Chart_SetSample).

    Open is the question, what to do in this case when adding samples?
    Only taking as much samples as defined or reject the whole command?
  • ADVERTISEMENT
  • #64 21262676
    p.kaczmarek2
    Moderator Smart Home
    Nice find, I'd just return out of command with INVALID_ARG return code (or how was this enumeration called in Obk)...
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #65 21263018
    max4elektroda
    Level 20  
    I extend PR #1389 to take care of this, too.

    I took this one because I would also merge the change to use update() for the charts.

    It was not so evident to me when I focussed on the charts, that every refresh used to set the focus on the chart, which is annoying if you scrolled down to the buttons and the browser switches back all the time.

    Some tests would be great, now the update should not move the view of the page and all input should be checked against the charts properties.
    So if you could try if it's intercepting all kinds of "false" input that would be great.

    Add names for non-existent axes or vars, setting more samples than defined ...

    I hope it's stable regarding this now.
  • #66 21440659
    Zogdan
    Level 9  
    Checked on ESP32C3 and works fine.

    Just a suggestion : Could it be an idea to include a DIFF option?
    I would like to see the difference with the last added value in the chart (eg for energy consumption)

    Thinking loud : It could work a bit like this.

    mydiffvar = chart_getVar 0 -1
    would mean : mydiffvar is always the previous value of chart var 0
    this would allow to add that to the chart, publish it to mqtt or whatever.

    mydiffvar = chart_getVar 0 -2 would be 2 hops back in time

    So suppose the chart series is this :

    t | 500
    t-1 | 450
    t-2 | 300

    then


    | Var0 | chart_getVar 0 -1 | chart_getVar 0 -2
    t | 500 | 50 | 200
    t-1 | 450 | 150 | null
    t-2 | 300 | null | null

Topic summary

The discussion revolves around the implementation and troubleshooting of the OpenBeken Charts Driver, which allows users to visualize various data points such as temperature, humidity, voltage, and power on devices without relying on Home Assistant. Users share configurations, scripts, and solutions to issues encountered during setup, including memory management, command execution errors, and chart refresh problems. Key points include the necessity of proper command sequencing, handling of NULL checks, and the importance of enabling specific configurations in the firmware. Feedback on performance and suggestions for improvements, such as avoiding chart flickering during updates, are also discussed.
Summary generated by the language model.
ADVERTISEMENT