psyciknz
(Psyciknz)
December 23, 2020, 1:55am
1
I’ve got a smoke detector that could send out something (via PAI) on an open topic or fire topic. Under V1 Mqtt I do this with:
Contact alarm_smoke_computer "Computer Smoke State [%s]" <fire> (g_smoke_detection)
{ mqtt="<[openhab:paradox/states/zones/Smoke_computer/open:state:MAP(onoff.map)],
<[openhab:paradox/states/zones/Smoke_computer/fire:state:MAP(onoff.map)]"}
What woulc be the equivalent thing defintion for the v2 binding? I’ve currently got open state:
Type contact : zSmoke_computer "zSmoke_computer" [ stateTopic="paradox/states/zones/Smoke_computer/open", on="True", off="False" ]
and item:
Contact alarm_smoke_computer "Computer Smoke State [%s]" <fire> (g_smoke_detection) { channel="mqtt:topic:alarm:zSmoke_computer"}
But can I
Have mulltiple MQTT topics for a thing channel
or Have multiple item links to multiple thing channels?
You can link as many items to channel as you like
openHAB 3 is a little different and you might want to go straight to that as the main UI is much better
or
UID: mqtt:topic:RPI4:Smoke
label: "Smoke alarms "
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:RPI4
channels:
- id: Computer
channelTypeUID: mqtt:switch
label: Burning server
description: ""
configuration:
stateTopic: paradox/states/zones/Smoke_computer/open
off: "False"
on: "True"
psyciknz
(Psyciknz)
December 23, 2020, 2:30am
3
How do I do that in 2.5.9? I got a few thing to convert off v1 bindings so will migrate those first before looking at 3 (and would prefer 3.0.1/3.1).
What’s the syntax for multiple channels for an item? Just with commas?
channel="mqtt:topic:alarm:zMain_door_PIR",channel="mqtt:topic:alarm:zBed_room_PIR"
?
Yep that’s how you add more than one channel to an item.
I not sure why you would wait for OH3.1 its just a number. Yes there will be issues with it however if you are going to have unique problems with the system then it will happen anyway.
After the snapshots of oh3 there were 5 milestone releases and 2 release candidates before the release.
psyciknz
(Psyciknz)
December 23, 2020, 3:15am
5
Beause I have more than just this alarm still using mqtt v1. A couple on things on nut v1. I’d rather not have a dead system.
So back on mqtt. As far as I know a stateTopic and CommandTopic can’t take different values can they?
Type switch : bFamily_room_PIR "bamily_room_PIR" [ commandTopic="paradox/control/zones/Family_room_PIR", on="bypass", off="clear_bypass", stateTopic="paradox/states/zones/Family_room_PIR/bypassed" ]
To bypass a zone, I send bypass or clear_bypass for on and off. But the resulting state is true/false.
How can I achieve this?
You would need to use transformation pattern to change it to what you want.
You need MAP transformation installed
Create a MAP file in your transform folder named paradox_alarm.map
or whatever
true=ON
false=OFF
1=bypass
0=clear_bypass
Then your channel will look like
Type switch : bFamily_room_PIR "bamily_room_PIR" [ commandTopic="paradox/control/zones/Family_room_PIR", transformationPatternOut="MAP:paradox_alarm.map" , transformationPattern="MAP:paradox_alarm.map", stateTopic="paradox/states/zones/Family_room_PIR/bypassed"]
To convert generally from v1 to v2:
## Examples
Have a look at the following textual examples.
### A broker Thing with a Generic MQTT Thing and a few channels
demo1.things:
```xtend
Bridge mqtt:broker:myUnsecureBroker [ host="192.168.0.42", secure=false ]
{
Thing topic mything {
Channels:
Type switch : lamp "Kitchen Lamp" [ stateTopic="lamp/enabled", commandTopic="lamp/enabled/set" ]
Type switch : fancylamp "Fancy Lamp" [ stateTopic="fancy/lamp/state", commandTopic="fancy/lamp/command", on="i-am-on", off="i-am-off" ]
Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set", allowedStates="ARMED_HOME,ARMED_AWAY,UNARMED" ]
Type color : lampcolor "Kitchen Lamp color" [ stateTopic="lamp/color", commandTopic="lamp/color/set", rgb=true ]
Type dimmer : blind "Blind" [ stateTopic="blind/state", commandTopic="blind/set", min=0, max=5, step=1 ]
}
This file has been truncated. show original
rlkoshak
(Rich Koshak)
December 23, 2020, 8:11pm
8
Through PaperUI. If you have a number of very similar MQTT Things you might need to create, when using PaperUI I recommend create the first one. Then from the REST API query for the newly create Thing, copy the JSON to a text editor and modify it for your new similar thing and submit the edited JSON to create the new Thing. I’m so glad to bid good riddance to PapeRUI.
There has been a NUT 2 binding out for quite some time. It is feature complete with the v1 binding.
psyciknz
(Psyciknz)
December 27, 2020, 9:49am
9
Here’s another one. Very easy with mqttv1. Broadlink mini. For channels (or source). The topic is the button where the command for on/off is replay.
String rm3_lounge_samsung_source "Source" (g_rm3_lounge_samsung) {mqtt=">[openhab:broadlink/34ea34b2f9c5/tv/samsung/tv:command:tv:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/hdmi1:command:hdmi1:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/hdmi2:command:hdmi2:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/hdmi3:command:hdmi3:replay]"}
String rm3_lounge_samsung_channel_select "Select Channel" (g_rm3_lounge_samsung) {mqtt=">[openhab:broadlink/34ea34b2f9c5/tv/samsung/numone:command:1:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numtwo:command:2:replay],>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numthree:command:3:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numfour:command:4:replay],>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numfive:command:5:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numsix:command:6:replay],>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numseven:command:7:replay],
>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numeight:command:8:replay],>[openhab:broadlink/34ea34b2f9c5/tv/samsung/numnine:command:9:replay],
>[openhab:broadlink/34ea34b2f9c5/numten:command:10:macro],>[openhab:broadlink/34ea34b2f9c5/numeleven:command:11:macro],
>[openhab:broadlink/34ea34b2f9c5/numtwelve:command:12:macro],>[openhab:broadlink/34ea34b2f9c5/numthirteen:command:13:macro]"}
psyciknz
(Psyciknz)
December 28, 2020, 3:37am
10
Do I have to set each “channel”, ie each topic as a new channel each. Can I assigned all of these channels to a single string item, or do they need to be defined as 1 switch per channel, and operate it that way?
Yes.
Yes.
String rm3_lounge_samsung_channel_select { channel="mqtt:topic:...", channel="mqtt:topic:...", channel="mqtt:topic:...", channel="mqtt:topic:...", }
Might be easier, but we don’t know what you’re doing with the String Item at the moment.
psyciknz
(Psyciknz)
December 28, 2020, 7:19am
12
Any pointers to the item config that would work for this? And how to set the various channels?
From a UI point of view, what is it that you’re after? As in, what do you want to be able to do to change your TV channel? What are you doing at the moment?
psyciknz
(Psyciknz)
December 28, 2020, 7:49am
14
So channels, I have their names
And the nance translate to a number, 1,2,3 etc. this is done in the sitemap
Group item=g_rm3_lounge_samsung label="TV Lounge" {
Switch item=rm3_lounge_samsung_power
Switch item=rm3_lounge_samsung_volume
Switch item=rm3_lounge_samsung_mute
Switch item=rm3_lounge_samsung_channel
Selection item=rm3_lounge_samsung_source mappings=[hdmi1="Apple TV",hdmi2=PC,hdmi3=Playstation,hdmi4=Chromecast,tv=TV]
Selection item=rm3_lounge_samsung_channel_select mappings=[1="One",2=Two,3="+HRE=E",4="Bravo",5="Maori",6="One+1",7="Two+2",8="+HRE=E+1",9="Bravo+1",10="Prime",11="The Edge",12="Choice",13="Duke"]
} //Group item=g_rm3_lounge_samsung label="TV Lounge"
This will be tricky with the current method of topics and commands (replay
) that you’re using. However, based on this presumably you’re using the broadlink-mqtt
project? (I’m not a stalker, honest - just recognise the username!)
If so, then instead of :
TOPIC: broadlink/34ea34b2f9c5/tv/samsung/numtwo
MESSAGE: replay
You can do:
TOPIC: broadlink/34ea34b2f9c5/tv/samsung/
MESSAGE: numtwo
This makes your configuration much simpler. I don’t know how your Bridge Thing is set up - I’ll assume you have everything in the same file. You can then have the following device Thing:
Thing
Thing topic TVSamsung "Samsung TV" {
Channels:
Type string : swChannel "TV Channel" [
commandTopic="broadlink/34ea34b2f9c5/tv/samsung"
]
}
Item
String rm3_lounge_samsung_channel_select "TV Channel" {channel="mqtt:topic:TVSamsung:swChannel"}
Sitemap
Selection item=rm3_lounge_samsung_channel_select label="Channel []" mappings=[numone="One",numtwo="Two",numthree="+HRE=E",numfour="Bravo",numfive="Maori",numsix="One+1",numseven="Two+2",numeight="+HRE=E+1",numnine="Bravo+1",numten="Prime",numeleven="The Edge",numtwelve="Choice",numthirteen="Duke"]
psyciknz
(Psyciknz)
December 28, 2020, 8:50pm
16
Ha yeah, I still use that, but must use an older one that doesn’t support that format…still use my original fork for multiple devices.
I might have to move to simplify the messaging as you’ve described as that is much simpler.
Well, if it’s any use: just yesterday I integrated a second Broadlink device into my network, and the current version of the broadlink-mqtt
seems to be handling it very well!
psyciknz
(Psyciknz)
December 28, 2020, 8:57pm
18
yeah he didn’t dockerise his, so just need to get that working for mine (I have braoadlink-mqtt running in my iot network). I think I can pull his changes to mine and do it from here.
system
(system)
Closed
February 8, 2021, 1:08pm
19
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.