semvec/pypi-packages huggingface dataset:
pycoolmasternet 0.2.0
Lightweight Python API for CoolMasterNet HVAC bridges
License: MIT
Keywords: hvac homeautomation

pycoolmasternet
===============
A Python 3 library for interacting with a CoolMasterNet_ HVAC bridge.

.. _CoolMasterNet: https://coolautomation.com/products/coolmasternet/

Installation
------------
`pip install pycoolmasternet`

Or you can get the code from `https://github.com/koreth/pycoolmasternet`

Usage
-----

.. code-block:: python

    from pycoolmasternet import CoolMasterNet

    # Supply the IP address and optional port number (default 10102).
    #
    # By default, properties will be refreshed by querying the device
    # if last refresh was more than 1 second ago; pass auto_update=False
    # to disable that behavior (in which case you will need to call
    # update_status() explicitly).
    cool = CoolMasterNet('192.168.0.123', port=12345, auto_update=False)

    # Returns a list of CoolMasterDevice objects
    devices = cool.devices()

    # Device's unit ID on the CoolMasterNet bridge, e.g., "L7.001"
    device.uid

    # Temperature unit: imperial, celsius
    device.unit

    # Current reading of device's thermometer
    device.temperature

    # Current setting of device's thermostat
    device.thermostat
    device.set_thermostat(28)

    # True if device is turned on
    device.is_on
    device.turn_on()
    device.turn_off()

    # Fan speed: low, med, high
    device.fan_speed
    device.set_fan_speed('med')

    # Mode of operation: auto, cool, dry, fan, heat
    device.mode
    device.set_mode('cool')

    # Swing mode: horizontal, vertical, auto, 30, 45, 60, stop
    # Numeric settings are degrees of louver tilt. On read, the property can
    # be None if the bridge reports that the device doesn't support swing.
    device.swing
    device.set_swing('30')

    # Dict with all the properties listed above
    device.status

    # Force refresh of status (by default, device auto-updates its status
    # if most recent update is more than 1 second ago)
    device.update_status()

License
-------
This code is released under the MIT license.
Flask2Neo4J 0.1a1
Extension Flask for integration with neo4j graph database
License: MIT

# Flask2Neo4J
Extension Flask for integration with neo4j graph database

## Installation

Using pip:

```
$ pip install flask2neo4j
```

## Usage

Basic Step to usage this extension:

1. Create Flask app instance:

```
import bcrypt
from py2neo import ogm
from flask import Flask, request
from flask2neo4j import Flask2Neo4J


app = Flask(__name__)

```

2. Add NEO4J Config and Initialization Flask2Neo4j Extensions:
```

app.config["NEO4J_USERNAME"] = "neo4j"
app.config["NEO4J_PASSWORD"] = "neo4j"
app.config["NEO4J_URI"] = "bolt://localhost:7687"

flask2neo = Flask2Neo4J()

flask2neo.init_app(app)

```

3. Create Model using Graph Object if using GraphObject

```
class Users(ogm.GraphObject):
    __primarykey__ = "id"

    id = ogm.Property()
    username = ogm.Property("username")
    password = ogm.Property("password")

    def create_password(self, password):
        self.password = str(bcrypt.encrypt(password))

    @property
    def is_exist(self):
        return flask2neo.graph.exists(self)

    def save(self):
        if self.is_exist:
            flask2neo.graph.merge(self)
            flask2neo.graph.push(self)
        else:
            flask2neo.graph.create(self)
```
4. Define function register as flask request method ```POST```
```
@app.route("/register", methods=["POST"])
def register():
    form = request.form
    user = Users()

    user.username = form['username']
    user.create_password(form['password'])
    user.save()
    return "User Created"

```

5. Run flask app
```
if __name__ == '__main__':
    app.run(port=8500, debug=True)
```


Open your browser and type into url : ```http://localhost:8500```