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

Add MQTT/cmd line command for getting device list #84

Closed
DCandE opened this issue Sep 12, 2018 · 3 comments
Closed

Add MQTT/cmd line command for getting device list #84

DCandE opened this issue Sep 12, 2018 · 3 comments

Comments

@DCandE
Copy link
Contributor

DCandE commented Sep 12, 2018

When I issue the refresh all command via the command line I get an output in mqtt with the output insteon/command/+/+/# but when I initiate it via the mqtt command I don't get the same output. I was hoping to be able to build some logic into node red to parse the device list.

@TD22057
Copy link
Owner

TD22057 commented Sep 12, 2018

You can do that, but you need to read the code to see what it's doing. Look at cmd_line/device.py and util.py to see how they work. The send() command in util adds a session ID to the MQTT message (which you will see if you subscribe to all and watch them) and then it subscribes to a session topic to get messages back. The server sees the session ID and sends the "output" messages to that topic so the command line tool can display them.

NOTE: I don't consider these output messages to part of the API. They could change format and type in the future. If you want the device list, we should add a specific command to return it (which has nothing to do with refreshing anything. There could be commands to get specific things (device lists, device db's, device states, etc) that get returned as a JSON packet.

@TD22057 TD22057 changed the title Refresh-All command to mqtt Add MQTT/cmd line command for getting device list Sep 14, 2018
@TD22057
Copy link
Owner

TD22057 commented Dec 29, 2018

I have a command that will reply w/ the device list. Here is the current output.

Commanding Modem device 44.85.11 (modem) cmd=get_devices
{"44.85.11": {"label": "modem", "type": "modem"}}
{"3a.29.84": {"label": "lamp2", "type": "dimmer"}}
{"44.a3.79": {"label": "smoke alarm", "type": "smoke_bridge"}}
{"21.d6.d9": {"label": "door", "type": "motion"}}
{"37.2d.35": {"type": "unknown"}}
{"3f.07.d4": {"label": "remote1", "type": "mini_remote_8"}}
{"48.3d.46": {"label": null, "type": "dimmer"}}
{"46.7b.bc": {"label": "porch", "type": "keypad_linc"}}
{"48.b0.ad": {"label": "dim1", "type": "dimmer"}}
{"45.33.d4": {"label": "garage", "type": "io_linc"}}
{"3c.42.9b": {"label": "kp2", "type": "keypad_linc_sw"}}
Complete

I could try and add an option to remove the leading "commanding..." and trailing "complete" messages if that would make it easier to parse. Let me know.

@TD22057
Copy link
Owner

TD22057 commented Feb 5, 2019

Fixed per previous comment.

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

No branches or pull requests

2 participants