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
968 stars 205 forks source link

Enerwave ZWN-SC7 Scene Controller #1640

Closed MYeager1967 closed 3 years ago

MYeager1967 commented 3 years ago

I have one of these scene controllers that I've been using with a Vera Plus for several years. It has never wanted to work with Home Assistant and, as it's on the compatibility list for zwaveJS, I figured things might work now. It does appear in the interface and it's correctly identified and everything, but I can't figure out how to get it to work. Anyone out there actually have one of these working in their system that could point me in the right direction? If it works on a 5 year old Vera, I can't see why it won't work here...

AlCalzone commented 3 years ago

Also, is this, by nature of being a "scene controller", limited to setting a "scene" - i.e. is there no way to read an incoming zwave message in, say, node-red and act on that?

A scene controller activates scenes in other devices using the Scene Activation CC. You'll see which scene was activated and its duration via this value: https://github.com/zwave-js/zwavejs2mqtt/issues/1640#issuecomment-921256206

so how would I run that custom driver function?

driver function

or using a sendCommand MQTT API call: https://zwave-js.github.io/zwavejs2mqtt/#/guide/mqtt?id=send-command with this payload (or similar)

{
    "args": [
        {
            "nodeId": 44,
            "commandClass": 0x2d,
            "endpoint": 0,
        },
        "set",
        [
            1, // group id
            5, // scene id,
            "2m", // duration
        ]
    ]
}
csanner commented 3 years ago

ah. I'm still unable to get the MQTT zwave_js working.

MYeager1967 commented 3 years ago

The way I understand it, the step missing here is assigning a scene to each of the 7 buttons on the controller itself. I've already added node 1 to all the association groups and when pushing buttons, nothing seems to show up anywhere (might be something in the driver log, I haven't looked there yet). Since nothing shows up in MQTT or the MQTT Event stream, I have nothing to act on. I'm guessing at this point that since there's nothing assigned to the buttons, it has nothing to send. This device never passed compliance for Z-wave and definitely doesn't adhere to all of the standard. 😀 We seem to be getting closer to getting it functional by the day though. May be a few days before I have much time to play with this again but I'll try to look at the driver command route before I leave for work in the morning.

Ikcelaks commented 3 years ago

@MYeager1967 Did you follow Al's instructions for running the custom driver function? If you do that for each of the scenes 1 through 7, I'm optimistic you'll start seeing events coming in.

MYeager1967 commented 3 years ago

I haven't had the opportunity yet. I'm assuming I just increment the group number (1-7) and assign the appropriate scene number. Will try to get to it in the morning, won't have much time though.

Ikcelaks commented 3 years ago

Yeah, that's what the old SmartThings custom integration did. It shouldn't even matter what you set the dimmingDuration to, since you're just going to listen for events with the controller. That's ironic, because I originally popped in here to talk about fixing that bug.

MYeager1967 commented 3 years ago

Would be nice if the GUI detected this device and presented seven drop downs to assign the scenes, but I'm ok with doing it manually if it works. The author has already done way more than anyone else has in three years or so to get this working with HA.

AlCalzone commented 3 years ago

Would be nice if the GUI detected this device and presented seven drop downs to assign the scenes, but I'm ok with doing it manually if it works.

We usually avoid doing device specific workarounds in the driver if there is another way. What you want might be possible with the compat flag we discussed 2 days ago, because then the 7 values you should be seeing should show up (like they should if the device behaved correctly).

MYeager1967 commented 3 years ago

I understand not doing device specific workarounds. You'd have to store the data in the program itself as it appears you possibly can't get it from the device. Hopefully, the driver command route will do the trick

MYeager1967 commented 3 years ago

image

I don't seem to have the driver function option under advanced on my controller tab.... Is there something I need to change to get it?

Ikcelaks commented 3 years ago

@MYeager1967 "Driver function" isn't under the node. Go to the "Actions" box at the top of the Control Panel, click "Advanced", and you'll find it there.

MYeager1967 commented 3 years ago

Found it! I figured it would be under the controller and the quick little video apparently didn't help me out. Just tried to write them the hard way from MQTT. Will test it real quick on my way out the door. Probably should have enabled logging again but I didn't. Will do that if I have to do it all again...

Looking at the driver function box, I'm going to have to use MQTT.... I have no idea what to do with the other!

MQTT is kicking it back saying it "Cannot read property 'nodeId' of undefined","args":..... Obviously I must have messed up the command somehow but I'm out of time for this morning.... Thanks for all the time you guys have put into this and I'll have all morning on Monday to see what I can get done. Will be able to read responses here later today...

