Advertisement
Guest User

Untitled

a guest
Nov 20th, 2024
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.97 KB | None | 0 0
  1.    open_action:
  2.       then:
  3.         - http_request.get:
  4.             url: http://192.168.X.XXX:8123/api/states/alarm_control_panel.alarmo
  5.             capture_response: true
  6.             headers:
  7.               Content-Type: application/json
  8.               Authentication: Bearer TOKEN
  9.             on_response:
  10.               - if:
  11.                   condition:
  12.                     lambda: return response->status_code == 200;
  13.                   then:
  14.                     - lambda: |-
  15.                         json::parse_json(body, [](JsonObject root) -> bool {
  16.                             if (root["state"]) {
  17.                                 id(alarm_state).publish_state(root["state"]);
  18.                                 return true;
  19.                             }
  20.                             else {
  21.                               ESP_LOGD(TAG,"No 'state' key in this json!");
  22.                               return false;
  23.                             }
  24.                         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement