nocin.eu

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

[Home Assistant] Conbee II Firmware Update

The firmware update is done in just a few minutes. Connect the Conbee II to your PC, install the deCONZ software, download the latest firmware and use the command line tool to flash it.

Guide: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually#update-in-ubuntu-or-debian

deCONZ: http://deconz.dresden-elektronik.de/ubuntu/stable/

Firmware: http://deconz.dresden-elektronik.de/deconz-firmware/

[Home Assistant] Ikea Traefdri Reset Script / Pairing mode

Handy script, to put Ikea Bulbs into pairing mode by using a Zigbee Switch: https://community.home-assistant.io/t/handy-script-to-reset-ikea-tradfri-bulb/435622

Just go to Settings -> Automations -> Scripts and paste the following YAML script:

alias: Reset IKEA bulb with Switch
sequence:
  - repeat:
      count: "5"
      sequence:
        - service: switch.turn_off
          data: {}
          target:
            entity_id: "{{ smart_plug }}"
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 900
        - service: switch.turn_on
          data: {}
          target:
            entity_id: "{{ smart_plug }}"
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
variables:
  smart_plug: switch.REPLACE_SWITCH_NAME
mode: single

Now just insert your light bulb with a light socket into the plug and run the script.

To use the script with other bulbs, just adjust the counter and seconds to your needs, e.g. like here for Ledvance bulbs:

alias: Reset Ledvance Gardenpole with Switch
sequence:
  - repeat:
      count: "5"
      sequence:
        - service: switch.turn_off
          data: {}
          target:
            entity_id: "{{ smart_plug }}"
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
        - service: switch.turn_on
          data: {}
          target:
            entity_id: "{{ smart_plug }}"
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
variables:
  smart_plug: switch.REPLACE_SWITCH_NAME
mode: single

[ABAP] Display Table data as HTML

REPORT z_table_to_html.

TRY.

    SELECT * FROM sflight INTO TABLE @DATA(flights) UP TO 100 ROWS.

    cl_demo_output=>write_data( flights ).

    DATA(lv_html) = cl_demo_output=>get( ).

    cl_abap_browser=>show_html( title       = 'Flights'
                                html_string = lv_html
                                container   = cl_gui_container=>default_screen ).

    " force cl_gui_container=>default_screen
    WRITE: space.

  CATCH cx_root INTO DATA(e).
    WRITE: / e->get_text( ).
ENDTRY.

[SuccessFactors] Check if IAS is activated for a tenant

Go to Upgrade Center, select Platform in the Filter By Dropdown. In the Optional Upgrades Column, search for:

Initiate the SAP Cloud Identity Services Identity Authentication Service Integration

If the entry exists, IAS is not yet set up. If it does not exist, the IAS configuration is probably already done.

[ABAP] Get URL for BSP Page

    cl_http_ext_webapp=>create_url_for_bsp_application( EXPORTING bsp_application      = bsp_application            " Name der BSP Applikation
                                                                  bsp_start_page       = bsp_start_page             " Startseite der BSP Applikation
                                                                  bsp_start_parameters = bsp_start_parameters       " Startparameter der BSP Applikation
                                                        IMPORTING abs_url              = DATA(lv_absolute_url ).    " Absolute URL (Protokol, Host, Port, ...) der BSP Applikation

[ABAP] Display PDF in HTML Control

  DATA lt_data TYPE STANDARD TABLE OF x255.
  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = lv_xstring "pdf data
    TABLES
      binary_tab = lt_data.  

 DATA(o_html) = NEW cl_gui_html_viewer( parent = o_parent ).

* URL zu HTML holen
  DATA: lv_url TYPE swk_url.
  o_html->load_data( EXPORTING type         = 'BIN'
                               subtype      = 'PDF'
                     IMPORTING assigned_url = lv_url
                     CHANGING  data_table   = lt_data ).
* HTML anzeigen
  o_html->show_url( lv_url ).

[JavaScript] Clone an object containing a file as ArrayBuffer

Use the build in function structuredClone() to copy all kind of complex JS types.

Official documentation: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types

Comparison to other copy techniques like spread or json.stringify: https://www.builder.io/blog/structured-clone

[nodejs] Node Version Manager (NVM)

# Install script: https://github.com/nvm-sh/nvm#install--update-script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

# check current used node version
node -v

# list local available node versions
nvm list

# list all released node versions
nvm ls-remote

# install specific node version and switch to it
nvm install v20.5.1

# switch to a specific node version, which is already installed
nvm use v20.5.1

[VSC] Create/Read/Delete File in CMIS Repository via VSC Rest-API Client

API Specification: http://docs.oasis-open.org/cmis/CMIS/v1.1/os/examples/browser/

Helpful Postman Collection: https://gist.github.com/aborroy/3f1f2360b0e85067675643aa648a8112

Create:

@folderId = <myFolderID>
@fileName = <myFileName>

### Create Object
# @name object
POST http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
Authorization: Basic user:password
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="succinct"
Content-Type: text/plain; charset=utf-8

true
--boundary
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8

createDocument
--boundary
Content-Disposition: form-data; name="objectId"
Content-Type: text/plain; charset=utf-8

{{folderId}}
--boundary
Content-Disposition: form-data; name="propertyId[0]"
Content-Type: text/plain; charset=utf-8

cmis:name
--boundary
Content-Disposition: form-data; name="propertyValue[0]"
Content-Type: text/plain; charset=utf-8

{{fileName}}
--boundary
Content-Disposition: form-data; name="propertyId[1]"
Content-Type: text/plain; charset=utf-8

cmis:objectTypeId
--boundary
Content-Disposition: form-data; name="propertyValue[1]"
Content-Type: text/plain; charset=utf-8

cmis:document
--boundary
Content-Disposition: form-data; name="content"; filename=image.png
Content-Type: image/png
Content-Transfer-Encoding: binary

< image.png

--boundary--

### Fill Variable from Response
@ID = {{object.response.body.succinctProperties.cmis:objectId}}

Read:

### Get Object properties
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?cmisselector=properties
&objectId={{ID}}
Authorization: Basic user:password

### Get Object content
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?cmisselector=content
&objectId={{ID}}
Authorization: Basic user:password

### Get Object content stream
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?getContentStream
&objectId={{ID}}
Authorization: Basic user:password

Delete:

### Delete Object
POST http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
Authorization: Basic user:password
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="objectId"
Content-Type: text/plain; charset=utf-8

{{ID}}
--boundary
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8

delete
--boundary--