espark-core 0.4.8__py3-none-any.whl → 0.4.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of espark-core might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: espark-core
3
- Version: 0.4.8
3
+ Version: 0.4.9
4
4
  Summary: The core module of the Espark ESP32-based IoT device management framework.
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -8,14 +8,14 @@ Description-Content-Type: text/markdown
8
8
  License-File: LICENSE
9
9
  Requires-Dist: aiomqtt>=2.4.0
10
10
  Requires-Dist: apscheduler>=3.11.1
11
- Requires-Dist: fastapi>=0.124.2
11
+ Requires-Dist: fastapi>=0.124.4
12
12
  Requires-Dist: packaging>=25.0
13
13
  Requires-Dist: slack-sdk==3.39.0
14
14
  Requires-Dist: sqlalchemy>=2.0.45
15
15
  Requires-Dist: sqlmodel>=0.0.27
16
16
  Requires-Dist: uvicorn[standard]>=0.38.0
17
17
  Provides-Extra: dev
18
- Requires-Dist: aiosqlite==0.21.0; extra == "dev"
18
+ Requires-Dist: aiosqlite==0.22.0; extra == "dev"
19
19
  Requires-Dist: autopep8==2.3.2; extra == "dev"
20
20
  Requires-Dist: build==1.3.0; extra == "dev"
21
21
  Requires-Dist: fastapi-cli[standard-no-fastapi-cloud-cli]==0.0.16; extra == "dev"
@@ -1,10 +1,10 @@
1
- espark_core-0.4.8.dist-info/licenses/LICENSE,sha256=wkIXJHYIspOGVvn_ajKyLucpIyw9_pO3QExFcNTCY78,1065
1
+ espark_core-0.4.9.dist-info/licenses/LICENSE,sha256=wkIXJHYIspOGVvn_ajKyLucpIyw9_pO3QExFcNTCY78,1065
2
2
  esparkcore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- esparkcore/constants.py,sha256=uI0bVa78CZa-ftlyTRMqWSBK275iDB1l8g1TmtJ1FGg,378
3
+ esparkcore/constants.py,sha256=v5D_z1nST50FpA5FvpGYz9rk6wngQleCyFU1wtmk58I,417
4
4
  esparkcore/data/__init__.py,sha256=abMOPq6jC5qOQCl9j7iPDv8iyjzDF-oVd_gW0la5kL4,45
5
5
  esparkcore/data/database.py,sha256=OaJSBDW6Qge-rsKkSIksJXOg3xF_y6LuBew--6uFbG4,532
6
6
  esparkcore/data/models/__init__.py,sha256=9YBRwn7R_aovQjT-ZR64fBm7TPs0dsjoq3LzsUTaRtA,124
7
- esparkcore/data/models/device.py,sha256=HQr941uabovQpyGZ1fOnsBNSU_LVmB7JQIZuDkk1uis,1086
7
+ esparkcore/data/models/device.py,sha256=a1Tfw8xHzDLEiVxANZ-lR2aVaWaWJFa8tZQwHBzDgu0,1135
8
8
  esparkcore/data/models/outbox.py,sha256=r5bgjIbj9H-OsGhE-CWKGRf4Tp88qMvmxPYHNGOApY4,1309
9
9
  esparkcore/data/models/telemetry.py,sha256=OfzGqGj2Y1sdK519sSOEXhfuErHoeEdpy5qmJMIc27A,652
10
10
  esparkcore/data/models/version.py,sha256=h2O_Owx-exx5tiQiiauCSELkUHDx-QZjiIGqFPybT4M,269
@@ -15,8 +15,8 @@ esparkcore/data/repositories/outbox_repository.py,sha256=PdPyKq2Km4_7732O6HhA4Bl
15
15
  esparkcore/data/repositories/telemetry_repository.py,sha256=5UBBmY-ugcgP0Xji7cu58_nGt8MWKeHz9DHNVJxk0BY,1116
16
16
  esparkcore/data/repositories/version_repository.py,sha256=QZZX2BpFx1i0oeFJ6j0nZvlZH7cViKU8VERBE8AU3ZY,395
17
17
  esparkcore/notifications/__init__.py,sha256=WrdUPsRS0tg2rAhv4aj4eGDekkfAsKjcRPRlT6btzQs,77
18
- esparkcore/notifications/notifier.py,sha256=N59O8K4jbpIMOMwSPRrZ-sbnN82ynxx6qelCDKV1E_4,456
19
- esparkcore/notifications/slack_notifier.py,sha256=D3adrI1sFMtQpIQEtVRILZecIVCUA7sDcgtDzm9w6Fg,592
18
+ esparkcore/notifications/notifier.py,sha256=d4a8leU-oTwWe7ZTLw-vxfCrYlFnCIvbcXabiXkT6Lc,446
19
+ esparkcore/notifications/slack_notifier.py,sha256=-H-3YYm0CRTV8pZgggrNPJKz6815HTumKvE7VsvvSAA,644
20
20
  esparkcore/routers/__init__.py,sha256=K8-S0hugkQT5DB8i8O5YqeRsu9fGfLep6UQzCIpdgGg,131
