semvec/pypi-packages huggingface dataset:
eques-elf 0.0.2
Eques Elf support for Python
Keywords: eques elf,smart plug,iot,home assistant,hass

# Eques Elf python

Kudos to iamckn who has in-depth posts describing their work reverse engineering
the Eques Elf smart plug devices and has gocode alongside it, at https://github.com/iamckn/eques

This module is adapted from it to provide a Python module to be used in
HomeAssistant.

## Command line usage

See helpdoc for specific details.

### List devices

```sh
python src/main.py discover
```

```json
[
  {
    "ip": "10.0.0.123",
    "mac": "dc-4f-22-25-ab-cd",
    "password": "foobar",
    "state": true
  }
]
```

### Get status

```sh
python src/main.py send --cmd status --mac dc-4f-22-25-ab-cd --ip 10.0.0.123 --password foobar
```

```json
[
  {
    "ip": "10.0.0.123",
    "mac": "dc-4f-22-25-ab-cd",
    "password": "foobar",
    "state": true
  }
]
```

### Toggle device

_Toggle first fetches state (cmd: status) then sends a set command._

```sh
python src/main.py send --cmd toggle --mac dc-4f-22-25-ab-cd --ip 10.0.0.123 --password foobar
```

```json
[
  {
    "ip": "10.0.0.123",
    "mac": "dc-4f-22-25-ab-cd",
    "password": "foobar",
    "state": false
  }
]
```

### Set device on

```sh
python src/main.py send --cmd set_on --mac dc-4f-22-25-ab-cd --ip 10.0.0.123 --password foobar
```

```json
[
  {
    "ip": "10.0.0.123",
    "mac": "dc-4f-22-25-ab-cd",
    "password": "foobar",
    "state": false
  }
]
```

### Set device off

```sh
python src/main.py send --cmd set_off --mac dc-4f-22-25-ab-cd --ip 10.0.0.123 --password foobar
```

```json
[
  {
    "ip": "10.0.0.123",
    "mac": "dc-4f-22-25-ab-cd",
    "password": "foobar",
    "state": false
  }
]
```

## API

See `eques_local.py` and use:

- `discover_command`
- `status_command`
- `off_command`
- `on_command`

`device.Device` is used for carrying the device data.
redbase 0.0.0
Repository Patterns for Python
Requires Python: >=3.6.0


# Red Base: Repository Patterns for Python
> Generic database implemetation for SQL, MongoDB and in-memory lists

NOTE: Experimential.

## Examples

```python

class Person(BaseModel):
    id: str
    name: str
    age: int

```

### Creating

```python
>>> repo = Repository()

# Add some items
>>> repo.add(Person(id="11-11-11", name="Jack", age=30, language="English"))
>>> repo.add(Person(id="22-22-22", name="John", age=33, language="English"))
>>> repo.add(Person(id="33-33-33", name="James", age=36, language="English"))
>>> repo.add(Person(id="44-44-44", name="Jaakko", age=40, language="Finnish"))
```

### Reading

```python
# Get an item
>>> repo["11-11-11"]
Person(id="11-11-11", name="Jack", age=30, language="English")

>>> # Filter items
>>> repo.filter_by(language="English").all()
[Person(id="11-11-11", name="Jack", age=30, language="English"),
 Person(id="22-22-22", name="John", age=33, language="English"),
 Person(id="33-33-33", name="James", age=36, language="English")]

>>> # Get first
>>> repo.filter_by(language="English").first()
Person(id="11-11-11", name="Jack", age=30, language="English")

>>> # Get last
>>> repo.filter_by(language="English").last()
Person(id="33-33-33", name="John", age=33, language="English")

>>> # Get first 2
>>> repo.filter_by(language="English").limit(2)
[Person(id="11-11-11", name="Jack", age=30, language="English"),
 Person(id="22-22-22", name="John", age=33, language="English")]

>>> # Use operations
>>> from redbase.operations import greater_than
>>> repo.filter_by(age=greater_than(35)).all()
[Person(id="33-33-33", name="James", age=36, language="English"),
 Person(id="44-44-44", name="Jaakko", age=40, language="Finnish")]
```

### Updating
```python

>>> # Update single item
>>> person = repo["44-44-44"]
>>> person.age = 50
>>> repo.update(person)

>>> # Update multiple items
>>> repo.filter_by(language="English").update(age=35)
```

### Deleting
```python

>>> # Delete single item
>>> del repo["44-44-44"]

>>> # Delete multiple items
>>> repo.filter_by(language="English").delete()
```

## Author

* **Mikael Koli** - [Miksus](https://github.com/Miksus) - koli.mikael@gmail.com