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

[Home Assistant] Send notification only when you are home or when you come home

If you have a notification, which is only relevant for you when you are at home, it does not make sense to send it, if you are away. Instead, it would make sense to receive it the moment you get home.

To do this, simply add an Wait for a template action before sending the notification, with the following content. This can be done via YAML configuration

  - wait_template: "{{ is_state('person.nico', 'home') }}"
    continue_on_timeout: true

or via the web interface

If you are currently at home, means the entity status is already in the state home, it will be resolved immediately, otherwise it will wait until your status changes to home.

[CAP] Multitenant Job Scheduler – Fixing Scope issue

When I was integrating the Job Scheduler service into my Multitenant Application, I ran into the following JWT Token issue, when the Job Scheduler was calling my CAP action. Means the job creation was already working fine and was also displaying the right tenant for my job, but the Job Scheduler was not able to successfully call the given endpoint. This is the error I got in the logs:

Error: Jwt token with audience: [
] is not issued for these clientIds: [

After reading some of the great blogs from Carlos Roggan, I noticed that I forgot to grant the Job Scheduler the necessary authority to actual call my CAP action. So I added the following lines to the xs-security.json file

      "name": "$XSAPPNAME.jobscheduler",
      "description": "Scope for Job Scheduler",
      "grant-as-authority-to-apps": [

and also annotated my CAP action using the new scope @(requires: ['jobscheduler']).

I redeployed everything, but the issue still persists. 🙁

Turned out, for the standard plan, tokens are cached in Job Scheduler up to 12 hours.


After waiting 12 hours, the endpoint was successfully called by the Job Scheduler. 🙂

[CAP] Timeout on long-running endpoint

In my application, I have a function that can take quite a long time to process, depending on the data selected. Two external systems were involved in the processing, so a lot of round trips were made. Of course, I tried to parallelize the calls to the external systems as much as possible, but it still took a long time. During the development in BAS everything worked fine, but during the deployment in BTP I encountered some errors, depending on the amount of data selected.

In the console I could see, that it was a 504 Gateway Timeout.

Luckily, the CAP docs are already explaining the possible reason for this. The approuter has a default timeout of 30 seconds for destinations. This matched my observation, that this issue only occurred when deployed.



In my case, the destination for my backend service is configured in the mta.yaml directly on the approuter. By simply adding the timeout property and by increasing the timeout from 30 seconds to 2 minutes, I could get rid of the errors.

  - name: my-approuter
    type: approuter.nodejs
    path: app/approute
      builder: npm-ci
        - "node_modules/"
        - "default-env.json"
        - "manifest*.yml"
      - name: srv-api
        group: destinations
          name: srv-api 
          url: ~{srv-url}
          forwardAuthToken: true
          timeout: 120000 # <--------------------------------- add timeout to your cap service destination
      - name: my-xsuaa
      - name: my-destination
      - name: my-html5-repo-runtime

[Home Assistant] Confirmation dialog

Just noticed that you can add a confirmation dialog on a tab action.



Very helpful to prevent things from being activated by mistake.

type: entity
entity: input_boolean.sleep_status
  action: toggle
    text: Activate sleep mode?
icon: mdi:sleep
icon_color: indigo