21
21
  esparkcore/routers/base_router.py,sha256=t-x8tYZVzBk9bD__9yaGYhm66glq_oM_lAHn0eplM2M,3902
22
22
  esparkcore/routers/device_router.py,sha256=mIBAyTyxl9AF8Os_Sms6Bb0vEvWfljyElbTWEGLo0iU,1172
@@ -29,7 +29,7 @@ esparkcore/services/__init__.py,sha256=RIZOHBfkWn3HsApdA5rH9EZbbXGq0NfiGoOWDO_JX
29
29
  esparkcore/services/mqtt.py,sha256=EFRVT7QYEpWFhTopS2T6J5O69NWbxeuBQnytCjvd23k,6379
30
30
  esparkcore/utils/__init__.py,sha256=rzuCJUAaQl-yPhM1vcWB_1zVXqtA71ChYP2aM_3UfKk,42
31
31
  esparkcore/utils/logging.py,sha256=sRO8uOcPkFH-DwepqLOTS2qGaopXpMdVOjzZL6RpGs4,257
32
- espark_core-0.4.8.dist-info/METADATA,sha256=w89JMtUB_nVoQKipy_DqXK5tdof6lSwY7pgdwMtBiK0,6329
33
- espark_core-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
- espark_core-0.4.8.dist-info/top_level.txt,sha256=hXVyhIPB4aGskFm5queWALxDPhcDkrN7_8vcjwA1iE4,11
35
- espark_core-0.4.8.dist-info/RECORD,,
32
+ espark_core-0.4.9.dist-info/METADATA,sha256=kCGaK8PkyR5DMoJCxhwk56RN4sz91l9lJS5CW-bB2xo,6329
33
+ espark_core-0.4.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
+ espark_core-0.4.9.dist-info/top_level.txt,sha256=hXVyhIPB4aGskFm5queWALxDPhcDkrN7_8vcjwA1iE4,11
35
+ espark_core-0.4.9.dist-info/RECORD,,
esparkcore/constants.py CHANGED
@@ -1,6 +1,7 @@
1
1
  ENV_DATABASE_URL : str = 'DATABASE_URL'
2
2
  ENV_MQTT_HOST : str = 'MQTT_HOST'
3
3
  ENV_MQTT_PORT : str = 'MQTT_PORT'
4
+ ENV_UPLOAD_PATH : str = 'UPLOAD_PATH'
4
5
 
5
6
  TOPIC_ACTION : str = 'espark/action'
6
7
  TOPIC_DEVICE : str = 'espark/device'
@@ -8,7 +8,7 @@ from sqlmodel import SQLModel, Field, JSON
8
8
  class Device(SQLModel, table=True):
9
9
  id : str = Field(primary_key=True, description='Unique identifier for the device')
10
10
  display_name : Optional[str] = Field(default=None, description='Human-readable name of the device')
11
- app_name : Optional[str] = Field(default=None, description='Name of the application running on the device')
11
+ app_name : Optional[str] = Field(default=None, foreign_key='appversion.id', ondelete='CASCADE', description='Name of the application running on the device')
12
12
  app_version : Optional[str] = Field(default=None, description='Version of the application running on the device')
13
13
  capabilities : Optional[str] = Field(default=None, description='Comma separated capabilities of the device')
14
14
  parameters : Dict[str, str | int | bool] = Field(default_factory=dict, sa_column=Column(JSON), description='JSON string of capability-specific parameters')
@@ -3,7 +3,7 @@ from abc import ABC, abstractmethod
3
3
 
4
4
  class BaseNotifier(ABC):
5
5
  @abstractmethod
6
- async def notify(self, device_id: str, event_type: str, value: int, **kwargs) -> None:
6
+ async def notify(self, device_id: str, event_type: str, value: int) -> None:
7
7
  """
8
8
  Send a notification for an event.
9
9
 
@@ -5,12 +5,13 @@ from .notifier import BaseNotifier
5
5
 
6
6
 
7
7
  class SlackNotifier(BaseNotifier):
8
- async def notify(self, device_id: str, event_type: str, value: int, **kwargs) -> None:
9
- slack_token = kwargs.get('slack_token')
10
- slack_channel = kwargs.get('slack_channel')
8
+ def __init__(self, slack_token: str, slack_channel: str) -> None:
9
+ self.slack_token = slack_token
10
+ self.slack_channel = slack_channel
11
11
 
12
- client = WebClient(token=slack_token)
12
+ async def notify(self, device_id: str, event_type: str, value: int) -> None:
13
+ client = WebClient(token=self.slack_token)
13
14
 
14
15
  log_debug(f'Posting {event_type} event to Slack for device {device_id}: {value}')
15
16
 
16
- client.chat_postMessage(channel=slack_channel, text=f'Device {device_id} reported {event_type} with value {value}.')
17
+ client.chat_postMessage(channel=self.slack_channel, text=f'Device {device_id} reported {event_type} with value {value}.')