Hello,
this topic serves to publish examples of working work, a reminder for everyone.
Examples @bastler
hello all,
i successfully added contacts now an just want to post a little example for everyone that is interested in:
this is the (manually managed) things-file:
Bridge openwebnet:bus_gateway:myGateway [ host="xx.xx.xx.xx", passwd="?????" ] {
Thing bus_dry_contact_ir LR_contact "LR_contact" @ "contacts" [ where="352" ]
...(further entries)
}
(here i added contact nr 52, don´t forget to prefix a “3” - so it will become “352”)
this is the items-file:
Switch iLR_contact "my contact" { channel="openwebnet:bus_dry_contact_ir:myGateway:LR_contact:sensor" }
this is the sitemap-file (state will only be displayed if contact state = ON):
Text item=iLR_contact label="my contact" labelcolor=["red"] icon="error" visibility=[iLR_contact=="ON"]
and this is an additionally rule file that sends an email when state changes to ON (of course mail has to be configured in folder “services”):
rule "iLR_contact"
when
Item iLR_contact changed to ON
then
sendMail("info@my-emai-address.com","email subject info", "email text")
logInfo("email an info@my-emai-address.com", "text to log")
end
happy new year!
Examples rollershutter
file .things
Bridge openwebnet:bus_gateway:mybridge [ host="xx.xx.xx.xx", port=20000, passwd="?????" ]
{
Thing bus_automation mytap_sala "Tapparella Sala" [where="91", shutterRun="25000"]
...(further entries)
}
file .items
Rollershutter Tapparella_Sala "Sala [%.0f %%]" <rollershutter> [ "Blinds" ] { channel="openwebnet:bus_automation:mybridge:mytap_sala:shutter" }
Examples light
file .things
Bridge openwebnet:bus_gateway:mybridge [ host="xx.xx.xx.xx", port=20000, passwd="?????" ]
{
Thing bus_on_off_switch mylig_sala "Luce Sala" [ where="23" ]
...(further entries)
}
file .items
Switch Luce_sala "Sala" <light> [ "Lighting" ] { channel="openwebnet:bus_on_off_switch:mybridge:mylig_sala:switch" }
Examples CEN+
file .things
Bridge openwebnet:bus_gateway:mybridge [ host="xx.xx.xx.xx", port=20000, passwd="?????" ]
{
Thing bus_cenplus_scenario_control cenplus_tapparelle "Scenario Tapparelle" [ where="21", buttons="1,2" ]
...(further entries)
}
(here i added cen+ nr 1, don´t forget to prefix a “2” - so it will become “21”)
file .items
String cenplus_tapp_giorno "Alza Tapparelle Giorno" <rollershutter> (G_Scenari) {channel="openwebnet:bus_cenplus_scenario_control:mybridge:cenplus_tapparelle:button_1"}
String cenplus_tapp_close "Chiudi Tutte Tapparelle" <rollershutter> (G_Scenari) {channel="openwebnet:bus_cenplus_scenario_control:mybridge:cenplus_tapparelle:button_2"}
file .sitemap
sitemap XXXXXXX label="YYYYYYY"
{
Frame label="Scenari" {
Switch item=cenplus_tapp_giorno label="Giorno []" mappings=[PRESSED="Apri"]
Switch item=cenplus_tapp_close label="TUTTE []" mappings=[PRESSED="Chiudi"]
}
}
Examples rules generic CEN+
file .things
Bridge openwebnet:bus_gateway:mybridge [ host="xx.xx.xx.xx", port=20000, passwd="?????" ]
{
Thing bus_cenplus_scenario_control cenplus_test "Scenario Test" [ where="22", buttons="1,2" ]
...(further entries)
}
(here i added cen+ nr 2, don´t forget to prefix a “2” - so it will become “22”)
file .items
String cenplus_test "Test Button1" <network> { channel="openwebnet:bus_cenplus_scenario_control:mybridge:cenplus_test:button_2" }
file .sitemap
Switch item=cenplus_test label="Giorno []" mappings=[PRESSED_EXT="Test ON", RELEASED_EXT="Test OFF"]
file .rules
rule "Test"
when
Item cenplus_test changed
then
switch(cenplus_test.state ) {
case "PRESSED": {
}
case "RELEASE": {
}
case "PRESSED_EXT": {
sendCommand(Luce_sala, ON)
}
case "RELEASED_EXT": {
sendCommand(Luce_sala, OFF)
}
}
end
Examples rules Notification
file .rules
rule "Descrizione rule"
when
Item XXXXXX changed from OFF to ON
then
sendNotification("yyyyy@zzzzz.zzz", "Descrizione Notifica")
end
example for thermo regulation (with 3550 tithermo-central and 4693 probes):
file.things:
Bridge openwebnet:bus_gateway:MH200N [ host="x.x.x.x", passwd="????" ] {
Thing bus_thermostat EG_ThTmp_Buero "EG_ThTmp_Buero" @ "Temperatur" [ where="17" ]
...
}
file.items:
Number:Temperature iEG_ThTmp_Buero "BĂĽro Ist-Temperatur" <temperature> (iEG_Buero, iG_Heizung) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:temperature" }
String iEG_ThOffs_Buero "Offset" <qualityofservice> (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:localMode" }
Switch iEG_ThHeiz_Buero "Heizung aktiv!" <heating> (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:heating" }
Switch iEG_ThKuehl_Buero "KĂĽhlung aktiv!" <climate> (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:cooling" }
Number:Temperature iEG_ThZiel_Buero "Soll-Temperatur" <snow> (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:targetTemperature" }
String iEG_ThInf_Buero "Modus" (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:activeMode" }
Number:Temperature iEG_ThSet_Buero "Soll-Temperatur" <heating> (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:setpointTemperature" }
String iEG_ThMod_Buero "Modus" <heating_cooling> (iEG_Buero) { channel="openwebnet:bus_thermostat:MH200N:EG_ThTmp_Buero:setMode" }
file.sitemap:
sitemap default label="MyHome"
{
Frame label="Heizung"{
Default item=iEG_ThTmp_Buero
Default item=iEG_ThOffs_Buero visibility=[iEG_ThOffs_Buero!="NORMAL"]
Text item=iEG_ThHeiz_Buero labelcolor=["red"] visibility=[iEG_ThHeiz_Buero=="ON"]
Text item=iEG_ThKuehl_Buero labelcolor=["blue"] visibility=[iEG_ThKuehl_Buero=="ON"]
Default item=iEG_ThZiel_Buero icon="temperature" visibility=[iEG_ThMod_Buero=="AUTO"]
Default item=iEG_ThZiel_Buero visibility=[iEG_ThMod_Buero=="PROTECTION"]
//Default item=iEG_ThInf_Buero
Setpoint item=iEG_ThSet_Buero minValue=12.5 maxValue=30 step=0.5 visibility=[iEG_ThMod_Buero=="MANUAL"]
Selection item=iEG_ThMod_Buero valuecolor=[AUTO="green", MANUAL="orange", PROTECTION="blue", OFF="red"] mappings=[AUTO="Auto", MANUAL="Manuell", PROTECTION="Frostschutz", OFF="Aus"]
}
}
Use of a virtual button for dynamic icons OPEN - CLOSE, to command an ON - OFF item.
To use the expire function, you need to install the binding, so the binding is in version 1.X
file .things
Bridge openwebnet:bus_gateway:mybridge [ host="xx.xx.xx.xx", port=20000, passwd="?????" ]
{
Thing bus_on_off_switch mylig_cancelletto "Cancelletto" [ where="33" ]
...(further entries)
}
file .items
Switch Pul_cancelletto "Cancelletto" <door> {channel="openwebnet:bus_on_off_switch:mybridge:mylig_cancelletto:switch" , expire="2s,command=OFF" }
String Pul_virt_cancelletto "Vituale Cancelletto" <door> {expire="2s,command=CLOSED"}
file .rules
rule "cancellettovirt"
when
Item Pul_virt_cancelletto changed from CLOSED to OPEN
then
Pul_cancelletto.sendCommand(ON)
end
file .sitemap
Switch item=Pul_virt_cancelletto label="Cancelletto" mappings=[OPEN="Apri"]
Use of buttons to manage groups and general from OH
In the example there are two ways to manage the blinds, of your choice.
file .items
Group:Switch:OR(ON, OFF) G_Generale "General" <light>
Group:Switch:OR(ON, OFF) C_Giorno "Group day" <light> (G_Generale)
Group:Switch:OR(ON, OFF) C_Notte "Group night" <light> (G_Generale)
Group:Rollershutter:AVG C_T_Giorno "Group blinds" <rollershutter> (P_PianoTerreno)
Rollershutter Tapparella_Sala "Sala [%.0f %%]" <rollershutter> (C_T_Giorno,C_Sala,G_Shutters) [ "Blinds" ] { channel="openwebnet:bus_automation:mybridge:mytap_sala:shutter" }
Rollershutter Tapparella_Cucina "Cucina [%.0f %%]" <rollershutter> (C_T_Giorno,C_Sala,G_Shutters) [ "Blinds" ] { channel="openwebnet:bus_automation:mybridge:mytap_cucina:shutter" }
Switch Luce_cucina "Cucina" <light> (C_Giorno,C_Sala, G_Lights) [ "Lighting" ] { channel="openwebnet:bus_on_off_switch:mybridge:mylig_cucina:switch" }
Switch Luce_entrata "Entrata" <light> (C_Giorno,C_Sala, G_Lights) [ "Lighting" ] { channel="openwebnet:bus_on_off_switch:mybridge:mylig_entrata:switch" }
Switch Luce_sala "Sala" <light> (C_Giorno,C_Sala, G_Lights) [ "Lighting" ] { channel="openwebnet:bus_on_off_switch:mybridge:mylig_sala:switch" }
Switch Luce_cameretta "Cameretta" <light> (C_Notte,C_Cameretta, G_Lights) [ "Lighting" ] { channel="openwebnet:bus_on_off_switch:mybridge:mylig_cameretta:switch" }
Dimmer Luce_camera "Camera [%.0f %%]" <slider> (C_Notte,C_Camera, G_Lights) [ "Lighting" ] { channel="openwebnet:bus_dimmer:mybridge:mydim_camera:brightness" }
Switch Luce_bagno "Bagno" <light> (C_Notte,C_Bagno, G_Lights) [ "Lighting" ] { channel="openwebnet:bus_on_off_switch:mybridge:mylig_bagno:switch" }
file .sitemap
Frame label="GR - GEN" {
Switch item=C_Giorno mappings=[OFF="OFF", ON="ON"]
Switch item=C_Notte mappings=[OFF="OFF", ON="ON"]
Switch item=G_Generale mappings=[OFF="OFF", ON="ON"]
Switch item=C_T_Giorno
Switch item=C_T_Giorno mappings=[UP="UP", STOP="STOP", DOWN="DOWN"]
}
Here is an example using a contacts sensor (3477 connected to door motor relay ) to create an audible reminder that I left the garage door open. The audible alert repeats every 20mins until the door is shut again.
I use Amazon Alexa Text To Speech capabilities to broadcast on my house Echo units the reminder every 20mins. This needs the Amazon Echo Control binding and this example also uses the Expire binding to create a 20min timer.
I hope the example inspires you by showing you how you can combine any BUS event with useful Alexa announcements to inform you what is happening on your BUS.
e.g. I do something similiar for BUS connected high wind and rain sensors using BUS contact interface (F428) connected to the sensor limit switch relays. My blinds will retract if there are high winds detected and at the same time Alexa announces the situation and why the blinds are prevented from further movement. When its calm again Alexa announces that too and automatic blind operation resumes.
The TTS Alexa service can also be useful for testing new features of the openwebnet binding by making audible annoucements instead of having to run back to a computer to check what happened eg after CEN and CEN plus button press
The following is the Alexa item to hold the TTS string to be used for the announcement. Whenever this item is updated with a new string Alexa will then speak out the new string:
String AlexaStatusAnnouncement "Alexa status change announcement" <settings>
Rule to start the reminder timer and announce that the door was opened:
rule 'Garage door open'
when
Item GarageDoorClosed_Sensor changed from ON to OFF
then
GarageDoorOpenTimer.sendCommand(ON)
AlexaStatusAnnouncement.postUpdate('<speak> Garage door open </speak>')
end
Rule to make the reminder announcement and reset the timer:
rule "Garage door open reminder"
when
Item GarageDoorOpenTimer changed from ON to OFF
then
if (GarageDoorClosed_Sensor.state == OFF) {
GarageDoorOpenTimer.sendCommand(ON)
AlexaStatusAnnouncement.postUpdate('<speak> Reminder. The garage door is open </speak>')
}
end
Rule to stop the timer if door is closed:
rule 'Garage door closed'
when
Item GarageDoorClosed_Sensor changed from OFF to ON
then
GarageDoorOpenTimer.sendCommand(OFF)
AlexaStatusAnnouncement.postUpdate('<speak> Garage door closed </speak>')
end
You could change the Alexa announcement to be a anything you want instead of the audible alert eg a flashing light
Rule to send TTS announcement to the Alexa Echo’s:
rule 'Echo TTS broadcast status change announcement with attention tone'
when
Item AlexaStatusAnnouncement received update
then
//start attention tone
gAlexaAttentionTone.sendCommand('system_alerts_soothing_01')
//end atention tone
Thread::sleep(8200)
gAlexaAttentionTone.sendCommand('')
gAlexaTTS.sendCommand(AlexaStatusAnnouncement.state.toString)
end
I also created an attention tone to alert listeners to the message just before TTS message is broadcast.
Members of the Attention tone group:
String Echo1_AlarmSound "Alarm sound" (gAlexaAttentionTone) {channel="amazonechocontrol:echo:account:echo1:playAlarmSound"}
String EchoDot1_AlarmSound "Alarm sound" (gAlexaAttentionTone) {channel="amazonechocontrol:echo:account:echodot1:playAlarmSound"}
BUS contact interface items:
Switch GarageDoorClosed_Sensor "Garage door closed" <garagedoor> {channel="openwebnet:bus_dry_contact_ir:Screen10:31:sensor"}
BUS Contact interface Thing:
Thing bus_dry_contact_ir 31 "Garage door closed sensor" @ "Sensors" [ where="31" ]
Expire item for the timer:
Switch GarageDoorOpenTimer "Garage door open timer" <selfruntime> {expire="20m,command=OFF"}
Alexa group items for simultaneous (almost!) announcements on multiple Echo devices:
Group:String:AVG gAlexaTTS "Alexa group TTS broadcast"
Group:String:AVG gAlexaAttentionTone "Alexa group attention tone broadcast"
Members of the Alexa TTS group:
String Echo1_Speak "TTS" (gAlexaTTS) {channel="amazonechocontrol:echo:account:echo1:textToSpeech"}
String EchoDot1_Speak "TTS" (gAlexaTTS) {channel="amazonechocontrol:echo:account:echodot1:textToSpeech"}
TTS volume control. I set this with a rule that runs at startup to pre-set the TTS volume levels for each Echo. You could also vary it per Echo and or per TTS message:
Dimmer Echo1_TTSVolume "TTS volume" (gAlexaTTSVolume) {channel="amazonechocontrol:echo:account:echo1:textToSpeechVolume"}
Dimmer EchoDoT1_TTSVolume "TTS volume" (gAlexaTTSVolume) {channel="amazonechocontrol:echo:account:echodot1:textToSpeechVolume"}
In case your wondering… <speak> .... </speak>
in the Alexa TTS strings enables the Alexa Speech Synthesis Markup Language to be used to create less robotic sounding messages, change the pace and emphasis in the sentance etc etc. If you don’t need SSML then you don’t need to use the tags in the string. The TTS will work as plain string too.
SSML details are here:
I do not show the SSML markup in my code here but the followng link shows examples:
OK You got to the end.Well done. But it doesn’t have to stop here. If you are a fan of artificial intelligence like Jarvis Iron Man, or maybe HAL in Space Odyssey, and have dreams that one day your futuristic house will be one day soon be like them, then you might be surpised to find that we are already well on the way to realising it.
If you already have a BUS system acting as the central nervous system with sensors sensing the enviroment and all commnunicating with the brains , Openhab… then your dreams might be not as far off as you think
Add in a Home assistant (Alexa or Google ) the ears and voice, for taking voice commands and alerting you to important events, then its almost there. You now have all the elements and just need to write the rules to make Openhab seem like its smart Simple!
Energy
View the consume and production energy values on sitemap
Thanks to @Emiliano
file .things
Thing bus_energy_central_unit centr_consume "Electric Consume" [ where="51" ]
Thing bus_energy_central_unit centr_production "Electric Production" [ where="52" ]
file .item
Number:power Electric_consume "Consume [%.0f W]" [ "Power" ] { channel="openwebnet:bus_energy_central_unit:mybridge:centr_consume:power" }
Number:power Electric_production "Production [%.0f W]" [ "Power" ] { channel="openwebnet:bus_energy_central_unit:mybridge:centr_production:power" }
file .sitemap
Frame label="Electric" {
Text item=Electric_consumption label="Consumption [%.0f W]" icon="energy"
Text item=Electric_production label="Production [%.0f W]" icon="solarplant"
}
To use MyHomeServer1 as a gateway:
Login in the MyHome_UP app using the installer code
Goto the last tab (“More”), then tap on “System”
There change the open password (5 to 16 characters, alphanumeric)
Use that password in the binding
MyHomeServer1
To find the USER CODE
password, see the label on the web server
If I’m not mistaken, it’s on the webserver’s label
Ho @gozilla01, examples cen+ Is valid again?