I would like to push my pulse_meter value by url to googledocs.
I can push a static value to gdocs after following this tutorial.
the result is a url in the shape of : "https://script.google.com/macros/s/XXXLongSecretXXX/exec?A=1&termperature=42&humidity=123
with 42 and 123 as static values it works. How can I get in esphome the value of my pulse_meter into the URL ?
My attempt (not working yet):
- platform: total_daily_energy
name: "Tagesverbrauch_e1"
power_id: energy1
filters:
- multiply: 0.010416667 # (1/96 pulses per kWh)
- platform: pulse_meter
pin: 12
name: "Pulse Meter"
internal_filter: 100ms
accuracy_decimals: 3
filters:
- multiply: 0.625
on_value:
#- http_request.post:
# url: !lambda |-
# return ((std::string) "https://esphome.io?state=" + id(my_sensor).state).c_str(); # not working due to sensor value not float
- http_request.get:
url: !lambda |-
return ((std::string) "https://script.google.com/macros/s/xxxsecretxxxx/exec?A=1&temperature=42&humidity=%f" + id(energy1).state.c_str());
# {{ states.sensor.whatever_name.state | regex_replace(find='string', replace='') | int }} << shall I use this?
# was working with url: https://script.google.com/macros/s/xxxsecretxxxx/exec?A=1&temperature=42&humidity=4711
headers:
Content-Type: application/json
verify_ssl: false
on_response:
then:
- logger.log:
format: 'Response status: %d'
args:
- status_code
Thank you for any help or advise!