logo elektroda
logo elektroda
X
logo elektroda

OpenBeken + Home Assistant MQTT - how to change the interval of charts under 6 seconds?

kuncy7 30 3
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21638371
    kuncy7
    Level 9  
    This was the question I asked AI:
    Quote:
    .
    I have a socket with openbeken firmware uploaded and connected to Home Asaistant via mqtt.
    On the generated graphs, the minimum time interval is 6 seconds.
    It is possible to change this, where is it set?
    .
    ChatGPT gave this answer:
    Quote:
    .

    setFlag 2 1
    mqtt_broadcastInterval 2
    mqtt_broadcastItemsPerSec 50
    .

    Gemini, on the other hand, is quite lost.

    What @ElektrodaBot will answer:
    I have a socket with OpenBeken firmware uploaded and connected to Home Assistant via MQTT.
    On the generated graphs, the minimum time interval is 6 seconds.
    Can this be changed, where is this set?
  • ADVERTISEMENT
  • #2 21638380
    p.kaczmarek2
    Moderator Smart Home
    VCPPublishIntervals maybe?
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    The default value there is:
    
    int changeDoNotSendMinFrames = 5;
    
    .
    So it would be correct that you are watching 6 seconds....
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21638385
    ElektrodaBot
    AI OpenAI ChatGPT4
    kuncy7 wrote:
    This is the question I asked AI:

    ChaGpt gave this op-ed:


    Gemini, on the other hand, is quite lost.

    What will @ElektrodaBot answer :
    I have a socket with openbeken firmware preloaded and connected to Home Asaistant via...
    Fast answer .
    The minimum time step you see in the Home Assistant graphs is due to the fact that a socket from OpenBeken publishes MQTT packets every 6 s .
    To change this, you must set a longer (or shorter) publication interval in the firmware itself:

    1. go to the IP address of the socket in your browser.
    2. Open the Console tab.
    3. type one of the following commands (depending on the OpenBeken version):
    - `SensorInterval 15` - sensor readings every 15 s.
    - `PowerMonitorInterval 15` - same, but only for power measurement systems
    - `mqtt_broadcastInterval 15` + previously `Flag 2 1` - constant dispatch of all channels every 15 s
    - (≥ v1.15.592) `VCPPublishIntervals 15` - common for voltage, current, power

    4 Restart the socket or type `restart 1`.

    After restart, the MQTT broker and Home Assistant will get data in a new rhythm, so the smallest interval between points on the graph will change from 6 s to the selected value.

    ---

    Further explanation .

    1. Where exactly does 6 s come from?
    OpenBeken has a built-in counter that:
    - every `SensorInterval` seconds queries the chips (BL0937/BL0942, CSE7766, etc.),
    - collates the results and immediately publishes them on the `tele/<dev>/SENSOR` and possibly `stat/<dev>/POWER` topics.

    Default values depend on the template, but for many common sockets it is written 6 s - hence the identical step in the graph in HA.

    2. Available parameters and version differences .

    3. global reading interval of all sensors
    Command From version What does
    SensorInterval X` always
    `PowerMonitorInterval X` ≥ 1.15.200 only for power meter, rest not affected
    `Flag 2 1` + `mqtt_broadcastInterval X` ≥ 1.15.260 must. shipping all channels every X s, even unchanged
    `VCPPublishIntervals X` ≥ 1.15.592 common voltage-current-power interval ("V, C, P")
    .

    Setting more than one command works by priority:
    `mqtt_broadcastInterval` > `VCPPublishIntervals` > `PowerMonitorInterval` > `SensorInterval`.

    3. Setting in practice .

    1 In the console, type for example.
    `SensorInterval 30` ➜ read and publish every 30 s.
    2. you want clear but not too frequent power sampling?
    `PowerMonitorInterval 10`.
    Web traffic grows 3× slower than with 3-second samples and the graph is still smooth.
    3. if you need a rigid periodic publication (e.g. for InfluxDB integration):
    Code: Text
    Log in, to see the code
    .
    Then every 20 s a set of data flies, regardless of changes.

    4. Effect check (diagnostics) .

    - Install MQTT Explorer → connect to broker → observe `tele/<dev>/SENSOR` topic.
    - Count down the seconds between packets - must match the new value.

    If you can see the correct interval in MQTT Explorer and the graph in HA is still 6s:
    1. make sure your sensor is added by MQTT Discovery and not manually with the `scan_interval` parameter - HA responds immediately after receiving the message anyway.
    2. remember that HA records only changes in value ; if between two publications the counter reports an identical power, a single point will appear in the database, which may look like a 'hole' in the timeline.

    5. Recommendations and limits .

    - Do not go below 2-3 s with ESP8266 - possible Wi-Fi clipping and MQTT buffer overflow.
    - Above 60 s the energy measurements are still reliable and the HA database grows more slowly - good for multiple sockets on the network.
    - A reasonable average for home monitoring is 10-30 s.

    ---

    What's next? .

    1 Provide the socket model and OpenBeken version in the thread if the described commands do not work - there are rare fork-builds with different syntax.
    2. consider adding publication thresholds to send data only when something really changes :
    `VCPPublishThreshold 2 0.5 2` (ΔV 2 V, ΔI 0.5 A, ΔP 2 W).
    3. if you plan to log a large archive, look at integrating `InfluxDB` or `MariaDB` - they are more efficient than the default SQLite.

    Good luck! Should there be any questions or non-standard device behaviour, upload the console log and some frames from MQTT Explorer - we'll advise more precisely.
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #4 21638391
    kuncy7
    Level 9  
    Hmm, it's that Gemini (specifically AI Studio) not so 'lost', as he wrote:
    Quote:
    .
    The VCPPublishThreshold command is used for this.
    Suggested solution:
    Please try using the VCPPublishThreshold command in the device console to set thresholds beyond which data will be sent.
    Command syntax: VCPPublishThreshold [threshold_change_V] [threshold_change_W] [threshold_change_A].
    [threshold_change_V] - by how many volts the voltage must change.
    [threshold_change_W] - by how many watts the power must change.
    [threshold_change_A] - by how many amps the current must change.
    Practical example:
    If you want data to be sent only if the voltage changes by at least 2V, the power by 5W and the amperage by 0.1A, type in the console:
    code
    Code
    VCPPublishThreshold 2 5 0.1

    After executing this command, the device will ignore smaller fluctuations, significantly reducing the number of MQTT messages sent and 'thinning' the data in the graphs in Home Assistant. You can adjust these values to suit your needs by observing how often the data updates.


    Generally I have a pump connected to this socket and wanted to observe more closely how it was running, and it sometimes runs for less than 6 seconds.

    Added after 8 [minutes]:

    Then confirmed, in my case "VCPPublishThreshold" will be the best.
    Because either nothing (or almost nothing) changes, or it changes very quickly, from 2 W to 1100 W.
ADVERTISEMENT