-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_single_value #13
Comments
Or maybe it's easier to parse response from read_standard_readout function and find data ? |
I use different strategies depending on how much the data costs. If cost and bandwidth isn't a problem I just do standard readout since I don't have to change much afterwards. Lots of MNOs also charge you in incremental steps for each session. So if you pay at least for 1 kB for every session you might as well read all of it. Seems like you are using the LP-1 with Wifi? So I would just read the standard readout. |
im using LP-1 with Ethernet. How should i parse standard readout to get single data (1.8.0?) what kind of type is AnswerDataMessage ? |
Simplest thing would be to use the data property of
Data sets consists of address, value and unit. See iec62056-21/iec62056_21/messages.py Line 43 in 09d9acf
So if you only need one element search the list for it and if you think you need more values you can for example create a mapping using dict with the address as key and then just look up by address. |
Closing this since it seems done. If there is anything else just open it again. |
Hi
i cant read single value from meter.
Function read_standard_readout works but i get huge amount of data.
i would like to get only one value eq. (1.8.0)
my code:
`#!/usr/bin/python3
from iec62056_21.client import Iec6205621Client
import logging
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s,%(msecs)d %(levelname)s: %(message)s",
datefmt="%H:%M:%S",
)
client = Iec6205621Client.with_tcp_transport(address=('192.168.200.123', 2222), device_address='035 0000101', password='00000000')
client.connect()
password_challange = client.access_programming_mode()
client.send_password('00000000') # Common standard password
data_answer = client.read_value('1.8.0')
print(data_answer)`
output:
20:30:10,157 DEBUG: Connecting to ('192.168.200.123', 2222) 20:30:10,157 INFO: Staring init sequence 20:30:10,157 INFO: Sending request message: RequestMessage(device_address='035 0000101') 20:30:10,158 DEBUG: Sent b'/?035 0000101!\r\n' over transport: TcpTransport 20:30:10,158 DEBUG: Resting for 0.25 seconds 20:30:11,294 DEBUG: Received b'/POZ4LP1-VP02.04*\r\n' over transport: TcpTransport 20:30:11,294 INFO: Received identification message: IdentificationMessage(identification='P1-VP02.04*', manufacturer='POZ', switchover_baudrate_char='4') 20:30:11,295 INFO: Sending AckOptionsSelect message: AckOptionSelectMessage(baud_char='4', mode_char='1') 20:30:11,295 DEBUG: Sent b'\x06041\r\n' over transport: TcpTransport 20:30:11,295 DEBUG: Resting for 0.25 seconds 20:30:11,546 DEBUG: Received b'\x01P0\x02(0000)\x03
' over transport: TcpTransportTraceback (most recent call last):
File "./iec_net.py", line 26, in
client.send_password('00000000') # Common standard password
File "/home/pi/.local/lib/python3.7/site-packages/iec62056_21/client.py", line 193, in send_password
data_set = messages.DataSet(value=_pw)
TypeError: init() missing 1 required positional argument: 'address'
`
The text was updated successfully, but these errors were encountered: