milo
(M)
August 7, 2019, 7:25pm
1
Hello,
when I open/close my window my zwave device gives me a feedback about the opening status of the window.
here is my z wave device:
Switch Z_way_switch_DoorWindowSensor14 "Balkontür [MAP(windowdoorcontact.map):%s]" <door> (group_house_doorwindow){ channel="zway:zwayDevice:smarthome:14:sensorBinary-ZWayVDev_zway_14-0-113-6-Door-A" }
and
if i open it I want to publish this message through mqtt broker
topic:
statusdisplay/status/window/schlafzimmer
message:
open
if i close I want to publish this message through mqtt broker
topic:
statusdisplay/status/window/schlafzimmer
message:
close
how do i do this??
Thanks
I would expect you would use a couple of rules. Have you tried that?
milo
(M)
August 7, 2019, 7:33pm
3
Not yet…i thought about the easiest solution
You did #8 , please look at #9 & #10
Before you ask…
Community forum is NOT a helpdesk
Let’s put this in the front: nobody here works for openHAB. The community members are helping with an Open Source Project, not a commercial software.
Additionally, the forum is NOT dealing with general Home Automation topics, the focus is on openHAB. In some cases, various products or technologies which are not directly linked to openHAB can be discussed but with the proper title , category or tag .
We are ALL volunteering our free time to help…
rossko57
(Rossko57)
August 7, 2019, 7:36pm
5
An alternative is create an MQTT thing and assign a command channel to your existing Item (as well as your zwave) with a follow profile.
1 Like
milo
(M)
August 8, 2019, 3:53pm
6
Bridge mqtt:broker:mosquitto "MQTT Broker: Mosquitto" [ host="xxxxx", port=1883, clientID="openHAB2", secure="false"]
Thing mqtt:topic:statusdisplay (mqtt:broker:mosquitto) {
Type string : schlafzimmer "schlafzimmer" [ stateTopic="statusdisplay/status/window/schlafzimme"]
}
i started with this but how do i send a message now???
JGKK
(Johannes)
August 8, 2019, 4:10pm
7
Have a look here:
https://www.eclipse.org/smarthome/documentation/development/bindings/profiles.html#followprofile
So you need to create an Item for your mqtt thing and make it follow according to the link above. You than have to Change the topic you want to publish to to a command topic in your thing definition.
Best regards Johannes
rossko57
(Rossko57)
August 8, 2019, 4:11pm
8
If you want to send a message out over MQTT, you want command topic not state topic.
After you’ve fixed that channel, you can link it to your Item as a second channel, but qualify it with the ‘follow’ profile.
That will make the channel see any Item updates as simulated commands and send to MQTT
1 Like
milo
(M)
August 9, 2019, 5:01am
9
My configuration looks like
Bridge mqtt:broker:mosquitto "MQTT Broker: Mosquitto" [ host="xxxxx", port=1883, clientID="openHAB2", secure="false"]
Thing mqtt:topic:statusdisplay (mqtt:broker:mosquitto) {
Type string : schlafzimmer "schlafzimmer" [ commandTopic="statusdisplay/status/window/schlafzimmer"]
}
Switch test "test" <switch> [ "Switchable" ] {channel="mqtt:topic:statusdisplay:schlafzimmer" [profile="follow", profile-parameterID="Z_way_switch_DoorWindowSensor14"]}
but no message is published?? How to I say it should publish “open” “close” when the switch is switched to “on” off" ??
rossko57
(Rossko57)
August 9, 2019, 4:57pm
10
milo:
no message is published?
Do you see Z_way_switch_DoorWindowSensor14
changing in your events.log? What to?
You’ve linked a string type mqtt channel to a switch type Item, I don’t know if anything works with that.
If you use a switch channel and want to convert ON/OFF to something else, you could use transformationPatternOut :but I think you need to be on bonding 2.5M1 for that.
milo
(M)
August 9, 2019, 7:15pm
11
the switch alone is working
Type switch : schlafzimmer "schlafzimmer" [ commandTopic="statusdisplay/status/window/schlafzimmer", on="open", off="close"]
Switch testmqqtswitch "test" <switch> {channel="mqtt:topic:statusdisplay:schlafzimmer" [profile="follow", profile-parameterID="Z_way_switch_DoorWindowSensor14"]}
Switch Z_way_switch_DoorWindowSensor14 "Balkontür [MAP(windowdoorcontact.map):%s]" <door> (group_house_doorwindow){ channel="zway:zwayDevice:smarthome:14:sensorBinary-ZWayVDev_zway_14-0-113-6-Door-A" }
But the mqtt switch is not following the Z_way_switch_DoorWindowSensor14 switch. need i do this by rule???
event.log
2019-08-09 21:21:19.152 [vent.ItemStateChangedEvent] - Z_way_switch_DoorWindowSensor14 changed from OFF to ON
rossko57
(Rossko57)
August 9, 2019, 7:27pm
12
I’d do it this way, put the channel-follow directly on the source Item
Switch Z_way_switch_DoorWindowSensor14 "Balkontür [MAP(windowdoorcontact.map):%s]" <door> (group_house_doorwindow){ channel="zway:zwayDevice:smarthome:14:sensorBinary-ZWayVDev_zway_14-0-113-6-Door-A" , channel="mqtt:topic:statusdisplay:schlafzimmer" [profile="follow"] }
1 Like