The rain sensor is often “not available” but sometimes - I think mostly when it rains, but not sure whether this is always the case - it has a value. When there are sensors that do not report rain, I would expect to see 0, but then I don’t know if the API allows you to distinguish that.
When I rename an entity in the UI, it changes its name back to the default after a restart. I believe this is a bug: if your entity has a unique_id, then it shouldn’t change after a restart.
Same here - I’ve connected to 2 local stations. Both have rain and wind sensors data on weathermap.netatmo.com. Only 1 of the wind sensors is showing data in HA, other is ‘unavailable’. Both rain sensors are ‘unavailable’.
Now, the wind sensor that is ‘unavailable’ is showing 0 km/h on the netatmo website. Also, both rain sensors have 0mm in the last hour. So, I guess the custom component shows sensors as ‘unavailable’ when the value of the sensor is 0.
Also, entities change the name back to original after the restart.
@cgtobi PR is merged and rain sensor still broken. What’s wrong? I have same observation as @DavidMStraub - entity sometimes available (i think when it rains) and most of time Unavailable.
hi @cgtobi, thanks a million for the nice work done here! do you see ever happening to be able to point ton one specific location?
Also, I’m extremely interested in obtaining instant rain values. Could you advise on the best configuration for achieving that? should I go for avg or max?
thanks again!
Oh my god. I totally overlooked this change, though I looked for netatmo changes in every release notes…
So I built my own scipt which downloads first the current public accesstoken and then downloading the current stations to a text file running as a cronjob. Errors are filtered out.
For the HA sensors I made a set of REST, template and average sensor.
Advantage: I learned a lot of scripting, I can read out all single stations in the whole area, no netamo account needed
Disadvantage: from time to time some sensors are down which results in errors in the HA logfile, probably you need to have a full linux and can’t use home assistant OS
So I would like to share here my results. Maybe it’s usefull in some way for somehow
#!/bin/bash
n=1
while (( $n <= 3 ))
do
token=$(curl -i https://weathermap.netatmo.com/ | grep accessToken | awk '{print substr($3, 2, length($3)-3)}')
status_code=$(curl --write-out %{http_code} --silent --output /opt/scripts/netatmo_temp.txt -H "Authorization: Bearer $token" "https://api.netatmo.com/api/getpublicdata?lat_ne=51.144288&lon_ne=9.525850&lat_sw=51.139198&lon_sw=9.514476&required_data=rain&filter=false")
word_count=$(wc -c /opt/scripts/netatmo_temp.txt | awk '{print $1}')
echo "Statuscode: $status_code"
n=$(( n+1 ))
if [[ "$status_code" -ne 200 ]] ; then
echo "$(date "+%Y-%m-%d %H:%M:%S") Site status changed to $status_code" > /opt/scripts/netatmo_error.txt
else
if [[ "$word_count" -gt 1000 ]] ; then
cp /opt/scripts/netatmo_temp.txt /opt/docker/homeassistant/www/netatmo.txt
break
else
echo "$(date "+%Y-%m-%d %H:%M:%S") Word Count zu niedrig: $word_count" > /scripts/netatmo_error_wc.txt
fi
fi
done
- platform: rest
resource: http://10.0.0.21:8123/local/netatmo.txt
name: Rain Example Street
json_attributes_path: "$.body[*].measures.05:00:00:06:a6:cc"
json_attributes:
- rain_24h
- rain_60min
- rain_live
value_template: "{{ 'Rain Example Street' }}"
- platform: template
sensors:
rain_today_example_street:
friendly_name: Rain Today Example Street
value_template: "{{ states.sensor.rain_today_example_street.attributes.rain_24h | float | round(2) }}"
unit_of_measurement: "mm"
# same for rain_60min and rain_live
- platform: average
name: "Rain Today City"
entities:
- sensor.rain_today_example_street
- sensor.rain_today_example_street_1
- sensor.rain_today_example_street_2
- sensor.rain_today_example_street_3
# same for rain_60min and rain_live