I love this project. I’ve adapted the code and currently I’m only pushing data to openSenseMap.org. Since I’m also pushing data from other sensors, that sometimes become unavailable, I’ve had to implement some “error-detection”. My code looks like:
post_opensensebox:
url: !secret opensensebox_api_url
method: POST
headers:
content-type: "application/json; charset=utf-8"
payload: >-
{
{% if states('sensor.sensorbox_sds0x1_pm2_5') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_pm25') }}": {{ states('sensor.sensorbox_sds0x1_pm2_5') }},
{% endif %}
{% if states('sensor.sensorbox_sds0x1_pm10') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_pm10') }}": {{ states('sensor.sensorbox_sds0x1_pm10') }},
{% endif %}
{% if states('sensor.weerstation_temperatuur') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_temp') }}": {{ states('sensor.weerstation_temperatuur') }},
{% endif %}
{% if states('sensor.weerstation_luchtdruk_absoluut') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_press') }}": {{ ((states('sensor.weerstation_luchtdruk_absoluut') | float) * 100) | round }},
{% endif %}
{% if states('sensor.weerstation_luchtvochtigheid') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_hum') }}": {{ states('sensor.weerstation_luchtvochtigheid') }},
{% endif %}
{% if states('sensor.lichtsensor_oost_illuminance_lux') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_light_east') }}": {{ states('sensor.lichtsensor_oost_illuminance_lux') }},
{% endif %}
{% if states('sensor.lichtsensor_zuid_illuminance_lux') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_light_south') }}": {{ states('sensor.lichtsensor_zuid_illuminance_lux') }},
{% endif %}
{% if states('sensor.lichtsensor_west_illuminance_lux') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_light_west') }}": {{ states('sensor.lichtsensor_west_illuminance_lux') }},
{% endif %}
{% if states('sensor.weerstation_dauwpunt') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_dewpoint') }}": {{ states('sensor.weerstation_dauwpunt') }},
{% endif %}
{% if states('sensor.weerstation_uv') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_uvindex') }}": {{ states('sensor.weerstation_uv') }},
{% endif %}
{% if states('sensor.weerstation_windsnelheid') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_windsnelheid') }}": {{ states('sensor.weerstation_windsnelheid') }},
{% endif %}
{% if states('sensor.weerstation_windsnelheid_bft') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_windsnelheid_bft') }}": {{ states('sensor.weerstation_windsnelheid_bft') }},
{% endif %}
{% if states('sensor.weerstation_windrichting') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_windrichting') }}": {{ states('sensor.weerstation_windrichting') }},
{% endif %}
{% if states('sensor.weerstation_neerslag_mm') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_neerslag') }}": {{ states('sensor.weerstation_neerslag_mm') }},
{% endif %}
{% if states('sensor.weerstation_neerslag_mm_uur') not in ['unknown', 'unavailable', 'none', 'null'] %}
"{{ states('input_text.opensensebox_sensorid_neerslag_mm') }}": {{ states('sensor.weerstation_neerslag_mm_uur') }}
{% endif %}
}