General questions about using the secrets.yaml file in different use cases

Hi,
I have the following content in my secrets.yaml

rest_solarmanpv_appSecret: "6chhhhhhhh"
rest_solarmanpv_email: "[email protected]"
rest_solarmanpv_password: "aa92xxxxxxxx"
rest_solarmanpv_appId: "jjjjjj"
rest_solarmanpv_deviceid: "yyyyyyy"
rest_solarmanpv_deviceSn: "1ffffffffff"

telegram_bot_api_key: "698mykey0"
telegram_bot_chat_id: "- 4mychatid"	

now, in my configuration.yaml, i want to use the different values, but ot does not work
so basically 2 questions:
the following does not work, I get erros that chat id is not found
(use case 1)

telegram_bot:
  - platform: polling
    api_key: !secret telegram_bot_api_key
    allowed_chat_ids:
      - !secret telegram_bot_chat_id

# Example configuration.yaml entry for the notifier
notify:
  - platform: telegram
    name: "myHAGroup"
    chat_id: !secret telegram_bot_chat_id

also, I want to use the rest_solarmanpv variables in tzhe following configuration
will this be possible with !secrets
use case 2

rest:
  - resource: https://globalapi.solarmanpv.com/device/v1.0/currentData
    method: POST
    scan_interval: 900
    headers:
      Authorization: Bearer {{ state_attr('sensor.Solarmanpvtoken','access_token') }} 
      Content-Type: application/json       
    payload: '{ "deviceId": "!secret rest_solarmanpv_deviceid ", "deviceSn": "!secret rest_solarmanpv_deviceSn"}'
    sensor:

as well as here
use case 3

  - resource: https://globalapi.solarmanpv.com/account/v1.0/token?appId=!secret rest_solarmanpv_appId
    method: POST
    scan_interval: 2592000
    headers:
      Content-Type: application/json
    payload: '{"appSecret": "!secret rest_solarmanpv_appSecret","email": "!secret rest_solarmanpv_email","password": "!secret rest_solarmanpv_password"}'
    sensor:

maybe it is a little bit confusing, but generally the post is about how to correctly use the secrets.yaml file

The telegram and notify configurations are correct.

However you can’t do this:

payload: '{"appSecret": "!secret rest_solarmanpv_appSecret","email": "!secret rest_solarmanpv_email","password": "!secret rest_solarmanpv_password"}'

You would have to do:

payload: !secret rest_solarmanpv_payload

Then in your secrets file define the full payload for the rest_solarmanpv_payload secret.