zwave-js / node-red-contrib-zwave-js

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.
MIT License
47 stars 6 forks source link

node-red-contrib-zwave-js - help #285

Closed Karl031371 closed 11 months ago

Karl031371 commented 11 months ago

How can we help?

As a beginner with this package (node-red-contrib-zwave-js) I’m looking to learn about it and have some questions that might be a bit elementary. Is this the proper place to ask? If not, can anyone point me in the right direction? Much appreciated, and I apologize if I’m out of place here.

Version

No response

Node-RED Version

No response

What hardware are you using?

No response

Any code to add?

No response

marcus-j-davies commented 11 months ago

Hi @Karl031371

This indeed will be the place to ask. how can I help?

Karl031371 commented 11 months ago

Awesome! I'm pretty excited about node-red-contrib-zwave-js, but unfortunately I don't seem to quite grasp what is going on. I am a pretty "learn by doing" kind of person and can muddle through quite a bit on most things, but this has been a little more challenging for me. I'm able to get my controller activated and working and also get my zwave devices recognized and in the map (which, by the way, is pretty darn cool). I also have access to the devices in the information center on the right side - and I can also access the ZWave JS, which also gives me access to the device items (again, pretty darn cool). The example given is for a "Binary Switch." I usually check out nodes and get understanding by seeing what is going on - but I don't have a binary switch. I have a Multilevel Switch and a HS-FS100+ (Light, Temperature Sensor, and controllable buzzer).

The controller is outputting the temperature from the HS-FS100+ every minute (this is selectable) into the debug, so I can see this is all working. My problem is, well, me.

Every way I've tried to get the Multilevel Switch to work (to change off or on) I get "Error: [ValueID] is missing." I am lifting the code from the device located on the right (the information that is presented in the "Binary switch" example) and placing that in the ValueID { } section of the Command Factory node. I'm pretty sure that isn't correct. I am using an inject node connected to the command factory, which in turn is connected to the Qolsys Wall Plug device node. I'm pretty sure I'm going about this improperly. I'm not really sure where I start the information that is needed (such as the inject node), how the command factory handles it or if that information goes there instead (and if this is where I place information for valueID- which is what I've been trying?).

So, pretty elementary - sorry for such a basic question.

marcus-j-davies commented 11 months ago

Ok.... So your using the CMD Factory - This is a helper Node, but you can manually write the command also.

I'll cover both

1st! All values have a Value ID - it's not an integer ID (as often mistaken) but an object that identifies the precise value of interest.

A typical Value ID is (let's use a Binary Switch) - I have left out the properties that are not required (usually)

{
     "commandClass": 37,                  /* The Command Class - 37 = Binary */
     "endpoint": 0,                       /* A Device may have multiple switches */
     "property": "currentValue"           /* The property of interest */
}

The above is for the current value (so one you use to fetch the current value) So how about setting the value, or target value as its known

{
     "commandClass": 37,                  /* The Command Class - 37 = Binary */
     "endpoint": 0,                       /* A Device may have multiple switches */
     "property": "targetValue"            /* The property of interest */
}

Setting this value, means it will also become the current value once the command is successfull

But where can you get the Value IDs? In the right hand pain double click a value, and it will give you the value ID (plus some some extra bits - usually not required)

Screenshot 2023-11-22 at 18 37 45

The CMD Factory takes properties you pass to it, and packages up a command with it all.

So.... in the CMD Factory, set the following ( we will set the Multi level)

Screenshot 2023-11-22 at 18 43 11

Then on a function node (to the left of it) - you can use an inject node directly if you want to save on the function node, but I want to show the values in an easier way

return {
    valueId:{
       "commandClass": 38,                  
       "endpoint": 0,                       
       "property": "targetValue"            
    },
    node: 55,
    payload: 100
}

Screenshot 2023-11-22 at 18 51 51

To write the command manually - you can use the debug node to see how it should look Screenshot 2023-11-22 at 18 52 26

Hopefully the above starts you off, and breathe after 😄

marcus-j-davies commented 11 months ago

~Bonus!~

~There is a special Debug Window on the right pane.~ ~Open it up, and change a value in the pane - and the special debug window will show you the command that was issued~

EDIT Actually - don't depend on the command the special debug window shows - its using an old command format that is now deprecated, and will be removed in V10

Karl031371 commented 11 months ago

Thank you sir! I really appreciate your help!

I've gotten past the invalid ID - but I can't get the switch to change state to off.

Here's an image of the debug:

Screenshot from 2023-11-22 15-35-31

Here is from the other nodes -

Screenshot from 2023-11-22 15-40-07 Screenshot from 2023-11-22 15-39-46 Screenshot from 2023-11-22 15-36-53 Screenshot from 2023-11-22 15-36-12 Screenshot from 2023-11-22 15-35-51

It doesn't show me the images that I've added - I hope I did this correctly.

marcus-j-davies commented 11 months ago

Hi @Karl031371

"Off" is not a valid value for targetValue, that is a property name, not a value. if you just want to control the level, with an optional duration.

Ensure the Value ID in the CMD Factory is set to what ever is named below i.e valueId

/* set to 0 */

return {
    valueId:{
       commandClass: 38,                  
       endpoint: 0,                       
       property: 'targetValue'            
    },
    node: 55,
    payload: 0
}
/* set to 70 */

return {
    valueId:{
       commandClass: 38,                  
       endpoint: 0,                       
       property: 'targetValue'            
    },
    node: 55,
    payload: 70
}

If you want to add a duration/transition i.e a dimming effect (the device must support it)

/* set to 70 over 5 seconds */
/* remember to set the options property on the CMD Factory to  `myOptions` */

return {
    valueId:{
       commandClass: 38,                  
       endpoint: 0,                       
       property: "targetValue"            
    },
    node: 55,
    payload: 70,
    myOptions: {
       transitionDuration: '5s'
    }
}
Karl031371 commented 11 months ago

I'm getting this out of CMD Factory:

CMDFACTDEB

It looks proper now I think? I set it for both 0 for one try, and 99 for another. It has a min-max value limit so I tried both. Does this debug look correct?

I hope I'm not wearing out my welcome - I appreciate your assistance sir

marcus-j-davies commented 11 months ago

I hope I'm not wearing out my welcome - I appreciate your assistance sir

Not at all!!

That looks better, but... Capitalisation matters (I think 🤔)

targetValue not targetvalue

Other than that! It looks correct.

Karl031371 commented 11 months ago

Tremendous help! You are the MAN!

marcus-j-davies commented 11 months ago

Assuming that means it works 😆

(I mean it should)

marcus-j-davies commented 11 months ago

@Karl031371

I'll Close this for now. Feel free to open up a conversation -> https://github.com/zwave-js/node-red-contrib-zwave-js/discussions