Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[Home Assistant] Sonoff Dongle Plus MG24 crash during VM backup on Proxmox host

Recently I migrated my Zigbee network to a new controller. From my old Sonoff ZBDongle-P (Z-Stack) to a Sonoff Dongle Plus MG24 (Ember) I got for about 13€ from AliExpress. I was following this guide and everything went well. But a few days later, suddenly in the night, the new dongle crashed. These were the related Z2M logs:

[2026-11-21 02:20:13] error: 	zh:ember:ezsp: ERROR Transaction failure; status=ASH_ERROR_TIMEOUTS. Last Frame: [FRAME: ID=52:"SEND_UNICAST" Seq=53 Len=7].
[2026-11-21 02:20:13] error: 	zh:ember:ezsp: ERROR Transaction failure; status=NOT_CONNECTED. Last Frame: [FRAME: ID=52:"SEND_UNICAST" Seq=53 Len=7].
[2026-11-21 02:20:13] error: 	zh:ember:ezsp: ERROR Transaction failure; status=NOT_CONNECTED. Last Frame: [FRAME: ID=52:"SEND_UNICAST" Seq=53 Len=7].
[2026-11-21 02:20:13] error: 	z2m: Adapter disconnected, stopping
WATCHDOG: Waiting 0.03333333333333333min before next start try.
Starting Zigbee2MQTT with watchdog (2000,60000,300000,900000,1800000,3600000).
[2026-11-21 02:20:41] error: 	z2m: Error while starting zigbee-herdsman
[2026-11-21 02:20:41] error: 	z2m: Failed to start zigbee-herdsman
[2026-11-21 02:20:41] error: 	z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start_crashes-runtime.html for possible solutions
[2026-11-21 02:20:41] error: 	z2m: Exiting...
[2026-11-21 02:20:41] error: 	z2m: Error: Failed to start EZSP layer with status=HOST_FATAL_ERROR.
    at EmberAdapter.initEzsp (/app/node_modules/.pnpm/zigbee-herdsman@11.2.0_supports-color@7.2.0/node_modules/zigbee-herdsman/src/adapter/ember/adapter/emberAdapter.ts:677:19)
    at async EmberAdapter.start (/app/node_modules/.pnpm/zigbee-herdsman@11.2.0_supports-color@7.2.0/node_modules/zigbee-herdsman/src/adapter/ember/adapter/emberAdapter.ts:1558:24)
    at async Controller.start (/app/node_modules/.pnpm/zigbee-herdsman@11.2.0_supports-color@7.2.0/node_modules/zigbee-herdsman/src/controller/controller.ts:146:29)
    at async Zigbee.start (/app/lib/zigbee.ts:70:27)
    at async Controller.start (/app/lib/controller.ts:117:29)
    at async start (/app/index.js:156:5)
    at async triggerWatchdog (/app/index.js:36:9)
    at async Controller.exit [as exitCallback] (/app/index.js:52:13)
    at async Controller.exit (/app/lib/controller.ts:379:16)
    at async Controller.stop (/app/lib/controller.ts:374:16)
WATCHDOG: Waiting 1min before next start try.

Turned out, the reason was a backup job on my Proxmox host on which my Home Assistant VM is running.

journalctl 
--since "2026-11-21 02:15:00" 
--until "2026-11-21 02:25:00" 
--no-pager 
| grep -Ei 'vzdump|backup|snapshot|freeze|thaw|qemu|usb|reset'

