Sziasztok!
ESPHome-ban szeretném megcsinálni, hogy egy intervalban lévő http_request ismétlődési idejét
perc alapon tudjam változtatni. lambda nem tetszik neki. Mi a baj?
- interval: 1min
then:
- lambda: |-
id(counter)++;
if (id(counter) == id(limit).state) {
id(counter) = 0;
}
- if:
condition:
lambda: |-
return id(counter) == 0;
then:
- http_request.get:
url: !lambda |-
char buf[200];
sprintf(buf, "https://xxxxx%.3f&value2=%.3f", id(g1), id(g2));
return ((std::string) buf).c_str();
headers:
Content-Type: application/json
verify_ssl: true
on_response:
then:
- logger.log:
format: 'Response status: %d'
args:
- status_code
- logger.log:
format: "The content is %s"
args: [ 'id(http_request_id).get_string()' ]
ezt írja az ESPHome:
INFO Reading configuration hom.yaml...
ERROR Error while reading config: Invalid YAML syntax:
mapping values are not allowed here
in "hw-dsrele.yaml", line 141, column 19:
lambda: |-
^
141-142 sor:
lambda: |-
return id(counter) == 0;
- 130 megtekintés