Skip to content

Commit

Permalink
Update core to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Oct 13, 2022
1 parent ba3fc2b commit ecebc32
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.10

- Update core to latest

## 2.0.9

- Update core features
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shinobi/core/components/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class CoreCamera(Camera, BaseEntity, ABC):
""" Shinobi Video Camera """
""" Camera """

def __init__(self, hass, device_info):
super().__init__()
Expand Down
4 changes: 2 additions & 2 deletions custom_components/shinobi/core/components/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class CoreSelect(SelectEntity, BaseEntity, ABC):
""" Shinobi Video Monitor Mode Control """
""" Core Select """
def initialize(
self,
hass: HomeAssistant,
Expand All @@ -43,7 +43,7 @@ def current_option(self) -> str:
return str(self.entity.state)

async def async_select_option(self, option: str) -> None:
"""Select monitor mode."""
"""Select option."""
await self.ha.async_core_entity_select_option(self.entity, option)

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shinobi/core/components/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class CoreSensor(SensorEntity, BaseEntity):
"""Representation a binary sensor that is updated by EdgeOS."""
"""Representation a binary sensor."""

@property
def native_value(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shinobi/core/components/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class CoreSwitch(SwitchEntity, BaseEntity):
"""Class for a Shinobi Video switch."""
"""Class for a switch."""

@property
def is_on(self) -> bool | None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shinobi/core/components/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class CoreVacuum(StateVacuumEntity, BaseEntity, ABC):
"""Class for a Shinobi Video switch."""
"""Class for a switch."""

def initialize(
self,
Expand Down
10 changes: 6 additions & 4 deletions custom_components/shinobi/core/managers/entity_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ async def _async_delete_components(self):
)

async def _async_update(self):
_LOGGER.debug("Starting to update entities")

try:
await self._async_add_components()
await self._async_delete_components()
Expand Down Expand Up @@ -241,14 +239,17 @@ def set_entity(self,

entity = self.entities.get(entity_description.key)

original_status = None

if entity is None:
entity = EntityData(entry_id, entity_description)
entity = EntityData(entry_id)
entity.status = EntityStatus.CREATED
entity.domain = domain

self._compare_data(entity, state, attributes, device_name)

else:
original_status = entity.status
was_modified = self._compare_data(entity, state, attributes, device_name, entity_description, details)

if was_modified:
Expand All @@ -259,6 +260,7 @@ def set_entity(self,
entity.attributes = attributes
entity.device_name = device_name
entity.details = details
entity.entity_description = entity_description

if destructors is not None and True in destructors:
if entity.status == EntityStatus.CREATED:
Expand All @@ -274,4 +276,4 @@ def set_entity(self,
self.entities[entity_description.key] = entity

if entity.status != EntityStatus.READY:
_LOGGER.info(f"{entity.name} ({entity.domain}) {entity.status}, state: {entity.state}")
_LOGGER.info(f"{entity.name} ({entity.domain}) {entity.status}, state: {entity.state} | {original_status}")
1 change: 1 addition & 0 deletions custom_components/shinobi/core/models/domain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from typing import Any, Callable

from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

Expand Down
6 changes: 3 additions & 3 deletions custom_components/shinobi/core/models/entity_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class EntityData:
disabled: bool
domain: str | None
entry_id: str
entity_description: EntityDescription
entity_description: EntityDescription | None

def __init__(self, entry_id: str, entity_description: EntityDescription):
def __init__(self, entry_id: str):
self.entry_id = entry_id
self.entity_description = entity_description
self.entity_description = None
self.state = None
self.attributes = {}
self.details = {}
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shinobi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"codeowners": ["@elad-bar"],
"requirements": [ ],
"config_flow": true,
"version": "2.0.9",
"version": "2.0.10",
"iot_class": "local_polling"
}

0 comments on commit ecebc32

Please sign in to comment.