,

A Comprehensive Guide for Python Developers

Blake Bradford Avatar

·

Accessing Enedis SGE SOAP Web-Services with lowatt-enedis: A Comprehensive Guide for Python Developers

Enedis provides SOAP web-services that allow users to interact with their SGE services. lowatt-enedis, developed by LOWATT, is a command-line tool and Python library that provides convenient access to these Enedis web-services.

Disclaimer: Please note that lowatt-enedis is an independent package developed by LOWATT and is not affiliated with Enedis. It is provided as a useful tool for users of Enedis SGE web-services.

Installation

To get started with lowatt-enedis, you can install it using pip:

bash
pip install lowatt-enedis

Command Line Usage

lowatt-enedis offers a command-line interface (CLI) for accessing Enedis web-services. You can use the CLI to call services and view the SOAP responses. To see the available options and usage instructions, run the following command:

bash
lowatt-enedis --help

Certain flags are required for most commands and can be configured using environment variables. Here are the available options and their respective environment variables:

| Option | Environment Variable |
|—————-|———————-|
| --cert-file | ENEDIS_CERT_FILE |
| --key-file | ENEDIS_KEY_FILE |
| --login | ENEDIS_LOGIN |
| --contrat | ENEDIS_CONTRAT |

Python Library Usage

The lowatt-enedis Python library provides a convenient way to access Enedis web-services from your Python code. Here is a sample code snippet illustrating how to access the ConsultationMesuresDetaillees service:

“`python
import datetime
import lowatt_enedis
import lowatt_enedis.services

config = {
‘login’: ‘you@example.com’,
‘certificateFile’: ‘fullchain.pem’,
‘keyFile’: ‘privkey.pem’,
‘prm’: ‘30000123456789’,
}

Get the client for the ‘details’ service using the appropriate client certificate and key

client = lowatt_enedis.get_client(
lowatt_enedis.COMMAND_SERVICE[‘details’][0],
config[‘certificateFile’], config[‘keyFile’],
)

Call the web-service to get values for the past week

resp = lowatt_enedis.services.point_detailed_measures(client, {
‘login’: config[‘login’],
‘prm’: config[‘prm’],
‘type’: ‘COURBE’,
‘courbe_type’: ‘PA’,
‘corrigee’: True,
‘from’: datetime.date.today() – datetime.timedelta(days=7),
‘to’: datetime.date.today(),
})

Get a list of (UTC timestamp, value(W))

data = lowatt_enedis.services.measures_resp2py(resp)
“`

Contributions

Contributions to lowatt-enedis are welcome and can be made through the GitHub repository. Feel free to reach out to the team at info@lowatt.fr for more information.

Sponsors

We would like to acknowledge and thank QosEnergy for their sponsorship and support.

This comprehensive guide provides an overview of lowatt-enedis and how to leverage it to access Enedis SGE SOAP web-services. From installation to command-line usage and Python library integration, you now have the tools to interact with Enedis services efficiently. Feel free to explore the provided sample code and contribute to the project. If you have any questions or suggestions, please don’t hesitate to reach out.

Leave a Reply

Your email address will not be published. Required fields are marked *