GithubHelp home page GithubHelp logo

Comments (3)

Krolken avatar Krolken commented on May 29, 2024

Hi

It seems your meter is using protocol mode A instead of C, that I have focused this library on so far.

In protocol mode A there is no baudrate switching so everything is still on 300 baud and the data is returned directly after the init request is send.

But you should be able to use the public functions of the client to read the data properly.

client.send_init_request() 
identification = client.read_identification() # Read the first line as the identification
data = client.read_response()  # Reads the data response 

from iec62056-21.

hadahop avatar hadahop commented on May 29, 2024

@Krolken
Thanks for your information, now it is working 👍

#!/usr/bin/python3

from iec62056_21.client import Iec6205621Client
import logging

# set up logging so you get a bit nicer printout of what is happening.
logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s,%(msecs)d %(levelname)s: %(message)s",
    datefmt="%H:%M:%S",
)

client = Iec6205621Client.with_serial_transport(port='/dev/ttyUSB0')
client.connect()

client.send_init_request()
identification = client.read_identification() # Read the first line as the identification
data = client.read_response()  # Reads the data response

Results:
same as response = ser.readline()...

16:18:27,247 DEBUG: Received 
b'\x020.9.1(161710)\r\n
0.9.2(1200707)\r\n
0.0.0(00339188)\r\n
0.2.0(1.03)\r\n
C.1.6(FDF5)\r\n
1.8.1(0011414.755*kWh)\r\n
1.8.2(0023842.912*kWh)\r\n
2.8.1(0015660.611*kWh)\r\n
2.8.2(0000909.192*kWh)\r\n
F.F.0(0000000)\r\n
!\r\n\
x03=' over transport: SerialTransport

from iec62056-21.

Krolken avatar Krolken commented on May 29, 2024

great :)

Use the .data on the AnswerResponse to get a list of all DataSets.

So data.data in your code.

from iec62056-21.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.