Announcement

Collapse
No announcement yet.

Two different command topics for one device

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Two different command topics for one device

    I've recently switched from Jon00's awesome computer monitor to using Iotlink to monitor my personal PC as well as some other's on my network. It offers limited control which is all I really need. Turning my monitor on and off however, takes two different control topics, iotlink/rmiles-pc/commands/displays/on and iotlink/rmiles-pc/commands/displays/off with the payload of both being ""

    I already have an existing HS device that I was using to turn on and off the monitor using Jon00's stuff and Eventghost but would like to use the same device with mcsMQTT. Is that possible? When I look through the docs at How do I control and existing HS Device I see that it gives me a place for one command topic and payload. Would also like to update the status but don't think it's possible with a non mcsMQTT plugin device, is that correct? If I go ahead and have mcsMQTT create a new HS device, is it possible to associate two different command topics with the same device?

    I've just been using events to send the mqtt messages when the status changes on HS end but of course that's one-directional.

    #2
    If your existing device has two VSP such as 0=off and 1=on then you can setup the pub topic to be iotlink/rmiles-pc/commands/displays/$$LABEL:. This would replace the two events that you now have setup. This is not required, but just suggesting an alternate approach. The essence of the question, however, is show to deal with the status showing up in HS.

    I did not see a description of what topic(s) are being returned by iotloink to report status. If is is a single topic for both states then just "A"ssociate the existing HS Device (pink association table) with this subscription topic. Continue to send the two control messages with event actions.

    If the status is retuned like the control where the payload is not used, but the last message reflects the status such as iotlink/rmiles-pc/status/displays/on iotlink/rmiles-pc/status/displays/off then you will want to have two subscription topics mapped into the same HS device. It may be possible to use the same Ref as the existing HS device, but my guess is that mcsMQTT may not support it. The scenario in the case that it does is to setup the existing HS device with sub topic of iotlink/rmiles-pc/status/displays/on and a blank pub topic. On the Asssociation tab for plugin devices enter the same Ref in the row for iotlink/rmiles-pc/status/displays/off. Do not setup a pub topic for it so it will be a status-only device. If the payload is blank on the status for both status messages then use the Expression text box on the Edit tab to put the status you want to see in HS for each of the two topics. e.g. "on" in one and "off" in the other.

    Having the same Ref for a plugin device and non-plugin device could be an issue. The same scenario as described above, but having the same plugin Ref for two sub topics. The first status topic would generate this Ref when "A"ssociated. In this scenario you would not be using the existing HS device.

    The above descriptions provide an approach that have not been evaluated, but should give you some ideas.



    Comment

    Working...
    X