I’ve built this kit: https://sensor.community/en/sensors/airrohr/ and I configured all sensors in ESPHome :-). I do manage to post JSON data to their API and the madavi API. I’m now struggling to post JSON to opensensebox.
The problem I’m facing is that this API expects dynamic keys related to my sensor, I don’t want to hardcode these keys. Instead, I want to use them from the secrets (the reason is that these keys are only for my device + I want to share the config with others).
So I was trying injecting secrets like this:
json: |-
root[!secret opensensebox_sensorid_pm10] = id(${devicename}_pm10).state;
root[!secret opensensebox_sensorid_pm25] = id(${devicename}_pm25).state;
When trying to install this fails:
error: 'secret' was not declared in this scope
root[!secret opensensebox_sensorid_pm10] = id(${devicename}_pm10).state;
^
The resulting JSON should be simple for exampel:
{
"sensor175643576": 5,
"sensor254543554": 3
}
So maybe there is another way I could get this done, eg. a string template?