/homewizard-openapi

OpenAPI implementation of the Homewizard API in Python

Primary LanguagePython

hwe

With the HomeWizard Energy platform, you can get insights in your energy usage. Use the HomeWizard Wi-Fi P1 meter to access real-time data directly from your smart meter, the HomeWizard Wi-Fi Energy Socket to get energy insights from all your devices, the HomeWizard Wi-Fi kWh meter to measure devices such as solar panels and the HomeWizard Wi-Fi Watermeter to get insight in your water usage. With the open API you can integrate the data directly into your system of choice.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: v1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >=3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import hwe

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import hwe

Getting Started

Please follow the installation procedure and then run the following:

import time
import hwe
from pprint import pprint
from hwe.api import homewizard_api
from hwe.model.api_v1_data_get200_response import ApiV1DataGet200Response
from hwe.model.basic import Basic
from hwe.model.error import Error
from hwe.model.socket_state import SocketState
# Defining the host is optional and defaults to http://192.168.44.75
# See configuration.py for a list of all supported configuration parameters.
configuration = hwe.Configuration(
    host = "http://192.168.44.75"
)



# Enter a context with an instance of the API client
with hwe.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = homewizard_api.HomewizardApi(api_client)

    try:
        # Basic information
        api_response = api_instance.api_get()
        pprint(api_response)
    except hwe.ApiException as e:
        print("Exception when calling HomewizardApi->api_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://192.168.44.75

Class Method HTTP request Description
HomewizardApi api_get GET /api Basic information
HomewizardApi api_v1_data_get GET /api/v1/data Recent measurement
HomewizardApi api_v1_state_get GET /api/v1/state Actual State
HomewizardApi api_v1_telegram_get GET /api/v1/telegram Recent telegram
HomewizardApi control_state PUT /api/v1/state Control State

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

Peter Oostewechel

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in hwe.apis and hwe.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from hwe.api.default_api import DefaultApi
  • from hwe.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import hwe
from hwe.apis import *
from hwe.models import *

Development

To generate the API from the open-api-definition openapi-generator-cli can be used.

npm install @openapitools/openapi-generator-cli -g

To generate the API use:

openapi-generator-cli generate -i open-api-definition/hwe-api.yaml -g python --package-name hwe