AlCalzone commented 3 years ago

I have no idea what to do with the other!

Is my post above containing the exact command not enough? https://github.com/zwave-js/zwavejs2mqtt/issues/1640#issuecomment-921556785

MYeager1967 commented 3 years ago

I have no idea what to do with the other!

Is my post above containing the exact command not enough? #1640 (comment)

I somehow missed that one and caught the MQTT part of the post. It's been a long couple of days at work and I'll admit that I haven't been the sharpest tool in the shed the past few days. I'll be extremely happy to run that in the morning. Will it show up in the log at all of should I bother trying to log it?

AlCalzone commented 3 years ago

It should, yes.

MYeager1967 commented 3 years ago

Great! I'll give it a go and report back..

MYeager1967 commented 3 years ago

Had to leave off the optional line to get the commands to send, but they show up in the log with a transmit status of OK. Will be interesting to play with it in the morning to see what I get for messages that I can act on... Getting there!!!!!

MYeager1967 commented 3 years ago

While I'm happy to see an issue closed, this controller still isn't working properly. Probably never will though.....

AlCalzone commented 3 years ago

@Ikcelaks's PR was just merged, which adds the 7 values for you to configure it from the UI. Can you share the current association setup of your device please? And a new driver log of you controlling it after setting the scenes would be helpful.

AlCalzone commented 3 years ago

According to this SmartThings device handler, each scene must be set up to use the corresponding association group. So group 1 scene 1; group 2 scene 2; ...

MYeager1967 commented 3 years ago

I have seven groups that have node 1 in them. If you want the actual JSON dump or something, I'll get it for you tomorrow morning. I'm off and running already today. Pressed a button this morning and got the standard all lights flash.. 😐

On Sun, Sep 19, 2021, 8:32 AM AlCalzone @.***> wrote:

@Ikcelaks https://github.com/Ikcelaks's PR was just merged, which adds the 7 values for you to configure it from the UI. Can you share the current association setup of your device please?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zwave-js/zwavejs2mqtt/issues/1640#issuecomment-922466534, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGBF5RBB5LFOZGV47R6WJDUCXJ4FANCNFSM5DE6MC6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

MYeager1967 commented 3 years ago

According to this SmartThings device handler, each scene must be set up to use the corresponding association group. So group 1 scene 1; group 2 scene 2; ...

Though I handled that last night with the driver commands. Let me know what you need to see and I'll get it to you. Will update again tomorrow and see if that helps.

AlCalzone commented 3 years ago

I have seven groups that have node 1 in them

That sounds correct.

Let me know what you need to see and I'll get it to you.

Let's start with a driver log where you run the driver commands again. After that, press the device's buttons and capture that in the same log (if anything happens at all).

MYeager1967 commented 3 years ago

Ok. Here's where I stand now. The commands sent to the controller were as such:

await driver.controller.nodes.get(44).commandClasses["Scene Controller Configuration"].set( 1, // this is the group # 1, // this is the scene ID it should send )

With the extra line present, it threw an error. That said, the scene controller now acts like it's working. The button press give the three flashes and the steady light next to the active button. However, I am getting entries in the log though when I press the buttons. I had to open the door to look and see if the scene turned on the light (it's daytime here) and I then manually activated the scene from the UI to make sure I hadn't screwed it up. The scene works when manually activated. So close!!! zwavejs_2021-09-20.log

blhoward2 commented 3 years ago

You won’t see anything in the log unless you put the controller in each association group as I recall.

MYeager1967 commented 3 years ago

You won’t see anything in the log unless you put the controller in each association group as I recall. Brian

The log has entries in it, it just took a bit for them to show up in my monitor window. I edited the post with that and a better log. The device is working, now it's an issue of why it's not firing the scene.

I do get an event in MQTT under /EVENTS/ZWAVE_GATEWAY/node/node_value_updated that shows the change. I'm assuming that the scene should fire?

MYeager1967 commented 3 years ago

This is the current scene list if it helps spot a problem.. scenes.json.txt .

blhoward2 commented 3 years ago

That’s not how these work. The Scene inside zjs2mqtt has nothing to do with the scene event the device is sending out. You’d need to automate off the scene message coming in and have HA or whatever fire a scene from there. All the configuration does is setup which scene group message it will send out. The device will also itself activate the scene you have setup via direct association (at least with the VRCS4). So if you associate directly and adjust the brightness, it will set that back up.

