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

[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

[CAP] Download MTA deployment logs after deployment

With this simple command, you can download the MTA deployment logs of your recent deployment. Instead of manually having to use cf dmol -i <operation id>, just save the command (replace appId with your Id) as a shell script, make it executable (chmod +x) and run the script after your deployment. It stores the recent logs into the folder logs.

dmol is short for download-mta-op-logs

cf download-mta-op-logs --mta <appId> --last 1 -d logs  

To just have a quick look at the recent logs, use

cf logs <appId>-srv --recent