Skip to content

Commit

Permalink
baseconfig by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Mips2648 committed Apr 26, 2024
1 parent 3342c37 commit 593d0e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

## Description

This library provide everything is needed to build a daemon for a plugin for Jeedom in python.
This library provide everything needed to build a daemon for a plugin for Jeedom in python.
It's possible to get a daemon skeleton by typing literally less than 5 lines of code.

## Requirements

Expand Down Expand Up @@ -40,5 +41,20 @@ pip3 install jeedomdaemon
### Via requirements.txt

```txt
jeedomdaemon~=0.7
jeedomdaemon~=0.7.3
```

## Create a daemon skeleton

Create a file `myDaemon.py` and copy/past the 4 lines of code below and that's it, nothing else to do, your daemon is good to start.

```python
from jeedomdaemon.base_daemon import BaseDaemon

class myDaemon(BaseDaemon):
pass

myDaemon().run()
```

Of course, this does nothing so far except starting, accepting incoming requests from your php code and stopping when it is needed.
2 changes: 1 addition & 1 deletion jeedomdaemon/base_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class BaseDaemon:
"""Base daemon class"""
def __init__(self,
config: BaseConfig,
config: BaseConfig = BaseConfig(),
on_start_cb: Callable[...,Awaitable[None]] | None = None,
on_message_cb: Callable[[list], Awaitable[None]] | None = None,
on_stop_cb: Callable[..., None] | None = None,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Needed for dependencies
install_requires=['aiohttp'],
# *strongly* suggested for sharing
version='0.7.2',
version='0.7.3',
# The license can be anything you like
license='MIT',
description='A base to implement Jeedom daemon in python',
Expand Down

0 comments on commit 593d0e2

Please sign in to comment.