Include battery level

Hi, I’m trying to create a template sensor for humidity and include the battery level as part of the sensor in order to be reported as part of the humidity sensor in HomeKit. The humidity sensor is being exposed to HomeKit, but not the battery level as part of the same sensor. How does the magic with the HomeKit configuration withe the UI part work in the integration?

I don’t want to start from scratch by building the HomeKit part in configuration.yaml. I just have a couple of sensors in HA I publish to HomeKit.

So, is there something I need to take care of so the HomeKit Integration in the UI understands the battery level belongs to the humidity sensor?

Thanks

template:
   - sensor:
      - name: "energy_export"
        unit_of_measurement: "lx"
        state_class: measurement
        device_class: illuminance
        state: >-
          {{ states('sensor.power_meter_active_power') }}
        attributes:
          battery: >-
            {{ states('sensor.battery_state_of_capacity') }}
   
   - sensor:
      - name: "energy_export_battery_level"
        unit_of_measurement: "%"
        state_class: measurement
        device_class: battery
        state: >
          {{ states('sensor.battery_state_of_capacity') }}