Skip to content
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

Gateways: Confusing output for list_devices_for_gateway #1997

Closed
stevebriskin opened this issue Feb 5, 2019 · 3 comments
Closed

Gateways: Confusing output for list_devices_for_gateway #1997

stevebriskin opened this issue Feb 5, 2019 · 3 comments
Assignees

Comments

@stevebriskin
Copy link

The list_devices_for_gateway function in gateway/gateway.py has a loop that isn't exercised which results in confusing output. There is no 'deviceNumIds' key in the devices dict .

In this example 'my-node-device' is bound to gateway 'testgateway'

$ python gateway.py --service_account_json XYZ.json --registry_id=my-registry --device_id=null --gateway_id=testgateway --project_id=myproject list_devices_for_gateway
Device: 2587394384972593 : my-node-device
No devices bound to gateway testgateway

The dict at devices dict is missing 'deviceNumIds'

{u'devices': [{u'numId': u'2587394384972593', u'id': u'my-node-device'}]}
@gguuss
Copy link
Contributor

gguuss commented Jun 12, 2019

Thanks for the heads up, what version of Python are you using? I just tested the sample and I'm seeing the following output for a gateway with no bound devices:?

No devices bound to gateway jah

A gateway with one bound device renders as:

Device: 2658882084459077 : alpha

A gateway with two bound devices renders as:

Device: 2658882084459077 : alpha
Device: 2765886308686097 : bleep

@gguuss
Copy link
Contributor

gguuss commented Jun 12, 2019

I see what you're saying though, I'm not sure what conditions the sample is trying to resolve with the second loop or why/when the deviceNumIds dict would be populated. I'll take another look later on.

@gguuss
Copy link
Contributor

gguuss commented Aug 7, 2019

Resolved in this PR. As you pointed out, the initial check for deviceNumIds would never be reached.

@gguuss gguuss closed this as completed Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants