Skip to content

Commit

Permalink
Entity normally has ABC as its metaclass, not type
Browse files Browse the repository at this point in the history
  • Loading branch information
canton7 committed Jan 6, 2024
1 parent 0bb6cce commit 75bb87f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Mixin providing common functionality for all entity classes"""
import logging
from abc import ABC
from typing import TYPE_CHECKING
from typing import Any
from typing import Protocol
Expand Down Expand Up @@ -75,8 +76,8 @@ class ModbusEntityProtocol(Protocol):

# HA introduced a ABCCachedProperties metaclass which is used by Entity, and which derives from ABCMeta.
# This conflicts with Protocol's metaclass (from ModbusEntityProtocol).
if type(Entity) == type(type): # type: ignore
_METACLASS = type(Protocol) # Inherits from ABCMeta
if type(Entity) == type(ABC):
_METACLASS = type(Entity)

else:

Expand Down

0 comments on commit 75bb87f

Please sign in to comment.