Cannot wire up dimmers and battery switch. (zwave)

Hello, I am an openhab beginner and need some zwave and rules help. I am using openhab 3.

I have a few dimmers and a battery 8 button switch that I am trying to wire up. The goal is to have the buttons turn on and off and dim the dimmers.

My Thing file looks like this:

Bridge zwave:serial_zstick:controller "ZWave Controller" @ "Z-Wave" [port="/dev/ttyACM0", controller_softreset="false", controller_hardreset="false", controller_master="true", heal_time=2, heal_enable="true", security_networkkey="XXX"]
{
  Thing zwave:everspring_ad146_00_000:controller:node6 "Lights: Kitchen Lights" (zwave:serial_zstick:controller) @ "Z-Wave" [node_id=6]
  Thing zwave:merten_507900_00_000:controller:node2 "Lights: Hall Lights" (zwave:serial_zstick:controller) @ "Z-Wave" [node_id=2]
  Thing zwave:merten_507900_00_000:controller:node4 "Lights: Dining Table Lights" (zwave:serial_zstick:controller) @ "Z-Wave" [node_id=4]
  Thing zwave:sunricher_4512581_00_000:node7 "Switch: Bathroom Switch" (zwave:serial_zstick:controller) @ "Z-Wave" [node_id=7]
}

My items files looks like this:

Dimmer LightHallSwitchDimmer "Hall Lights" <switch> (Alexa) ["Lighting"] { channel="zwave:merten_507900_00_000:controller:node2:switch_dimmer", alexa="PowerController.powerState" }
Dimmer LightKitchenSwitchDimmer "Kitchen Lights" <switch> (Alexa) ["Lighting"] {channel="zwave:everspring_ad146_00_000:controller:node6", alexa="PowerController.powerState"}
Dimmer LightFamilyDiningTableSwitchDimmer "Dinner Table Lights" <switch> (Alexa) ["Lighting"] {channel="zwave:merten_507900_00_000:controller:node4:switch_dimmer", alexa="PowerController.powerState"}

Number nButtonH "ButtonH" {channel="zwave:sunricher_4512581_00_000:node7:scene_number"}

At this point I am not sure how to wire the battery switch buttons up to the various dimmers, but I found one suggestion to retrieve the scene_number and create a rule based of that, like this:

rule "SwitchTester"
when
	Item nButtonH changed
then
    logInfo("SwitchTester", "battery buttons changed")
    logInfo("State", nButtonH.state.toString)
end

The rule is never triggered when is push any of the 8 buttons. Nothing gets put into the log.
The openHAB UI reports the battery Switch is ONLINE and I can see the nButton being linked with scene_number channel, but the but the state reports NULL

I am not sure if my files are missing any information, channels, etc.

Am I using the correct approach? and what am I missing?

Thanks for any help in advance.

Hi Christian, you do not even mention what the output in your log files looks like. Did you look there? It will give you a lot of information, even with the standard settings.

If you are a beginner, why not forgo the text file things and let the UI discover your devices, that way you will be given all the available channels and know they are right

2 Likes

Hi Stefan, sorry I forgot to add the log file, I see this:

2021-04-04 14:52:33.298 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'en_NO'.
2021-04-04 14:52:36.106 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'lights.items'
2021-04-04 14:52:36.620 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'zwave.things'
2021-04-04 14:52:36.653 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'zwave.things', using it anyway:
Provide a thing type ID and a thing ID in this format:
 <thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
 <thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
 <thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
 <thingTypeId> <thingId>