Nov 21 02:15:01 pve2 CRON: (root) CMD (which zfs-auto-snapshot > /dev/null || exit 0 ; zfs-auto-snapshot --quiet --syslog --label=frequent --keep=4 //)
Nov 21 02:16:33 pve2 pvescheduler: INFO: Finished Backup of VM 195 (00:04:28)
Nov 21 02:16:33 pve2 pvescheduler: INFO: Starting Backup of VM 196 (lxc)
Nov 21 02:18:40 pve2 pvescheduler: INFO: Finished Backup of VM 196 (00:02:07)
Nov 21 02:18:40 pve2 pvescheduler: INFO: Starting Backup of VM 204 (qemu)

VM 204 backup started at 02:18:40, which is my HA VM. A few minutes later, the MG24 dongle crashed. By doing another manual backup, I could reproduce the controller crash.
My backup job was using the following settings:

--mode snapshot
--storage TrueNAS
--compress zstd
--fleecing 0

AI suggested different solutions, one of it was to enable fleecing in the job configuration. This reduces guest-write delays caused by copying old blocks directly to the remote backup target. To be honest, I had never heard of this setting before, but after enabling it and running another backup, the MG24 dongle stopped crashing. I have no idea why my previous Dongle-P didn’t have this problem, but since it was a simple solution, I’ll just take it.

[ABAP] Z_CLEANUP_LRQ_WORKFLOWS

A cleanup report I’ve written some years ago, to end incomplete leave request workflows. I couldn’t figure out why some workflows hadn’t been completed over the years. Since the absences were from a long time ago, the goal was simply to clean up the system. Maybe someone else will need to do something similar someday.

*&---------------------------------------------------------------------*
*& Report Z_CLEANUP_LRQ_WORKFLOWS
*&---------------------------------------------------------------------*
*& This report was written to end old absence request workflows,
*& where the absence request got already approved,
*& but somehow the WF got not set to status 'COMPELTED'.
*& https://me.sap.com/notes/0002650820
*&---------------------------------------------------------------------*
REPORT z_cleanup_lrq_workflows.

TABLES: ptreq_header, swwwihead, pa0002.

TYPES:
  BEGIN OF ty_log,
    icon          TYPE icon-id,
    objid         TYPE objektid,
    vorna         TYPE vorna,
    nachn         TYPE nachn,
    request_id    TYPE ptreq_header-request_id,
    version_no    TYPE tim_req_version,
    request_type  TYPE tim_req_type,
    status        TYPE tim_req_status,
    mod_timestamp TYPE timestamp,
    timestamp     TYPE string,
    workitem_id	  TYPE sww_wiid,
    wi_stat       TYPE sww_wistat,
    wi_stat_new   TYPE sww_wistat,
    comment       TYPE string,
  END OF ty_log.

DATA gt_log     TYPE TABLE OF ty_log WITH DEFAULT KEY.
DATA return     TYPE TABLE OF swl_return.
DATA new_status TYPE sww_wistat.
DATA status     TYPE ptarq_uia_request-status.

INITIALIZATION.

  SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-b01.

    SELECT-OPTIONS: s_pernr FOR pa0002-pernr              MATCHCODE OBJECT prem,
                    s_guid  FOR ptreq_header-request_id,
                    s_rtype FOR ptreq_header-request_type DEFAULT 'ABSREQ',
                    s_statu FOR status                    DEFAULT 'POSTED',
                    wi_stat FOR swwwihead-wi_stat         DEFAULT 'STARTED'.

    PARAMETERS: fdate  TYPE datum DEFAULT '20180101',
                ftime  TYPE tims,
                tdate  TYPE datum DEFAULT '20231231',
                ttime  TYPE tims,
                p_test AS CHECKBOX DEFAULT abap_true.

  SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

  CONVERT DATE fdate TIME ftime INTO TIME STAMP DATA(ts_from) TIME ZONE 'UTC'.
  CONVERT DATE tdate TIME ttime INTO TIME STAMP DATA(ts_upto) TIME ZONE 'UTC'.

  SELECT a~request_id, a~version_no, a~status, a~request_type, a~mod_timestamp, a~workitem_id, b~objid, c~wi_stat, d~vorna, d~nachn
    FROM ptreq_header    AS a
        JOIN ptreq_actor AS b ON a~initiator_ins = b~actor_id
        JOIN swwwihead   AS c ON a~workitem_id   = c~wi_id
        JOIN pa0002      AS d ON b~objid         = d~pernr
    INTO CORRESPONDING FIELDS OF TABLE @gt_log
    WHERE a~request_id    IN @s_guid
      AND a~status        IN @s_statu
      AND a~request_type  IN @s_rtype
      AND a~mod_timestamp BETWEEN @ts_from AND @ts_upto
      AND b~objid         IN @s_pernr
      AND c~wi_stat       IN @wi_stat.

END-OF-SELECTION.

  LOOP AT gt_log ASSIGNING FIELD-SYMBOL(<log>).

    <log>-timestamp = |{ <log>-mod_timestamp TIMESTAMP = ENVIRONMENT }|.

    IF p_test = abap_true.
      <log>-comment = |Testrun! No workflow changed!|.
      CONTINUE.
    ENDIF.

    IF <log>-wi_stat <> |STARTED|. CONTINUE. ENDIF.

    CALL FUNCTION 'SWL_ADM_WI_COMPLETE'
      EXPORTING
        wi_id                         = <log>-workitem_id
      TABLES
        return                        = return
      EXCEPTIONS
        workitem_not_found            = 1
        no_authority                  = 2
        wrong_workitem_type           = 3
        workflow_definition_not_found = 4
        internal_error                = 5
        action_canceled               = 6
        OTHERS                        = 7.
    IF sy-subrc <> 0.
      <log>-icon    = icon_red_light.
      <log>-comment = COND #( WHEN lines( return ) > 0 THEN return[ 1 ]-text
                                                       ELSE SWITCH #( sy-subrc WHEN 1 THEN |workitem_not_found|
                                                                               WHEN 2 THEN |no_authority|
                                                                               WHEN 3 THEN |wrong_workitem_type|
                                                                               WHEN 4 THEN |workflow_definition_not_found|
                                                                               WHEN 5 THEN |internal_error|
                                                                               WHEN 6 THEN |action_canceled|
                                                                               WHEN 7 THEN |OTHERS| ) ).
    ELSE.
      " Check if WF status really got changed
      SELECT SINGLE wi_stat FROM swwwihead INTO <log>-wi_stat_new WHERE wi_id = <log>-workitem_id.
      <log>-icon    = COND #( WHEN <log>-wi_stat_new <> |COMPLETED| THEN icon_red_light ELSE icon_green_light ).
      <log>-comment = COND #( WHEN <log>-wi_stat_new <> |COMPLETED| THEN |Something went wrong!| ).
    ENDIF.

  ENDLOOP.


  IF gt_log IS INITIAL.
    MESSAGE i002(wusl) DISPLAY LIKE 'E'.
  ELSE.
    TRY.
        cl_salv_table=>factory( IMPORTING r_salv_table = DATA(alv_table)
                                CHANGING  t_table      = gt_log ).

        alv_table->get_columns( )->get_column( 'ICON'          )->set_long_text( 'Icon' ).
        alv_table->get_columns( )->get_column( 'WI_STAT_NEW'   )->set_long_text( 'Neuer WF Status' ).
        alv_table->get_columns( )->get_column( 'WI_STAT_NEW'   )->set_medium_text( 'Neuer Status' ).
        alv_table->get_columns( )->get_column( 'COMMENT'       )->set_long_text( 'Kommentar' ).
        alv_table->get_columns( )->get_column( 'TIMESTAMP'     )->set_long_text( 'Letzte Änderung' ).
        alv_table->get_columns( )->get_column( 'COMMENT'       )->set_output_length( 100 ).
        alv_table->get_columns( )->get_column( 'TIMESTAMP'     )->set_output_length( 20 ).
        alv_table->get_columns( )->get_column( 'MOD_TIMESTAMP' )->set_visible( abap_false ).

        alv_table->display( ).

      CATCH cx_root.
    ENDTRY.
  ENDIF.

