Netatmo Valves Battery Level

Hi there,

I have been trying to get the battery_level state of my netatmo valves.

Under the sensors directory, I created a yaml file called battery_netatmo_camera_bimbe.yaml which states

- platform: Netatmo
  sensors:
    battery_netatmo_camera_bimbe:
      unique_id: 'battery_netatmo_camera_bimbe'
      value_template: "{{ state_attr('climate.netatmo_camera_bimbe', 'battery_level')|int|default(0) }}"
      unit_of_measurement: '%'
      device_class: battery

However when I restart home assistant the Netatmo integration stops functioning. If instread of Netatmo after the platform statement I put template the sensor is shown in the entities however I get no reading.

In developers if I select climate.netatmo_camera_bimbe the battery_level is available as state.

hvac_modes:
  - auto
  - heat
min_temp: 7
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - away
  - boost
  - Frost Guard
  - Schedule
current_temperature: 17
temperature: 17
hvac_action: idle
preset_mode: Schedule
battery_level: 97
heating_power_request: 0
friendly_name: Netatmo Camera Bimbe
supported_features: 17

what am I doing horrendously wrong?

Thanks

Your issue is a just a typo. The platform needs to be template rather than Netatmo.

- platform: template
  sensors:
    battery_netatmo_camera_bimbe:
      unique_id: 'battery_netatmo_camera_bimbe'
      value_template: "{{ state_attr('climate.netatmo_camera_bimbe', 'battery_level')|int|default(0) }}"
      unit_of_measurement: '%'
      device_class: battery

Thanks Toby, I managed to get all the battery states of all my Netatmo valves.

I removed the |int|default(0) argument as the output was already an integer. The battery_netatmo_valves.yaml script has been saved in the sensors/battery folder and it is the following

# Camera Bimbe Netatmo Valve Battery Level
- platform: template
  sensors:
    battery_netatmo_camera_bimbe:
      unique_id: 'battery_netatmo_camera_bimbe'
      value_template: "{{ state_attr('climate.netatmo_camera_bimbe', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery

# Corridoio 2 Netatmo Valve Battery Level
- platform: template
  sensors:
    battery_netatmo_corridoio_2:
      unique_id: 'battery_netatmo_corridoio_2'
      value_template: "{{ state_attr('climate.netatmo_corridoio_2', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery

#Camera da Letto Netatmo Valve Battery Level
- platform: template
  sensors:
    battery_netatmo_camera_da_letto:
      unique_id: 'battery_netatmo_camera_da_letto'
      value_template: "{{ state_attr('climate.netatmo_camera_da_letto', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery

#Soggiorno Netatmo Valve Battery Level
- platform: template
  sensors:
    battery_netatmo_soggiorno:
      unique_id: 'battery_netatmo_soggiorno'
      value_template: "{{ state_attr('climate.netatmo_soggiorno', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery
1 Like

Hey, thank you sooo much for your solutions. I’ve implemented it as well and simplified it a bit

# Show battery state of netatmo thermista valves  
- platform: template
  sensors:
    battery_netatmo_salon:
      unique_id: 'battery_netatmo_salon'
      value_template: "{{ state_attr('climate.netatmo_salon', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery
    battery_netatmo_salle_a_manger:
      unique_id: 'battery_netatmo_salle_a_manger'
      value_template: "{{ state_attr('climate.netatmo_salle_a_manger', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery  
    battery_netatmo_salle_de_bains:
      unique_id: 'battery_netatmo_salle_de_bains'
      value_template: "{{ state_attr('climate.netatmo_salle_de_bains', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery
    battery_netatmo_chambre:
      unique_id: 'battery_netatmo_chambre'
      value_template: "{{ state_attr('climate.netatmo_chambre', 'battery_level') }}"
      unit_of_measurement: '%'
      device_class: battery

Do you guys have your valves configured in individual rooms? I have some valves in the same room and grouped them in the Netatmo & Homekit environment.

I suspect that when this is the case, the battery level is not provided for these valves as I don’t see the individual valves in Home Assistent. In the rooms where there’s only one valve this property is populated.

Would you guys know if there would be a way to get all the individual valves?

Right now there is now way in HA to get individual valves. Sorry.

Any idea why is this not working for me?

Can you be a bit more specific?

Created the battery level sensors in the yalm like in the example of OP. The sensor creates succesfully but it gives me the state “unkown”.

I’m using homekit to control the valves and the opentherm relay since the netatmo integration doesn’t work with the new opentherm relay

Then you have to look up the attributes from your homekit entities and edit the template.

Unfortunately I don’t even know how to begin to do that. Messed around a bit in the entity and developer tools but couldn’t find any clue.

There are multiple problems. For one, you are using homekit whereas he is using the Netatmo integration, which provides attributes you probably don’t have. Further, such template sensors are not meant to be simply copied and pasted if you don’t have a basic understanding how they work. I’d suggest to read the docs on templates and template sensors and start playing in the dev tools section where you have all states and attributes available and can freely build up the desired template that fulfils you needs.

hi, i have multiple valves in multiple rooms, what I see:

  • room with 1 valve → no battery_level attribute
  • other room with 1 valve → battery_level with value “high”
  • room with 3 valves → battery_level with value “full”

so battery_level available for romm with multiple valves and values are strings, not int

well, all valves are firmware v85

i would like to all valves with battery_level attribute, string values are ok :wink:

Hi all!

I’ve created the sensors with your config too and it works at least for the rooms with a single valve. The room in my case with 4 valves and the thermostat I think I have the thermostat value.
But the problem for me is that I get “full” or “high” and I don’t know how to get the numeric value in percentage.
Is it possible to get it or Netatmo has changed it’s battery value representation?

Thanks!

Murray

Hi,

I actually have the same problem on my side. Also had the problem where some random valves would not send their battery states.
At the moment all of my valves are communicating their battery states but only in “high” “low” status.
I believe they changes something within their api.

Maybe someone with better code knowledge as I have might figure out how to pull data using the rest template like for this case : MyStrom Switch v2 - #7 by davosian

Here is the api doc : Netatmo Connect | Energy API Documentation

There is no such value provided by the API. The battery state is only reported as as a string (high/low) or as an absolute value which we then only can interpolate from “educated guessing” (which was removed, because it was unreliable).

Hi, i don‘t have any valve which provides the Battery level sensor. How do i get them?

I only have one valve in each room. All on v85 and the Relais is on v222.

In the Last days i only got a Message from netatmo App That my battery died and heating started to fully Open the valve. I want to fix This so i can change batteried right before They die and Not After.

Thanks for any tips!

You should see the battery level on the device or integrations page.

grafik

1 Like

Wow i am dumb. Thank you very much!

Certainly not dumb. It’s easy to miss and relatively new.