Now it works for me with the following code. @HycDev : thanks for your help!
#Hycube configuration
sensor:
- platform: command_line
name: Hycube Token
scan_interval: 36000
command: >-
curl --request GET 'http://your_ip/auth/' --header 'Authorization: QmFzaWMgaHljdWJlOmh5Y3ViZQ=='
- platform: rest
scan_interval: 5
headers:
Authorization : "{{ states('sensor.hycube_token') }}"
Accept: application/vnd.github.v3+json
Content-Type: application/json
User-Agent: Home Assistant REST sensor
resource: http://your_ip/get_values/
value_template: Bla
name: Hycube Data
json_attributes:
- Battery_C
- Battery_I
- Battery_P
- Battery_V
- Grid_f
- Grid_P
- Grid_V
- Home_P
- Inv 1_I
- Inv 1_P
- Inv 1_V
- Solar 1_P
- Solar 1_I
- Solar 1_V
- solar 2_P
- solar 2_I
- solar 2_V
- solar_total_P
- platform: template
sensors:
battery_capacity:
value_template: "{{ state_attr('sensor.hycube_data', 'Battery_C') }}"
device_class: battery