[ABAP] Display CL_BAL_LOGOBJ output as ALV in a splitcontainer

When developing a report that should also write logs (SLG1), I normaly use the class CL_BAL_LOGOBJ as described here. When using method lo_log->display( ) it displays the result in a popup. If you want to display the log as ALV some more logic is neede.

DATA ls_display_profile TYPE bal_s_prof.

TRY.
    DATA(lo_log) = NEW cl_bal_logobj(
      i_log_object        = 'Z_MY_LOG'
      i_default_subobject = 'GENERAL' ).

    lo_log->add_statustext( i_statustext = 'Processing started' ).

    lo_log->add_errortext( i_errortext = 'An error occurred during processing' ).

    CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
      IMPORTING
        e_s_display_profile = ls_display_profile.

    ls_display_profile-use_grid = abap_true.

    lo_log->display( i_disp_profile = ls_display_profile ).

  CATCH cx_bal_exception INTO DATA(lx_bal).
    MESSAGE lx_bal->get_text( ) TYPE 'I'.
ENDTRY.

In my case, I wanted to display the log next to the actual output of a report, so that I have my data result on the left side, and the application log on right side.

*--------------------------------------------------------------------*
* Create Split Container
*--------------------------------------------------------------------*

    " Create a splitter on default_screen
    DATA(o_splitter_main) = NEW cl_gui_splitter_container( parent                  = cl_gui_container=>default_screen
                                                           no_autodef_progid_dynnr = abap_true
                                                           rows                    = 1
                                                           columns                 = 2 ).

    " Width of left splitter in %
    o_splitter_main->set_column_width( id = 1 width = 75 ).

    " Get the ref from the left and right split containers
    DATA(o_container_1) = o_splitter_main->get_container( row = 1 column = 1 ).
    DATA(o_container_2) = o_splitter_main->get_container( row = 1 column = 2 ).

*--------------------------------------------------------------------*
* 1 ALV Output
*--------------------------------------------------------------------*

    TRY.
        cl_salv_table=>factory( EXPORTING r_container  = o_container_1
                                IMPORTING r_salv_table = DATA(o_salv)
                                CHANGING  t_table      = lt_sflight).
        o_salv->display( ).

      CATCH cx_salv_msg.
      CATCH cx_salv_not_found.
    ENDTRY.

*--------------------------------------------------------------------*
* 2 BAL Log
*--------------------------------------------------------------------*

    DATA ls_display_profile TYPE bal_s_prof.
    DATA lv_control_handle  TYPE balcnthndl.

    DATA(lt_log_handles) = VALUE bal_t_logh( ( mo_log->if_bal_logger~mv_loghandle ) ).

    CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
      IMPORTING
        e_s_display_profile = ls_display_profile.

    ls_display_profile-use_grid = abap_true.

    " Increase the width of the message text column
    LOOP AT ls_display_profile-mess_fcat ASSIGNING FIELD-SYMBOL(<ls_fcat>)
         WHERE ref_table = 'BAL_S_SHOW'
           AND ref_field = 'T_MSG'.
      <ls_fcat>-outputlen = 200.
    ENDLOOP.

    CALL FUNCTION 'BAL_CNTL_CREATE'
      EXPORTING
        i_container          = o_container_2
        i_s_display_profile  = ls_display_profile
        i_t_log_handle       = lt_log_handles
      IMPORTING
        e_control_handle     = lv_control_handle
      EXCEPTIONS
        profile_inconsistent = 1
        internal_error       = 2
        OTHERS               = 3.

  ENDMETHOD.

*--------------------------------------------------------------------*
*  Force output
*--------------------------------------------------------------------*
    WRITE: space.

I really like the result