MYeager1967 commented 3 years ago

Gotcha. Can I build the scenes in zwavejs2mqtt or do I build them in HA? Each scene has multiple devices in it and this device only sends an "on", there is no off. That being the case, unless there's a way to specify the desired state in a direct association, I'm out of luck....

blhoward2 commented 3 years ago

I don't believe so. You may be able to activate the scene in zjs2mqtt through mqtt but that would be it. It would be cleaner just to do it where you're automating.

With the VRCS4, it restores the device to whatever state/level it was in when you added it as I recall. It's not perfect.

MYeager1967 commented 3 years ago

Success! I managed to figure out how to grab the data I needed from the node_value_updated key buried under events. I used this to automate the scenes that I originally had assigned to this switch. It's still a temperamental little bastard, sometimes needing several presses before it registers, but I think that may be a locational thing. Either way... Was there supposed to be a newer version with the scene setting in the GUI? As of early this morning, I hadn't seen it.

AlCalzone commented 3 years ago

No its not released yet

MYeager1967 commented 3 years ago

Ok. I look forward to seeing it. Any idea why the data from the event stream isn't populated into the MQTT data tree? It puts the 44/43/0/sceneId entry in, but only time shows. There's quite a bit more under 43/0/sceneId.....

AlCalzone commented 3 years ago

@robertsLando ?

robertsLando commented 3 years ago

@MYeager1967 Are you using Mqtt explorer? BTW I publish everything I receive as valueId and notifications to mqtt, you should enable debug logs and check when the event occurs if you see the log that shows the publish

MYeager1967 commented 3 years ago

@MYeager1967 Are you using Mqtt explorer? BTW I publish everything I receive as valueId and notifications to mqtt, you should enable debug logs and check when the event occurs if you see the log that shows the publish

Absolutely running MQTT Explorer. Wouldn't be without it. This is the entire tree for the device. Unfortunately, there's nothing in the last line that's useful either... I'll Try to check the debug for that later. Right now, I'm working off the event itself. Would be much better if it showed up in the tree. I'm guessing it's probably got something to do with the device itself though... Capture

AlCalzone commented 3 years ago

By the driver, sceneId is treated as an event and not a persisted value. I think zwavejs2mqtt resets the values it creates for those back to undefined after a second, @robertsLando ?

MYeager1967 commented 3 years ago

No idea. It doesn't show up in the data tree anywhere so I can't even tell you it's undefined.

AlCalzone commented 3 years ago

grafik What about this? Forgive me if I ask stupid questions - I don't use MQTT

MYeager1967 commented 3 years ago

That's part of the data. There's quite a bit more under that key...

blhoward2 commented 3 years ago

No, that's the complete object for the most recent payload. The others you are seeing are the prior payloads, which is what he's saying. It's immediately reset back to null. Is there one before that with the sceneId?

More importantly, what are you seeing under zwave_js_value_notification and zwave_js_notification in HA? Setup a listener under Developer Tools and see what HA receives.

MYeager1967 commented 3 years ago

When I get back on the computer later, I'll copy the whole event that I'm catching. There's plenty there..

{"data":[{"id":44,"name":"Patio Scene Controller","loc":"","values":{"43-0-sceneId":{"id":"44-43-0-sceneId","nodeId":44,"commandClass":43,"commandClassName":"Scene Activation","endpoint":0,"property":"sceneId","propertyName":"sceneId","type":"number","readable":true,"writeable":true,"label":"Scene ID","stateless":true,"min":1,"max":255,"list":false,"value":1,"lastUpdate":1632158666047}

There's a larger part of the node_value_updated message that I'm capturing under the _EVENTS key. I don't know how much of this should or shouldn't be in the data tree, and I'm certainly not complaining that I have to catch the event. I was just wondering why the value wasn't there. It could be that it's only a temporary thing as the controller really only sends a short command and that's it.

On another note, the switch sometimes acts like it's not connecting to the main controller and you have to press the button more than once to get it to connect. Is this something that may be resolved with a longer transmit time or something?

I'm extremely happy to finally be able to take the Vera offline and use this device natively. Thank you to EVERYONE involved in making that happen....

jim0020 commented 2 years ago

Has anyone documented the steps to make this device work? Thanks in advance.

MYeager1967 commented 2 years ago

The way I got it working is documented in this thread. They have since made it easier by moving it into the GUI. I haven't updated to that method yet....