home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.14k stars 29.82k forks source link

TypeError: '<' not supported between instances of 'SensorEntityDescription' and 'SensorEntityDescription' #55569

Closed jurgenhaas closed 3 years ago

jurgenhaas commented 3 years ago

The problem

When trying to either validate configuration or restart from the UI (Configuration / Server Control) I see the stack trace below in the log and neither of the functions executes

What is version of Home Assistant Core has the issue?

core-2021.9.0

What was the last working version of Home Assistant Core?

core-2021.8.8

What type of installation are you running?

Home Assistant Container

Integration causing the issue

No response

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-09-02 10:24:44 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 211, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/core.py", line 29, in post
    errors = await async_check_ha_config_file(request.app["hass"])
  File "/usr/src/homeassistant/homeassistant/config.py", line 942, in async_check_ha_config_file
    res = await check_config.async_check_ha_config_file(hass)
  File "/usr/src/homeassistant/homeassistant/helpers/check_config.py", line 177, in async_check_ha_config_file
    config = config_schema(config)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 215, in _run
    return self._exec(self._compiled, value, path)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 339, in _exec
    v = func(path, v)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 386, in validate_mapping
    cval = cvalue(key_path, value)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 386, in validate_mapping
    cval = cvalue(key_path, value)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 215, in _run
    return self._exec(self._compiled, value, path)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 339, in _exec
    v = func(path, v)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 635, in validate_sequence
    cval = validate(index_path, value)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 741, in __call__
    'value must be one of {}'.format(sorted(self.container)))
TypeError: '<' not supported between instances of 'SensorEntityDescription' and 'SensorEntityDescription'

Additional information

No response

ludeeus commented 3 years ago

How fun... Please list all your configured integrations, you can see those on the info page in the configuration panel, or by looking at your logs for analytics if you have that enabled.

jurgenhaas commented 3 years ago

