Home Assistant - refused to connect at random

This looks a bit like a network issue, but your core logs only show entries after the network issue occured.
Do you have some storm protection active on your switch?

Answer 1
From checking between 02:00 and 15:00 today I can see that the readings are constant for battery temperature, I do have some other readings but obviously we know temperature is meant to change as seen below.

So issue has possibly occurred between 06:15 and 06:45 today.

Answer 2
No automations work.

For example I had an automation to turn on a MQTT switch at a set time but nothing happened.

Answer 3
Unfortunately I don’t have sensors for this but would be more than happy to add it, the only info I have which doesn’t show historical is the one found in System.

Would you be able to provide the config sensor for yours?

I would have a second Pi4 (4Gb) running the same hardware such as SSD and PoE but it would be Pi OS with Docker, this has seen pretty much 0% downtime on the same Unifi 24 PoE switch.

I had checked the config on the port and can confirm Storm Control isn’t turned on as seen below.

Does you switch have logs for if link is dropped on the PoE port? Not the PoE link, but the network link?

TBH I wouldn’t be able to confirm that only because I haven’t seen any errors before on it, I do know the controller will report if for example an AP has lost connection.

I do know when I ping the Pi it responds but its when attempting to access it where I get the error.

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

You have a network issue for sure, since all the errors in the core log you posted is about connection issues.

Try to connect to port 4357 with the local IP on your HA when it is working correct and see if you get a responce.
If you do then connect again when the problem occurs.

How do you connect to your HA?
Local IP or Local URL or external URL?

Ok thank you, I’ll check these 2 other threads out, in the meantime as a better way of handling the short term solution I’ve setup the graph and the automation to alert me.

image

1 Like

I had tried port 4357 just now via the local IP and received “refused to connect” error eventhough I can access it via 8123 at this time without issue.

I will try what @cascano42 has suggested.

I would connect via both local IP and external URL.

Both would use HTTPS.

Ok slight update, I’ve made the changes as mentioned in that ticket, thank you @cascano42 for that.

I’ve also added to my Home Assistant to monitor the SWAP in the meantime.

image

1 Like

The observer is not part of HA so even though you have set up SSL you need to use http:// for port 4357

well, if your internet connection have issues, then SSL will be hit too, since certifacates might need to be looked up at the CAs that issued them.
For now try to use only http and see if the issue still exist then.

Got it thanks, think when I was entering the IP it was automatically using HTTPS.

I’ll keep an eye on this next time I experience the issue.

image

Slight update, I haven’t noticed the SWAP being anywhere near full as seen below, think the max I have ever seen it is 2Mb.

Ok so… unresponsive again :frowning:

Before I power cycled the port I tried the following:

  • Accessing via internal, external and internal HTTP port 4357 - message: refused to connect
  • Checking port via Unifi, shows power is being supplied along with TX and RX indicating data is being sent/received
  • Home Assistant dropped off Unifi Client list to show its connected

After power cycling the port:

  • Can access internal, external and internal HTTP 4357 without issue
  • Checked the HA monitor graph to find the below, issue occurred right after 00:24:28 GMT
  • Checked SWAP used and had never went above 0.8Mb but has 2,996.1Mb to play with

Not sure of what to make of the graph, the spike you see at the very end is when it is rebooting.

image

image

Anyone got any ideas?

I know that even installing this on a different Pi 4 or installing from scratch makes no difference as already tested.

No suggestions, but following because I’m intermittently having similar issues

I think the graph is just showing an interpolation between the last datapoint at about 01:15 and 02:00, so no data is collected in that time frame.
Do you have any automations or scripts starting just past midnight, like backup or so?

We have seen many cases where a Raspi 4 with SSD disk are underpowered by an origirnal 3A PSU.
3A x 5V = 15W
15.4W is the max for the PoE ports, so unless your switch is a PoE+, then it might not be able to handle the power draw of the raspi with SSD.

I’ll have a check regarding automations, I only know at this time that 1 automation which is just to turn off a WLED and a switch at 00:30 but that was never triggered.

Luckily the switch for ports 1-16 are PoE+ so would be within range as per below spec, I can also confirm there are only 2 clients using PoE on the switch which are this Pi4 running HA then another Pi4 in the exact same hardware configuration running docker.

image

You switch is fine, so that is not the problem, but I do actually not know if there is a limit on the PoE hats to how much they can draw.
I have never used PoE on devices other than it was built for that sepcific device with no options for expanding the device, so the manufacteur knew the requirements beforehand.

So from checking the max wattage that the PoE hat puts out is 12.5W as per the info found on the listing page.

I could try see about limiting the SSD usage (find out its max power pull too) or try running it from separate power.