Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
push:
branches:
- master

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PyCharm
.idea

.vscode
# Virtualenv
venv

Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# pyticcom - EDF teléinformation Python library
# pytictri - EDF teléinformation Python library

[![PyPI version](https://badge.fury.io/py/pyticcom.svg)](https://badge.fury.io/py/pyticcom)
[![PyPI version](https://badge.fury.io/py/pytictri.svg)](https://badge.fury.io/py/pytictri)

This library allows you to retrieve teleinfo using serial port device (USBTICLCV2).

This library is a fork from pyticcom project. It adds three phases counter compatibility.

### Example

~~~
from pyticcom import Teleinfo, TeleinfoMode
from pytictri import Teleinfo, Mode

with Teleinfo('/dev/tty.usbserial-DA4Y56SG', mode=TeleinfoMode.HISTORY) as teleinfo:
with Teleinfo('/dev/tty.usbserial-DA4Y56SG', mode=Mode.HISTORY) as teleinfo:

frame = teleinfo.read_frame()
print(frame.get("PAPP"))
~~~
~~~
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from time import sleep

from pyticcom import Teleinfo, Mode, list_available_serials
from pytictri import Teleinfo, Mode, list_available_serials

with Teleinfo('/dev/ttyUSB', mode=Mode.HISTORY) as tr:
devices = list_available_serials()
Expand Down
17 changes: 0 additions & 17 deletions pyticcom/const.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyticcom/__init__.py → pytictri/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .teleinfo import *

__version__ = "1.1"
__version__ = "2.0.4"
25 changes: 25 additions & 0 deletions pytictri/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ADCO_DESCRIPTION = "Adresse du compteur ADCO"
OPTARIF_DESCRIPTION = "Option tarifaire choisie"
ISOUSC_DESCRIPTION = "Intensité souscrite"
BASE_DESCRIPTION = "Index Base"
HCHC_DESCRIPTION = "Index Heures Creuses"
HCHP_DESCRIPTION = "Index Heures Pleines"
PTEC_DESCRIPTION = "Période Tarifaire en cours "
IINST_DESCRIPTION = "Intensité Instantanée"
IINST1_DESCRIPTION = "Courant efficace phase 1 (A)"
IINST2_DESCRIPTION = "Courant efficace phase 2 (A)"
IINST3_DESCRIPTION = "Courant efficace phase 3 (A)"
IMAX_DESCRIPTION = "Intensité maximale appelée"
IMAX1_DESCRIPTION = "Courant max phase 1 (A), toujours 60A en triphasé"
IMAX2_DESCRIPTION = "Courant max phase 2 (A), toujours 60A en triphasé"
IMAX3_DESCRIPTION = "Courant max phase 3 (A), toujours 60A en triphasé"
PMAX_DESCRIPTION = "Puissance maximale triphasée atteinte, valeur du jour n-1"
PAPP_DESCRIPTION = "Puissance apparente"
HHPHC_DESCRIPTION = "Horaire Heures Pleines Heures Creuses"
MOTDETAT_DESCRIPTION = "Mot d'état du compteur MOTDETAT"
PPOT_DESCRIPTION = "Présence des potentiels, 0X le X reflétant les coupures de phase selon la règle suivante: absence de la phase n -> bit n = 1"

UNIT_NONE = ""
UNIT_VA = "VA"
UNIT_WH = "Wh"
UNIT_A = "A"
2 changes: 1 addition & 1 deletion pyticcom/scanner.py → pytictri/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def find_serial(self, name):

def scan(self):
"""Check if a serial port is available."""
return list_ports.comports()
return list_ports.comports()
20 changes: 15 additions & 5 deletions pyticcom/teleinfo.py → pytictri/teleinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import serial
from serial import PARITY_EVEN, STOPBITS_ONE

from pyticcom.const import ADCO_DESCRIPTION, OPTARIF_DESCRIPTION, ISOUSC_DESCRIPTION, UNIT_A, UNIT_WH, UNIT_VA, UNIT_NONE, \
from pytictri.const import ADCO_DESCRIPTION, OPTARIF_DESCRIPTION, ISOUSC_DESCRIPTION, UNIT_A, UNIT_WH, UNIT_VA, UNIT_NONE, \
BASE_DESCRIPTION, HCHC_DESCRIPTION, HCHP_DESCRIPTION, PTEC_DESCRIPTION, IINST_DESCRIPTION, IMAX_DESCRIPTION, \
PAPP_DESCRIPTION, HHPHC_DESCRIPTION, MOTDETAT_DESCRIPTION
PAPP_DESCRIPTION, HHPHC_DESCRIPTION, MOTDETAT_DESCRIPTION, \
IINST1_DESCRIPTION, IINST2_DESCRIPTION, IINST3_DESCRIPTION, IMAX1_DESCRIPTION, IMAX2_DESCRIPTION, IMAX3_DESCRIPTION, \
PMAX_DESCRIPTION, PPOT_DESCRIPTION

LOGGER = logging.getLogger(__name__)

Expand All @@ -21,11 +23,19 @@ class GroupInfo(enum.Enum):
HCHC = (HCHC_DESCRIPTION, UNIT_WH)
HCHP = (HCHP_DESCRIPTION, UNIT_WH)
PTEC = (PTEC_DESCRIPTION)
IINST = (IINST_DESCRIPTION, UNIT_WH)
IINST = (IINST_DESCRIPTION, UNIT_A)
IINST1 = (IINST1_DESCRIPTION, UNIT_A)
IINST2 = (IINST2_DESCRIPTION, UNIT_A)
IINST3 = (IINST3_DESCRIPTION, UNIT_A)
IMAX = (IMAX_DESCRIPTION, UNIT_A)
IMAX1 = (IMAX1_DESCRIPTION, UNIT_A)
IMAX2 = (IMAX2_DESCRIPTION, UNIT_A)
IMAX3 = (IMAX3_DESCRIPTION, UNIT_A)
PMAX = (PMAX_DESCRIPTION, UNIT_VA)
PAPP = (PAPP_DESCRIPTION, UNIT_VA)
HHPHC = (HHPHC_DESCRIPTION)
MOTDETAT = (MOTDETAT_DESCRIPTION)
PPOT = (PPOT_DESCRIPTION)

def __init__(self, description, unit = UNIT_NONE):
self._description = description
Expand Down Expand Up @@ -71,7 +81,7 @@ def __init__(self):
def get(self, group_info:GroupInfo):
"""Get group by label."""
for group in self.groups:
if group.info == group_info:
if group.info.name == group_info:
return group
return None

Expand Down Expand Up @@ -182,4 +192,4 @@ def __enter__(self):

def __exit__(self, type, value, traceback):
"""Make sure reader is closed."""
self.close()
self.close()
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ def find_version(*file_paths):
long_description = f.read()

setup(
name='pyticcom',
version=find_version("pyticcom", "__init__.py"),
name='pytictri',
version=find_version("pytictri", "__init__.py"),
packages=find_packages(),
description='Teleinfo python library',
description='Teleinfo tri python library',
long_description=long_description,
long_description_content_type='text/markdown',
install_requires=['requests>=2'],
license='GPL-3',
include_package_data=True,
url='https://github.com/biker91620/pyticcom/tree/master',
author='biker91620',
url='https://github.com/biker91620/pytictri/tree/master',
author='benblrm',
classifiers=[
'Programming Language :: Python',
'Development Status :: 5 - Production/Stable',
Expand All @@ -55,11 +55,12 @@ def find_version(*file_paths):
],
keywords=[
'rest',
'pytictri',
'pyticcom',
'linky',
'tic',
'io',
'smart-things',
'iot'
],
)
)