Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ services:
# Static files router
- "traefik.http.routers.smib-static.rule=PathPrefix(`/static`)"
- "traefik.http.routers.smib-static.priority=10"
# Legacy (deprecated) HTTP Endpoints (for SMIBHID use)
- "traefik.http.routers.smib-legacy.rule=PathPrefix(`/smib/event`)"
- "traefik.http.routers.smib-legacy.priority=10"

smib-db:
<<: *common
Expand Down
11 changes: 1 addition & 10 deletions src/plugins/space/smibhid/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,4 @@ async def log_sensor(data: SensorLogRequest, x_smibhid_hostname: DeviceHostnameH
logger.debug(f"Logging {len(db_logs)} sensor log(s) from {x_smibhid_hostname} to database")
await SensorLog.insert_many(db_logs)

await SensorUnit.upsert_from_api(data.units, x_smibhid_hostname)

@http.post('/smib/event/smibhid_sensor_log', deprecated=True)
async def log_sensor_from_smib_event(data: SensorLogRequest, device_hostname: DeviceHostnameHeader):
""" Logs a sensor event to the database """
db_logs = [SensorLog.from_api(log, device_hostname) for log in data.readings]
logger.debug(f"Logging {len(db_logs)} sensor log(s) from {device_hostname} to database")
await SensorLog.insert_many(db_logs)

await SensorUnit.upsert_from_api(data.units, device_hostname)
await SensorUnit.upsert_from_api(data.units, x_smibhid_hostname)
7 changes: 0 additions & 7 deletions src/plugins/space/smibhid/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,4 @@ async def log_ui(ui_logs: list[UILogCreate], x_smibhid_hostname: DeviceHostnameH
""" Logs a UI event to the database """
db_logs = [UILog.from_api(log, x_smibhid_hostname) for log in ui_logs]
logger.debug(f"Logging {len(db_logs)} UI event(s) from {x_smibhid_hostname} to database")
await UILog.insert_many(db_logs)

@http.post('/smib/event/smibhid_ui_log', deprecated=True)
async def log_ui_from_smib_event(ui_logs: list[UILogCreate], device_hostname: DeviceHostnameHeader):
""" Logs a UI event to the database """
db_logs = [UILog.from_api(log, device_hostname) for log in ui_logs]
logger.debug(f"Logging {len(db_logs)} UI event(s) from {device_hostname} to database")
await UILog.insert_many(db_logs)
29 changes: 0 additions & 29 deletions src/plugins/space/spacestate/listeners/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,3 @@ async def get_space_state() -> SpaceState:
space_state = await get_space_state_from_db()
logger.info(f"Returning space state: {SpaceStateEnum.OPEN if space_state.open else None if space_state.open is None else SpaceStateEnum.CLOSED}")
return space_state


@http.put("/smib/event/space_open", deprecated=True)
async def set_space_open_from_smib_event(
say: AsyncSay,
space_open_params: Annotated[SpaceStateOpen | None, Body()] = None
) -> None:
""" Set the space state to open """
space_open_params = space_open_params or SpaceStateOpen()
logger.info(f"Received legacy space open request (deprecated) with {space_open_params.hours}h selected.")
await open_space(space_open_params, say)

@http.put("/smib/event/space_closed", deprecated=True)
async def set_space_closed_from_smib_event(
say: AsyncSay,
space_closed_params: Annotated[SpaceStateClosed | None, Body()] = None
) -> None:
""" Set the space state to closed """
space_closed_params = space_closed_params or SpaceStateClosed()
logger.info("Received legacy space closed request (deprecated).")
await close_space(space_closed_params, say)

@http.get("/smib/event/space_state", deprecated=True)
async def get_space_state_from_smib_event(say: AsyncSay) -> SpaceState:
""" Get the space state """
logger.info("Received legacy space state request (deprecated).")
space_state = await get_space_state_from_db()
logger.info(f"Returning space state: {SpaceStateEnum.OPEN if space_state.open else None if space_state.open is None else SpaceStateEnum.CLOSED}")
return space_state