Oh, sorry. Missed that. Here is the list:

        Setup time
  AfterShipaftership Documentation Issues 3.48 s
  Air Qualityair_quality Documentation Issues 0.36 s
  Alarm Control Panelalarm_control_panel Documentation Issues 0.03 s
  Almondalmond Documentation Issues 1.12 s
  Analyticsanalytics Documentation Issues 0.02 s
  Upcoming anniversaryanniversary Documentation Issues 0.36 s
  Home Assistant APIapi Documentation Issues 0.16 s
  Authauth Documentation Issues 0.17 s
  Automationautomation Documentation Issues 0.29 s
  Binary Sensorbinary_sensor Documentation Issues 0.04 s
  Blueprintblueprint Documentation Issues 1.46 s
  caldavcaldav     11.58 s
  Calendarcalendar Documentation Issues 0.37 s
  Cameracamera Documentation Issues 0.20 s
  Google Castcast Documentation Issues 0.56 s
  ClimaCellclimacell Documentation Issues 6.68 s
  Climateclimate Documentation Issues 0.04 s
  Home Assistant Cloudcloud Documentation Issues 0.02 s
  Configurationconfig Documentation Issues 0.20 s
  Conversationconversation Documentation Issues 0.02 s
  Countercounter Documentation Issues 2.96 s
  deepstack object custom integrationdeepstack_object Documentation   0.23 s
  Default Configdefault_config Documentation Issues 0.97 s
  Device Automationdevice_automation Documentation Issues 0.18 s
  Device Trackerdevice_tracker Documentation Issues 0.14 s
  DHCP Discoverydhcp Documentation Issues 0.45 s
  Discoverydiscovery Documentation Issues 0.12 s
  DNS IPdnsip Documentation Issues 0.59 s
  Deutscher Wetterdienst (DWD)dwd_weather Documentation Issues 1.52 s
  Ubiquiti EdgeOS Routersedgeos Documentation   2.62 s
  Elasticsearchelasticsearch Documentation Issues 5.95 s
  Embyemby Documentation Issues 0.47 s
  Energyenergy Documentation Issues 0.28 s
  FFmpegffmpeg Documentation Issues 2.22 s
  AVM FRITZ!Box Toolsfritz Documentation Issues 5.17 s
  AVM FRITZ!SmartHomefritzbox Documentation Issues 2.46 s
  AVM FRITZ!Box Call Monitorfritzbox_callmonitor Documentation Issues 3.39 s
  Froniusfronius_inverter Documentation   2.71 s
  Home Assistant Frontendfrontend Documentation Issues 0.00 s
  Global Disaster Alert and Coordination System (GDACS)gdacs Documentation Issues 2.75 s
  geo_json_eventsgeo_json_events     0.49 s
  Geolocationgeo_location Documentation Issues 0.16 s
  gPoddergpodder Documentation Issues 4.88 s
  HACShacs Documentation Issues 4.05 s
  Historyhistory Documentation Issues 1.43 s
  Home Assistant Core Integrationhomeassistant Documentation Issues 2.35 s
  HP Printerhpprinter Documentation   0.64 s
  HTML5 Push Notificationshtml5 Documentation Issues 0.12 s
  HTTPhttp Documentation Issues 3.16 s
  Imageimage Documentation Issues 0.03 s
  Image Processingimage_processing Documentation Issues 0.04 s
  Input Booleaninput_boolean Documentation Issues 1.40 s
  Input Datetimeinput_datetime Documentation Issues 1.43 s
  Input Numberinput_number Documentation Issues 1.04 s
  Input Selectinput_select Documentation Issues 1.14 s
  Input Textinput_text Documentation Issues 2.95 s
  Internet Printing Protocol (IPP)ipp Documentation Issues 3.95 s
  Lightlight Documentation Issues 0.58 s
  Local IP Addresslocal_ip Documentation Issues 0.34 s
  Logbooklogbook Documentation Issues 2.66 s
  Loggerlogger Documentation Issues 0.30 s
  Lovelacelovelace Documentation Issues 0.22 s
  Mapmap Documentation Issues 0.15 s
  Matrixmatrix Documentation Issues 2.99 s
  Media Playermedia_player Documentation Issues 0.14 s
  Media Sourcemedia_source Documentation Issues 2.28 s
  Meteorologisk institutt (Met.no)met Documentation Issues 1.90 s
  Mobile Appmobile_app Documentation Issues 33.49 s
  MQTTmqtt Documentation Issues 3.08 s
  My Home Assistantmy Documentation Issues 0.15 s
  Netdatanetdata Documentation Issues 119.24 s
  Network Configurationnetwork Documentation Issues 0.51 s
  Notificationsnotify Documentation Issues 0.31 s
  Home Assistant Onboardingonboarding Documentation Issues 0.00 s
  openSenseMapopensensemap Documentation Issues 6.84 s
  OpenWeatherMapopenweathermap Documentation Issues 3.04 s
  Persistent Notificationpersistent_notification Documentation Issues  
  Personperson Documentation Issues 0.09 s
  Pi-holepi_hole Documentation Issues 5.64 s
  Plex Media Serverplex Documentation Issues 3.77 s
  Plex Assistantplex_assistant Documentation   11.31 s
  Recorderrecorder Documentation Issues 0.21 s
  Scenesscene Documentation Issues 2.67 s
  Scriptsscript Documentation Issues 0.24 s
  Searchsearch Documentation Issues 0.03 s
  Selectselect Documentation Issues 0.29 s
  Sensorsensor Documentation Issues 0.01 s
  Shell Commandshell_command Documentation Issues 0.01 s
  Shelly smart homeshelly Documentation   0.33 s
  Shopping Listshopping_list Documentation Issues 1.14 s
  Simple Service Discovery Protocol (SSDP)ssdp Documentation Issues 0.01 s
  Streamstream Documentation Issues 0.31 s
  Sunsun Documentation Issues 0.11 s
  Switchswitch Documentation Issues 0.01 s
  Synology DSMsynology_dsm Documentation Issues 10.15 s
  System Healthsystem_health Documentation Issues 0.97 s
  System Logsystem_log Documentation Issues 0.00 s
  Tagstag Documentation Issues 2.34 s
  Templatetemplate Documentation Issues 0.25 s
  Time & Datetime_date Documentation Issues 0.34 s
  Timertimer Documentation Issues 2.96 s
  Tracetrace Documentation Issues 0.02 s
  Ubiquiti UniFiunifi Documentation Issues 11.05 s
  Unifi Protectunifiprotect Documentation Issues 7.90 s
  Updaterupdater Documentation Issues 1.63 s
  USB Discoveryusb Documentation Issues 0.32 s
  Versionversion Documentation Issues 0.36 s
  Weatherweather Documentation Issues 0.04 s
  Webhookwebhook Documentation Issues 0.17 s
  Home Assistant WebSocket APIwebsocket_api Documentation Issues 0.16 s
  Zero-configuration networking (zeroconf)zeroconf Documentation Issues 0.12 s
  Zonezone Documentation Issues 2.52 s
  Zoomzoom Documentation Issues 5.75 s
