ieeefloat32 parsing
If a bytes_val is received, TelemetryParser is not displaying/parsing it. I've added the following code and it works fine. Is it ok to integrate?
diff --git a/pygnmi/client.py b/pygnmi/client.py
index de2abf3..a2cff8d 100644
--- a/pygnmi/client.py
+++ b/pygnmi/client.py
@@ -13,6 +13,7 @@ import os
from typing import Any
import cryptography
import grpc
+import struct
from pygnmi.spec.v080.gnmi_pb2_grpc import gNMIStub
from pygnmi.spec.v080.gnmi_pb2 import (CapabilityRequest, Encoding, GetRequest,\
SetRequest, Subscription, Update, TypedValue, SubscribeRequest, Poll, SubscriptionList,\
@@ -456,6 +457,12 @@ class gNMIclient(object):
elif update_msg.val.HasField('proto_bytes'):
update_container.update({'val': update_msg.val.proto_bytes})
+ elif update_msg.val.HasField('bytes_val'):
+ val_binary = ''.join(format(byte, '08b') for byte in update_msg.val.bytes_val)
+ val_decimal = struct.unpack("f", struct.pack("I", int(binary, 2)))[0]
+ update_container.update({'val': val_decimal})
+
+
notification_container['update'].append(update_container)
response['notification'].append(notification_container)
Hello @brunoonovais ,
looks good for me. Could you please submit PR?
Thanks, Anton
looks like i don't have permissions to push to the repository yet:
bnovais@bnovais pygnmi % git push --set-upstream origin issue_110 ERROR: Permission to akarneliuk/pygnmi.git denied to brunoonovais. fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists. bnovais@bnovais pygnmi %
Hello @brunoonovais , sorry, it appears it took a while for me to find that this message, sorry about it. I've added you as a collaborator. Best, Anton
oops sorry @akarneliuk , i could not get to it. do you mind sending the invitation again, please?
Hey @brunoonovais , is that still to be done?
Yes, Anton! :)
On Sun, Oct 29, 2023 at 12:55 Anton Karneliuk @.***> wrote:
Hey @brunoonovais https://github.com/brunoonovais , is that still to be done?
— Reply to this email directly, view it on GitHub https://github.com/akarneliuk/pygnmi/issues/110#issuecomment-1784166300, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKG3BBCOKAMQTMWOWO3QSP3YBZ373AVCNFSM6AAAAAAT7KECXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGE3DMMZQGA . You are receiving this because you were mentioned.Message ID: @.***>
@brunoonovais , in that case, please check your mail now, you shall have invitation:
thanks! will generate a PR today for it.
On Sun, Oct 29, 2023 at 1:50 PM Anton Karneliuk @.***> wrote:
@brunoonovais https://github.com/brunoonovais , in that case, please check your mail now, you shall have invitation:
— Reply to this email directly, view it on GitHub https://github.com/akarneliuk/pygnmi/issues/110#issuecomment-1784181418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKG3BBEIP5DGZ7CEUWTYCZDYB2CPHAVCNFSM6AAAAAAT7KECXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGE4DCNBRHA . You are receiving this because you were mentioned.Message ID: @.***>
Hey @brunoonovais , was that ever implemented, mate?
Closed as stale