But all this didn’t help me to complete the task. Got the solution which finally worked for me from this SAP Sample Susaas (two snippets: here and here).
server.js
const cds = require("@sap/cds")
cds.on('served', async () => {
const { 'cds.xt.SaasProvisioningService': provisioning } = cds.services
// Add provisioning logic only if multitenancy is there..
if (provisioning) {
let tenantProvisioning = require('./provisioning')
provisioning.prepend(tenantProvisioning)
} else {
console.log(">>> There is no service, therefore does not serve multitenancy!")
}
})
module.exports = cds.server
Prerequisite, you have registered an SAP SuccessFactors system in your Global Account (see here). Creating the sap-successfactors-extensibility service can be done via command line:
#Created the service instance
#An HTTP destination on a subaccount level with the same name as the service instance name is automatically generated
cf create-service sap-successfactors-extensibility api-access myInstanceName -c '{"systemName": "SFCPART000000","technicalUser": "sfadmin"}'
#Bind the instance to an application
cf bind-service myApp-srv myInstanceName
a separate OAuth2 client application on SFSF side (can find in SF in Manage OAuth2 Client Applications)
a separate destination definition on a BTP sub-account level
The technicalUser parameter can be specified only during creation. There is no possibility to provide it afterwards using cf update-service. It may be possible to manually update the technicalUser in the destination, which got automatically created. But I did not test this yet.
Of course, the same service creation can also be done via mta.yaml.
resources:
#####################################################################################################################
# SuccessFactors Extensibility Service
#####################################################################################################################
- name: myInstanceName
type: org.cloudfoundry.managed-service
#type: org.cloudfoundry.existing-service
parameters:
service: sap-successfactors-extensibility
service-plan: api-access
config:
systemName: SFCPART000000 # <-- Provide your system name
technicalUser: sfadmin
For initial deployment, you need the line type: org.cloudfoundry.managed-service. For all further deployments, you have to comment that line out and comment in the next line type: org.cloudfoundry.existing-service. Else you will receive an error. Read more about that behavior here:https://github.com/SAP-samples/successfactors-extension-calculate-employee-seniority/issues/2
Vor kurzem haben wir uns eine Klimaanlage zugelegt. Diese nutzen wir zum Heizen und Kühlen unseres Büros. Dabei handelt es sich um dieses Gerät der Marke Midea (in DE vor allem als Comfee vermarktet).
Der schlimmste Teil der Installation war wie so häufig nicht die Montage, sondern die Einrichtung des Innengerätes über die App. Um das Gerät in das lokale Wifi zu bringen, muss man sich mit einem Access Point des Gerätes verbinden und dann in der App eine Einrichtung durchlaufen. Nach mehreren gescheiterten versuchen mit einem Android Telefon, habe ich dann zu einem iPhone gegriffen. Hiermit klappte die Einrichtung erheblich besser! Obwohl das Gerät dann im lokalen Netz erreichbar ist, erfolgt die Steuerung dann über eine Cloud… mit entsprechend langsamen Reaktionszeiten. Meiner Meinung nach quasi unbenutzbar.
Um das Gerät ohne großes manuelles Zutun, betrieben zu können (also ohne App oder Fernbindung), habe ich daher nach einer entsprechenden Home Assistant Integration gesucht.
So ganz habe ich dabei nicht verstanden, ob die Integration nun lokal oder via der Cloud steuert. Zumindest musste man beim Einrichtung seine Cloud Zugangsdaten angeben und darüber wird dann das lokale Gerät ermittelt. Beim Testen fiel mir auf, dass sobald man diese Integration nutzte, das Gerät nicht mehr über die App steuerbar war (und umgekehrt). Der Grund ist, dass man den gleichen Zugang nicht auf zwei verschiedenen Geräten nutzen kann. Nach einer Einrichtung eines zweiten Accounts trat das Problem nicht mehr auf und man konnte beides parallel nutzen.
Jedoch so richtig zuverlässig funktionierte, das Ein- oder Ausschalten des Gerätes bei mir nicht. Ggf. weil die Befehle auch über die Cloud liefen und nicht lokal!?
Auch die Entities der Integration schienen für die Klimaanlage nicht vollständig zu sein. Insgesamt schien die Integration eher für anderen Midea Gerätetypen geeignet zu sein, als Klimaanlagen.
Die Integration bietet die Möglichkeit, selber die entsprechen Sensoren und Controls zu aktivieren. Man muss also durch Trial-and-Error herausfinden, welche von dem eigenen Gerät unterstützt bzw. publiziert werden
oder in den Developer Tools nach der zugehörigen Climate Entity suchen und sich die Werte anschauen.
Nach etwas herumprobieren, bin ich bei dieser Auswahl geblieben.
Leider funktioniert die Realtime Power nicht, aber immerhin der Gesamtverbrauch. Ich habe daher noch eine Zigbee Steckdose mit Strommessung davor geschaltet, um den Verbrauch in Echtzeit zu überwachen. Außerdem konnte ich die Indoor und OutdoorTemperature Werte noch nicht wirklich nachvollziehen. Sie verändern sich m.M.n. recht merkwürdig. In der vorherigen Integration wurden hier irgendwie genauere Werte angezeigt. Jemand hat dazu auch bereits ein Issue aufgemacht.
Eine entsprechende Thermostat Card wird auch direkt auf dem Dashboard erzeugt.
Der wirklich interessante Teil ist dann natürlich erst durch Automationen zu verwirklichen. Ich lasse die Klimaanlage z.B. automatisiert bei entsprechenden Uhrzeiten und Temperaturen einschalten. Oder auch, wenn z.B. grade ausreichend Strom von dem Balkonkraftwerk erzeugt wird. Und natürlich wird sie automatisch ausgeschaltet, wenn alle das Haus verlassen.
Insgesamt funktioniert die Integration nun seit einigen Wochen sehr zuverlässig.
When I was at a friend’s house the other day and a YouTube playlist was playing on the TV, I was really shocked. After every video, there were one or two ads (and some of them even in between). I was not aware how extremely many ads you get when using YouTube without an ad blocker. Therefore, a small collection of apps, add-ons and links that help to make YouTube a bit more enjoyable:
Browser
uBlock Origin: Add-on which blocks ads, trackers and malware sites
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.
# 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.
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'.
When using a blob or base64 data to open a file in PDF.js, the viewer is not able to get the correct filename. So when downloading the pdf using the download button inside the viewer, it will always download as document.pdf. To manually set a filename, you can use the setTitleUsingUrl function.
*&---------------------------------------------------------------------*
*& Report ZIP_TRANSPORT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zip_transport.
SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE TEXT-t01.
PARAMETERS p_trkorr LIKE e070-trkorr OBLIGATORY.
PARAMETERS p_ttext TYPE as4text.
SELECTION-SCREEN END OF BLOCK bl01.
SELECTION-SCREEN BEGIN OF BLOCK bl02 WITH FRAME TITLE TEXT-t02.
PARAMETERS p_sapdir TYPE string LOWER CASE OBLIGATORY DEFAULT '/usr/sap/trans/'.
PARAMETERS p_lcldir TYPE string LOWER CASE OBLIGATORY DEFAULT 'C:\temp\'.
SELECTION-SCREEN END OF BLOCK bl02.
START-OF-SELECTION.
" Check if Transport is released
DATA ls_request TYPE trwbo_request.
CALL FUNCTION 'TR_READ_REQUEST'
EXPORTING
iv_read_e070 = abap_true
iv_read_e07t = abap_true
iv_trkorr = p_trkorr
CHANGING
cs_request = ls_request
EXCEPTIONS
error_occured = 1
no_authorization = 2
OTHERS = 3.
IF ls_request-h-trstatus <> 'R'.
MESSAGE 'Transport not yet released' TYPE 'E'.
ENDIF.
" Read released Transport
DATA lv_xcontent_k TYPE xstring.
DATA lv_xcontent_r TYPE xstring.
DATA(lv_transdir_k) = |{ p_sapdir }cofiles/K{ p_trkorr+4 }.{ p_trkorr(3) }|.
DATA(lv_transdir_r) = |{ p_sapdir }data/R{ p_trkorr+4 }.{ p_trkorr(3) }|.
TRY.
" K
OPEN DATASET lv_transdir_k FOR INPUT IN BINARY MODE.
READ DATASET lv_transdir_k INTO lv_xcontent_k.
CLOSE DATASET lv_transdir_k.
" R
OPEN DATASET lv_transdir_r FOR INPUT IN BINARY MODE.
READ DATASET lv_transdir_r INTO lv_xcontent_r.
CLOSE DATASET lv_transdir_r.
" Add to ZIP
DATA(lo_zipper) = NEW cl_abap_zip( ).
lo_zipper->add( name = |K{ p_trkorr+4 }.{ p_trkorr(3) }|
content = lv_xcontent_k ).
lo_zipper->add( name = |R{ p_trkorr+4 }.{ p_trkorr(3) }|
content = lv_xcontent_r ).
" Download ZIP
DATA(lv_xzip) = lo_zipper->save( ).
" Convert to raw data
DATA(lt_data) = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_xzip ).
" Set zip filename
DATA(lv_zip_name) = COND #( WHEN p_ttext IS INITIAL THEN |{ ls_request-h-as4text }_{ p_trkorr }|
ELSE |{ p_ttext }_{ p_trkorr }| ).
" Replace every character that is not [a-zA-Z0-9_] with '_'.
REPLACE ALL OCCURRENCES OF REGEX '[^\w]+' IN lv_zip_name WITH '_'.
cl_gui_frontend_services=>gui_download( EXPORTING filename = p_lcldir && lv_zip_name && '.zip'
filetype = 'BIN'
CHANGING data_tab = lt_data ).
CATCH cx_root INTO DATA(e_text).
MESSAGE e_text->get_text( ) TYPE 'E'.
ENDTRY.
MESSAGE |{ lv_zip_name }.zip created and downloaded to { p_lcldir }| TYPE 'S'.