Home Assistant - refused to connect at random

okay it seems that it’s more that HA freeze than becoming unavailable
here is some discussion about that:

the trick for the sensor is in the last one, but her is mine:

# temperature cpu
- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  # If errors occur, make sure configuration file is encoded as UTF-8
  unit_of_measurement: "°C"
  value_template: '{{ value | multiply(0.001) | round(2) }}'
  scan_interval: 30

# Example configuration.yaml entry
- platform: systemmonitor
  resources:
    - type: disk_use_percent
      arg: /config
    - type: memory_free
    - type: disk_use
    - type: load_1m
    - type: load_5m
    - type: load_15m
    - type: processor_use
    - type: memory_use_percent
    - type: last_boot

I had that problem recently but it disappeared after I use the sensor to alert me when it’s too high:

- id: '1633543522497'
  alias: alert possesseur
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.processor_use_percent
    above: '80'
  condition: []
  action:
  - service: notify.mobile_app_cell_cascano
    data:
      title: alert prossesseur
      message: en haut de 80%
  mode: single

you can trigger a restart when some value go too high for a workaround in the mean time