Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open_action:
- then:
- - http_request.get:
- url: http://192.168.X.XXX:8123/api/states/alarm_control_panel.alarmo
- capture_response: true
- headers:
- Content-Type: application/json
- Authentication: Bearer TOKEN
- on_response:
- - if:
- condition:
- lambda: return response->status_code == 200;
- then:
- - lambda: |-
- json::parse_json(body, [](JsonObject root) -> bool {
- if (root["state"]) {
- id(alarm_state).publish_state(root["state"]);
- return true;
- }
- else {
- ESP_LOGD(TAG,"No 'state' key in this json!");
- return false;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement