Skip to content

Commit

Permalink
Added required domain parameter for the config_schema (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderBlom committed Dec 9, 2023
1 parent dc63b1a commit dd945c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/bir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv

CONFIG_SCHEMA = cv.config_entry_only_config_schema()
CONFIG_SCHEMA = cv.config_entry_only_config_schema("bir")

async def async_setup(hass: HomeAssistant, config: dict):
return True
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bir/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"documentation": "https://github.com/SanderBlom/BIR_Waste_Watch",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/SanderBlom/BIR_Waste_Watch/issues",
"requirements": ["beautifulsoup4", "aiohttp"],
"requirements": ["beautifulsoup4", "datetime"],
"version": "1.1.0"
}
8 changes: 6 additions & 2 deletions custom_components/bir/sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import timedelta, datetime
import aiohttp
from homeassistant.components.sensor import SensorEntity
from homeassistant.helpers.event import async_track_time_interval
import logging
from .get_data import get_dates
_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -33,7 +32,6 @@ async def close_session(event):


class WasteCollectionSensor(SensorEntity):
SCAN_INTERVAL = timedelta(hours=4)
def __init__(self, session, url, waste_type, state, entry_id):
self._session = session
self._url = url
Expand All @@ -57,6 +55,12 @@ def name(self):
@property
def state(self):
return self._state

@property
def icon(self):
"""Return the icon of the sensor."""
# Example icon: mdi:recycle. Replace with your preferred icon
return "mdi:trash-can"

@property
def extra_state_attributes(self):
Expand Down

0 comments on commit dd945c1

Please sign in to comment.