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

[Home Assistant] Presence detection

There are different ways to realize a presence detection in Home Assistant:

https://www.home-assistant.io/getting-started/presence-detection/

As I have a FritzBox at home, I’m using the AVM FRITZ!Box Tools Integration, which has “presence detection by looking at connected devices”.

You can find your devices using the developer tools and looking for the device_tracker entity. I then use the devices in a group to easily check if anyone is home.

/config/groups.yaml

family:
  - device_tracker.xiaomiredminote8pro
  - device_tracker.xioamimi8

[Android] Upgrading LineageOS 17.1 to 18.1 on my Xiaomi Mi 8 (dipper)

Install the Android Debug Bridge (ADB)

https://wiki.lineageos.org/adb_fastboot_guide.html
https://github.com/M0Rf30/android-udev-rules#installation

# check if device is found
adb devices
# reboot into sideload modus
adb reboot sideload

Or manually boot into TWRP recovery, holding Volume Up + Power when the phone is off. Navigate to Advanced-> ADB Sideload.


Update MIUI Firmware

Following the docs, I first had to check the Firmware version. I was running V12.0.2.0.QEAMIXM, but V12.0.3.0.QEAMIXM is required.
Download the right MIUI Firmware for your device from https://xiaomifirmwareupdater.com/firmware/dipper/.
Flash the new Firmware via TWRP or via ADB sideload.

adb sideload Downloads/fw_dipper_miui_MI8Global_V12.0.3.0.QEAMIXM_7619340f8c_10.0.zip 

Download and flash new LineageOS image

I’m using the LineageOS fork LineageOS for microG. Download it from here: https://download.lineage.microg.org/dipper/ (MI 8 = dipper)
The upgrade steps are the same as for the official rom: https://wiki.lineageos.org/devices/dipper/upgrade. In my case only flashing the new image.

adb sideload Downloads/lineage-18.1-20220602-microG-dipper.zip 

[ABAP] ALV traffic lights

TYPES: BEGIN OF ty_log,
         status TYPE icon-id,
       END OF ty_log.

DATA gt_log TYPE TABLE OF ty_log.

gt_log = VALUE #( ( status = icon_red_light    )
                  ( status = icon_yellow_light )
                  ( status = icon_green_light  ) ).

TRY.
    cl_salv_table=>factory( IMPORTING r_salv_table = DATA(alv_table)
                            CHANGING  t_table      = gt_log ).

    alv_table->display( ).

  CATCH cx_salv_msg.
ENDTRY.

icon_red, icon_yellow etc. will be automatically loaded from the TYPE-POOL: icon during runtime.

You can check all available icons via the table icon.

SELECT SINGLE id INTO @DATA(icon_red) FROM icon WHERE name = 'ICON_RED_LIGHT'.