semvec/pypi-packages huggingface dataset:
tb-vendor 0.12.0
Thingsboard and vendor integrations
Requires Python: >=3.8

# Thingsboard vendor integrations

Create a generic package with utilities to integrate Thingsboards and vendors.

## Thingsboard Issues

Thingsboard Python SDK has a client for PE and other for CE.

## Examples

```python
import logging

from tb_vendor.models import TbVirtualDevice
from tb_vendor.mqtt.callbacks import OnMessageHandler
from tb_vendor.mqtt.parsers import RpcParserBase, AttributeParserBase
from tb_vendor.mqtt import clients as tb_clients

logger = logging.getLogger(__name__)

device_access_token = "access-token"
device_id = "0999e290-3c4f-11ee-8ff7-12785784c398"
# Connection settings
mqtt_keepalive = 60
mqtt_host = "broker-mqtt.example.com"
mqtt_port = 1883

# Create implementations

class MyRpcParser(RpcParserBase):
    def parse_message(self, client, topic, payload: dict, userdata: dict):
        logger.debug(f"payload: {payload}")
        # logger.debug(f"userdata: {userdata}")
        if payload["method"] == "getValue":
            self.rpc_response(client, topic, 7)


class MyAttributeParser(AttributeParserBase):
    def parse_message(self, payload: dict) -> None:
        logger.info(f"payload: {payload}")


# Configure MQTT

my_rpc_parser = MyRpcParser()
my_attribute_parser = MyAttributeParser()
on_message_hanlder = OnMessageHandler(my_rpc_parser, my_attribute_parser)
tb_device_handler = tb_clients.TbDeviceMqttHandler()

# Add custom user data (MQTT userdata)
user_data = {
    "vendor_id": "1000",
    "access_token": device_access_token,
    "device_id": device_id,
}
device = TbVirtualDevice(
    device_id=device_id,
    access_token=device_access_token,
    dtype="GENERIC",
    name="Test Device",
)
conn = tb_clients.TbMqttConnection(
    host=mqtt_host, port=mqtt_port, keepalive=mqtt_keepalive
)

conn.configure_client(
    on_message=on_message_hanlder.callback, userdata=user_data, client_id=device_id
)
conn.add_access_token(device_access_token)
client = conn.mqtt_client
conn.connect_blocking()
```

## Breaking changes

- 050: wait_to_login has moved and named login_wait
- 060: move validate_login
cal-plusplus 1.0.0
A cal replacement that includes working days
Requires Python: >=3.7

# cal-plusplus

`cal-plusplus` displays a calendar on your command line with [`workalendar`][workalendar] integration for showing working days.

![CLI output from the updated cal command showing weekends and public holidays in a lighter colour to regular weekdays](example.png)

### Installation

Install with pip:

```
pip install --user cal-plusplus
```


### Usage

Display current year, attempt to detect your region (it will be displayed in the title):

```
cal
```

Specify calendar from `workalendar` to use:

```
cal --calendar=AU-VIC
```

Alternatively you can set the `CALPLUSPLUS` environment variable to the name of the calendar you would like to use.

Specify a year to display a calendar for:

```
cal 2024
```

Output a list of valid calendars:

```
cal --show-calendars
```


  [workalendar]: https://github.com/workalendar/workalendar