Can't connect to frontend on ip-address:8123 while observer on ip-address:4357 is working

Good day,

I’ve got home assistant setup on a raspberry pi with latest core (2024.4.3).
Everything worked just fine up until two weeks ago. Since then I could not reach my home assistant with the app nor with my laptop when browsing to ip-address:8123.
I can access the home assistant with shh and the observer on ip-address:4357 tells me:
Superviser: Connected
Supported: Supported
Healthy: Healthy

I just updated ha to the latest version and rebooted, which did not make any difference.
After the reboot, the browser reports:

This site can’t be reached
refused to connect.
Try:

  • Checking the connection
  • Checking the proxy and the firewall
    ERR_CONNECTION_REFUSED

After some time (about 5 minutes) the browser responds with a different message:

This page isn’t working
didn’t send any data.
ERR_EMPTY_RESPONSE

I was hoping to resolve this without having to re-install ha.
Any suggestions?

Via SSH, is there anything in the logs? Common tasks - Operating System - Home Assistant.

ha core logs
ha supervisor logs

Also, try the following

ha core rebuild
ha supervisor repair
ha host reboot

Thanks for the quick reply and the pointers.

The supervisor logs are all clear, however, in the core logs there is an exception:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 331, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 837, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1261, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 837, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 439, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 670, in state
    raise ValueError(
ValueError: Sensor sensor.airco_slaapkamer_energy_used_2 has device class 'energy', state class 'total_increasing' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)
2024-04-17 07:29:35.380 WARNING (MainThread) [aioesphomeapi.connection] ac-slaapkamer @ 192.168.178.15: Connection error occurred: [Errno 104] Connection reset by peer
2024-04-17 07:29:35.389 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{states('sensor.airco_slaapkamer_current_power') | float * states('sensor.dsmr_reading_phase_voltage_l1') | float}}' but no default was specified') while processing template 'Template<template=({{states('sensor.airco_slaapkamer_current_power') | float * states('sensor.dsmr_reading_phase_voltage_l1') | float}}) renders=6138>' for attribute '_attr_native_value' in entity 'sensor.airco_slaapkamer_current_power_2'
2024-04-17 07:29:35.396 ERROR (MainThread) [homeassistant.helpers.event] Error while dispatching event for sensor.airco_slaapkamer_energy_used to <Job track state_changed event {'sensor.airco_slaapkamer_energy_used'} HassJobType.Callback <bound method TrackTemplateResultInfo._refresh of <TrackTemplateResultInfo {Template<template=({{states('sensor.airco_slaapkamer_energy_used')}}) renders=60>: <RenderInfo Template<template=({{states('sensor.airco_slaapkamer_energy_used')}}) renders=60> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset({'sensor.airco_slaapkamer_energy_used'}) rate_limit=None has_time=False exception=None is_static=False>}>>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 668, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 331, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 837, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1261, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 837, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 439, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 670, in state
    raise ValueError(
ValueError: Sensor sensor.airco_slaapkamer_energy_used_2 has device class 'energy', state class 'total_increasing' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)
2024-04-17 07:31:16.334 WARNING (MainThread) [aioesphomeapi.connection] ac-slaapkamer @ 192.168.178.15: Connection error occurred: [Errno 104] Connection reset by peer
2024-04-17 07:31:16.348 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{states('sensor.airco_slaapkamer_current_power') | float * states('sensor.dsmr_reading_phase_voltage_l1') | float}}' but no default was specified') while processing template 'Template<template=({{states('sensor.airco_slaapkamer_current_power') | float * states('sensor.dsmr_reading_phase_voltage_l1') | float}}) renders=6158>' for attribute '_attr_native_value' in entity 'sensor.airco_slaapkamer_current_power_2'
2024-04-17 07:31:16.349 ERROR (MainThread) [homeassistant.helpers.event] Error while dispatching event for sensor.airco_slaapkamer_energy_used to <Job track state_changed event {'sensor.airco_slaapkamer_energy_used'} HassJobType.Callback <bound method TrackTemplateResultInfo._refresh of <TrackTemplateResultInfo {Template<template=({{states('sensor.airco_slaapkamer_energy_used')}}) renders=64>: <RenderInfo Template<template=({{states('sensor.airco_slaapkamer_energy_used')}}) renders=64> all_states=False all_states_lifecycle=False domains=frozenset() domains_lifecycle=frozenset() entities=frozenset({'sensor.airco_slaapkamer_energy_used'}) rate_limit=None has_time=False exception=None is_static=False>}>>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 668, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 331, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 837, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1261, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 837, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 439, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 670, in state
    raise ValueError(
ValueError: Sensor sensor.airco_slaapkamer_energy_used_2 has device class 'energy', state class 'total_increasing' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)

It looks like there is something wrong with the airconditioning in the bedroom. I guess I can quickly resolve it by removing it from my setup (not sure how to do it via ssh though). On the other hand, I think ha should be resilient against faulty sensors (not sure how to fix that either).

I don’t think what is in the log is the cause of the problem.

Were there any errors when you performed the core rebuild, supervisor repair, and reboot?

I would rebuild from scratch and restore a backup if still having problems.

3 posts were split to a new topic: Problems installing HA

No errors when rebuilding core, repairing supervisor and reboot.

I’m slowly considering rebuilding from scratch, I just need to find some time to do it. Since my automations are still running fine, the priority is somewhat low. It is however quite annoying that the app doesn’t work…

Random thought…have you tried clearing the browser caches?

@geronimo76 can you confirm that this happened after you upgraded to 2024.4.3? If so, can you revert to the previous working version to confirm that the issue goes away?

@rauschermedia can you revert to a previous working version to confirm it is due to the update?

And what is “above exception” ?

PS: Do you have any templates related to your air-conditioning

?

Please also state whether you have proxy, SSL , own DNS etc
And where you see these ERR_ refuse/empty

Have your tried from wired devices ?, other Devices ? and other Browsers ?