zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
982 stars 202 forks source link

[feat] Allow to get valueIds topics from UI #3621

Open spacemanspiff2007 opened 8 months ago

spacemanspiff2007 commented 8 months ago

Thank you for creating and maintaining zwave-js-ui. I am currently migration my zwave network and I am using MQTT. For topic type I use ValueID topics, Payload type is Just value and I disabled use node names instead of numeric nodeIDs. I've found that to be the easiest way to get the corresponding MQTT Topics from the information available in the UI. However for some nodes it's still really hard to get the corresponding MQTT message. E.g. grafik

Since the device does not regularly send this message it's impossible to capture it with the usual MQTT tools. Is there any way to get the topic for a value from the UI? Is it possible to "simulate" a random value for these topics so I can test my implementation in the receiving system?

I looked at the node json and the possible states are described there:

        "states": [
          {
            "text": "idle",
            "value": 0
          },
          {
            "text": "Over-current detected",
            "value": 6
          }
        ]

Would it be possible to expose this information in the UI? Maybe together with the topic information under a ? icon right next the to value title

duylong commented 8 months ago

You can get this information with MQTT. For example:

#/113/0/Heat_Alarm/Heat_sensor_status
robertsLando commented 8 months ago

@spacemanspiff2007 Sorry but I think I missed your question. You can find all the informations you need here: https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt

Expecially in order to get/set valueIds (when a value changes): https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt?id=set-values

The best tool for testing MQTT is MQTT Explorer: https://mqtt-explorer.com/

@duylong the topic #/113/0/Heat_Alarm/Heat_sensor_status is just wroing because # is a wildecard that can only be set as suffix

duylong commented 8 months ago

@duylong the topic #/113/0/Heat_Alarm/Heat_sensor_status is just wroing because # is a wildecard that can only be set as suffix

Indeed, just a bad copy and paste, the prefix "zwave/" is of course missing.

spacemanspiff2007 commented 8 months ago

@spacemanspiff2007 Sorry but I think I missed your question. You can find all the informations you need here: https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt

No problem and thanks for the reply. I already use mqtt-explorer and and have no problems with getting/setting value. I think I have to rephrase my question: If I look at the values, how do I find out the corresponding topic where the value gets reported? For example the value (from the screenshot) 69-113-1-Power Management-Over-current status? With my settings I'd guess it's zwave/69/113/1/Power_Management/Over-current status - correct? Since the I am unable to make the device report an over current status I can not test under which topic the value gets sent (and which value the device would send). It would be tremendously helpful if there would be an option in the UI to show the mqtt topic for a value. That way I would not have to guess the topic. E.g. a small mqtt button which is only visible if the gateway function is enabled.

The second part of my question is: If I finally get the topic right sometimes the state is limited to certain values. For the above value the meaning is 0: idle and 6: over current (taken from the node.json). Where in the UI do I see that the value is limited to these states and where in the UI do I see the meaning of the value?

robertsLando commented 8 months ago

The mqtt topic of a specific value depends on the settings you are using, you can use valueId topic, use node names on numbers, different locations, custom valueId topics etc... this is why I was telling you to use mqtt explorer, with it's tree view it's quite easy to find all valueIds, generally you can use the valueId you see in the ui and that will be the part after the node topic (with the - replaced by /).

About the meaning of the values, if a configuration value have some defined states you will see them in the dropdown otherwise there should be a description telling you the meaning under the input. If it's not like that you can find informations on device manual

spacemanspiff2007 commented 8 months ago

this is why I was telling you to use mqtt explorer, with it's tree view it's quite easy to find all valueIds

This is what mqtt explorer is showing me for a full node interview.

grafik

How do I get the topic for the value 113? As you can see it is not there.


if a configuration value have some defined states you will see them in the dropdown

It's not a configuration value but a notification value. There is no tooltip and there is no information about it in the device manual. Obviously I want to react on the notification so it's important to know what values to expect and their meaning.

robertsLando commented 8 months ago

How do I get the topic for the value 113? As you can see it is not there.

You should firstly trigger a notification, based on what I remember notifications are not emitted with retain flag as them are considered stateless values. This means that you would not receive it on subscription like other value ids.

Anyway your topic should be: zwave/69/113/1/Power_Management/Over-current_status (you were missing a _ as all spaces chars are replaced with _)

spacemanspiff2007 commented 8 months ago

You should firstly trigger a notification

It's a notification for over-current, meaning the the load exceeds the device specifications. I'm hesitant to try to trigger a notification e.g. by short circuiting the device output because it might damage the device. So while for me it's impossible to create this notification I still want to make sure that I have the topic right. Do you understand now why and how this is difficult for the mqtt users?

Having a way in the UI to e.g. copy paste the mqtt topic would help tremendously.

This means that you would not receive it on subscription like other value ids.

I'm publishing everything with retain=false so this is a live screenshot after the node interview. If the device would have sent the value I should have seen it.

robertsLando commented 8 months ago

@spacemanspiff2007 I think this is a very unique case as for all other valueIds this wouldn't be a problem. Anyway I will taf this as a feature request now: Allow to see valueIds topics from UI

spacemanspiff2007 commented 2 weeks ago

Follow Up: I want to issue a value refresh through mqtt - like clicking on grafik @robertsLando : How do I find out the mqtt topic to trigger a refresh?

robertsLando commented 2 weeks ago

https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt?id=refreshvalues

spacemanspiff2007 commented 2 weeks ago

Thank you for your reply. This does refresh all node values. The button in the UI makes it seem that it's possible to refresh only the values of a certain command class. Is that not the case?

E.g. the refresh button is here for "Binary Switch v2" and "Meter v6". That means that the refresh button only updates the values for the section where its drawn. E.g. upper button refreshes values for "Binary Switch v2", the lower button for "Meter v6" If it would only be possible for all device values it would be drawn up in the Device section. grafik

robertsLando commented 2 weeks ago

You are looking for this so: https://zwave-js.github.io/zwave-js-ui/#/guide/mqtt?id=refreshccvalues