2021-04-04 14:52:36.661 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'hue.things'
2021-04-04 14:52:37.539 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'lights.rules'
2021-04-04 14:52:37.930 [INFO ] [.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2021-04-04 14:52:39.002 [INFO ] [org.openhab.ui.internal.UIService   ] - Started UI on port 8080
2021-04-04 14:52:39.339 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel
2021-04-04 14:52:40.775 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = XXX, base URL = http://localhost:8080)
2021-04-04 14:52:41.501 [INFO ] [zwave.handler.ZWaveControllerHandler] - Attempting to add listener when controller is null
2021-04-04 14:52:43.409 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.
2021-04-04 14:52:46.544 [INFO ] [ve.internal.protocol.ZWaveController] - Starting ZWave controller
2021-04-04 14:52:46.544 [INFO ] [ve.internal.protocol.ZWaveController] - ZWave timeout is set to 5000ms. Soft reset is false.

I am not sure if the validation issues it reports is a problem. I can turn on/off and dim the dimmers inside the opanHAB UI → Things → Dimmer → Channels - so it seems they work as they should.

I also could not figure what is causing the validation warning. I could not figure out if I had a syntax issue or not.

Hi Andrew, I am software developer by trade so I am very keen on keeping stuff in files and thinks it will pay off in the long run. Any idea to what might be my problem?

Like it says, there is no type here -

You’re on a hiding to nothing by avoiding use of UI auto configuration with zwave Things.
At least refer to what it discovers for reference.

1 Like

well the log file says there are validation issues with the things file…
you know the UI stores everything in a… well… big text file right?

To be faced with a situation which is pointless, as a successful outcome is impossible.
from The saying 'On a hiding to nothing' - meaning and origin.
you are a funny guy Rossko

I am an olde farte. I sometimes forget I use figures of speech that you young beatniks won’t understand :wink:

2 Likes

Hi Christian,

I have everything in files also, except the thing definitions. I strongly support @Andrew_Rowe in his approach to let the GUI find the devices and define the things. It is the least hardest way.

And for the next steps to success I advise not to take too many steps in one go rather to take one step after the other. (Take it from someone who has suffered from the wrong approached too often :wink: )

1 Like

Hi Stefan, thanks for the advice. I may try that approach. Is the “internal” things file available somewhere for backup purpose? I would like really like to able to do a clean install of openHAB (whenever it breaks) and easily just copy all items, rules, addons, services, etc to get back to a fresh and working openHAB.

Welcome,

As others have hinted it is not recommended to use text files for Things because that is so error-prone. Many people, including me, use text files for Items and Rules but configure Things through the UI.

Ah, I think I solved the validation issue. I was mixing syntax for defining things “inside” the bridge vs outside the bridge. Once I moved my thing definition outside the bridge definition (deleted the curly brackets) - the validation warning disappeared.

There are so few people defining Things in files that getting future community support could be difficult but it is your choice how you configure your system…

Yes, it is stored in the JSONDB file. Use the forum search to find info on where to find. Some users use git to back up and version the file.

Use the openHAB integrated openhab-cli tool (opens new window) to interactively backup/restore your openHAB config

there ya go… keep at it, you’ll figure it out. I’ve written exactly one things file so not much help
off topic question Christian… you said you were a beginner and yet your profile says Joined Oct 25, '16
???

2 Likes

My backup is done in a script automatically. But for restore I would do it interactively, for sure :wink:

1 Like

Yes Stefan, I read your thread on your script, very slick, good on ya :+1:

Ok, thank you for all the advice.

I am now trying the UI approach instead of the things file - and have now arrived at the same place as before.

I added both the controller and the battery button using the UI

My items files only contains this now:

Number sButton "Button" {channel="zwave:device:5bfdd57b46:node9:scene_number"}

My Rules file contains this:

rule "SwitchTester"
when
	Item sButton changed
then
    logInfo("SwitchTester", "battery buttons changed")
    logInfo("State", sButton.state.toString)
end

The rule is not triggered when clicking any buttons on the button device, so am I using a wrong approach - or did I forget a step somewhere?

Log file looks clean, no errors or warnings.

I am trying to follow this thread as my inspiration:

That is a battery operated device and may not have been fully discovered by the binding. Is there an xml file in the zwave folder of userdata? Many times battery operated devices need to be woken up many times during discovery until they properly respond to the NIF request as required by the standard,

Thanks @Bruce_Osborne I was not aware of that.

What is the best way to fix that? Should I try and exclude and include it again? or just start include mode again on the controller?

When I included the battery device I was pressing 2 buttons on the same time for 3 seconds - but the controller kept “scanning” for longer. Should I keep pressing random buttons during this scan or repeat the 3 second press?

Currrently I see “Node initialising: STATIC_VALUES” on the device

Is that what I should expect or?