ludeeus commented 3 years ago

Can you please disable all custom integrations (by renaming your custom_component directory), so we can make sure this is from a core integration?

jurgenhaas commented 3 years ago

I have done that and it still happens.

jurgenhaas commented 3 years ago

Might be a side effect of #55551 as I get those too. I'll give the PR a try and see if that helps.

ludeeus commented 3 years ago

That is not related

jurgenhaas commented 3 years ago

Well, it may well be. At least my problem is gone since I applied the patch and even after bringing back all the custom components, the issue hasn't come back.

mib1185 commented 3 years ago

we had a similar issue in the past #54142 where after implementing SensorEntityDescription the config validation fails, because prior SENSOR_TYPES were of type dict but rewritten to list or tuple of SensorEntityDescription ... those when validators are not updated accordingly, tests may be successful, but validation of config entries does fail.

this is a list of all integrations, which introduced SensorEntityDescription between 2021.8.8 and 2021.9.0:

abode
airvisual
amcrest
arlo
asuswrt
bbox
bitcoin
blink
bme280
bme680
broadlink
buienradar
comed_hourly_pricing
deluge
dht
dovado
dsmr
ecobee
enocean
envirophat
fido
fjaraskupan
flunearyou
foobot
goalzero
google_wifi
growatt_server
guardian
hassio
htu21d
ios
iotawatt
jewish_calendar
juicenet
keba
logi_circle
lyric
magicseaweed
mhz19
miflora
mitemp_bt
mysensors
netatmo
notion
nut
nzbget
ombi
onewire
openevse
openuv
ovo_energy
p1_monitor
pi_hole
point
pushbullet
qbittorrent
radarr
rainforest_eagle
rainmachine
rfxtrx
ring
rtorrent
sensehat
sensor
sms
solarlog
speedtestdotnet
starline
startca
thinkingcleaner
tibber
tractive
trafikverket_weatherstation
travisci
vallox
version
volkszaehler
xiaomi_miio
zamg
zwave_js

gathered by

for file in `git diff --name-only 2021.8.8 2021.9.0`; do git diff 2021.8.8 2021.9.0 $file | grep -c -e "^+.*SensorEntityDescription" | awk -v f="$file" '{print f":"$0}' | grep -v ":0" | awk -F"/" '{print $3}'; done | sort | uniq

would suggest to check each of this integrations for such kind of issue 🤔

mib1185 commented 3 years ago

mhhh ... could only find an issue with speedtestdotnet (will file a PR in a few moments), but honestly it is not on list of active integrations from @jurgenhaas 🤔

I have concentrated on looking for vol.In() since from provided traceback, this is the failing validation test File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 741, in __call__ --> this is the In() test

would be great if voluptuous lib would be type annotated, those mypy should already find such kind of issues 🤔 🙈

jurgenhaas commented 3 years ago

@mib1185 to be fair, I had speedtestdotnet available but disabled before reporting this issue because it didn't load after the update at all and I wanted to care about that later on - which meanwhile I managed to get to work again. So, maybe something was left behind that caused this issue from that integration?

mib1185 commented 3 years ago

@jurgenhaas If you still have speedtestdotnet related config (especially the monitored condition option) in your configuration.yaml, than yes 😉

jurgenhaas commented 3 years ago

Yesterday, when the issue happened, I had it in my configuration.yaml, now I moved it to the UI config and all works just fine.