Shutter Control Zeptrion Air

Hi, I would like to control in total 12 rollershutters in my flat

I was reading in the following documentations but I still do not get the concept behind the story :slight_smile:


My goal is to keep the item config file clean and tight and not repeat similar code. I use modules that are controllable by http get post put messages like the following example to switch my light:

Switch sw_bad_decke                   "EIN/AUS"       <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[ON:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=on] >[OFF:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=off]" }
Switch sw_ein_bad_decke               "EIN"           <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[*:POST:http://192.168.x./zrap/chctrl/ch1:cmd=on]"}
Switch sw_aus_bad_decke               "AUS"           <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=off]"}
Switch sw_scene1_bad_decke            "SCENE1/AUS"    <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=recall_s1]"}
Switch sw_scene2_bad_decke            "SCENE2/AUS"    <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=recall_s2]"}
Switch sw_scene3_bad_decke            "SCENE3/AUS"    <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=recall_s3]"}
Switch sw_scene4_bad_decke            "SCENE4/AUS"    <light>    (bad, gAllrooms)                    ["Switchable"]       {http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:cmd=recall_s4]"}

With bash I would use a reusable function for this. I do not have any java coding skills so I raise my question here at the community how to code and implement such a function to control my lights and blinds

Maybe some can point me the following questions out:

-Simple sample function code to control the shutters to control up/down, stop, close up/down and moving the blind.
-What files need to edited inside folders: items,rules etc. where do need to place the code?
-How variables can be passed into the functions

Thank you very much!
Chris

// cmd close close shutters
// cmd open open shutters
// cmd stop stop dimming lights or moving blinds

// cmd move_close move shutters to close (use stop to hold)
// cmd move_open move shutters to open (use stop to hold)

// cmd move_close_(t) move blind and stop after time (t) (t = 100–32000 milliseconds)
// cmd move_open_(t) move blind and stop after time (t) (t = 100–32000 milliseconds)

I’m pretty sure a more appropriate way would be to use just one item per actuator:
items:

String sw_bad_decke "Bad Decke [%s]" { http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:MAP(bad_sw.map)]" }

bad_sw.map (located in ./transformations/):

OFF = cmd\=off
ON = cmd\=on
S1 = cmd\=recall_s1
S2 = cmd\=recall_s2
S3 = cmd\=recall_s3
S4 = cmd\=recall_s4

sitemap:

Switch item=sw_bad_decke mappings=[ON="ON",S1="Scene1",S2="Scene2"]
Switch item=sw_bad_decke mappings=[OFF="OFF",S3="Scene3",S4="Scene4"]

But I did not verify if this code actually works, I do only use http input yet, so this is theory.

As the = is part of the post string, afaik we will have to escape it with \ within the map file.

I used two lines for the sitemap, to get three buttons in each row, certainly you could use one mapping with all six buttons.

For shutters, it would be pretty much the same. To “autostop” the blinds, you would use this simple rule:

var Timer tBlind1 = null
rule "autostop blinds"
when
    Item my_blind_1 received command
then
    if (receivedCommand==UP || receivedCommand==DOWN) { // command is either UP or DOWN
        if (tBlind1!=null) // timer isn't initialized yet...
            tBlind1 = createTimer(now.plusMillis(10032000),[| //really 10032 seconds? this is 2 hours 47 minutes and 12 seconds...
                my_blind_1.sendCommand(STOP) // send STOP command
                tBlind1.cancel
                tBlind1 = null
            ])
    }
end

Hi Udo

Liege ich richtig, dass ich ich auf ein generisches Mapping verweisen kann- oder muss ich pro Actuator ein Mapping erstellen?

19:29:51.710 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘sw_bad_decke’ received command ON
19:29:51.719 [INFO ] [marthome.event.ItemStateChangedEvent] - sw_bad_decke changed from NULL to ON
19:29:51.817 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 400 Bad Request
19:29:53.402 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘sw_bad_decke’ received command OFF
19:29:53.405 [INFO ] [marthome.event.ItemStateChangedEvent] - sw_bad_decke changed from ON to OFF
19:29:53.452 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 400 Bad Request

Ich glaube, wie du schon vermutet hast das = gequotet werden muss
"=" funtioniert / geht nicht
=\ auch nicht

hast du noch eine Idee ?

So schaut es aus zur Zeit bei mit. Ich try und error mich mal durch :slight_smile:

root@app items]# cat home.items
// Zetption Schalter

String sw_bad_decke “Bad Decke [%s]” { http=">[*:POST:http://192.168.x.x/zrap/chctrl/ch1:MAP(zeptrion_sw.map)]" }
[root@app transform]# pwd
/etc/openhab2/transform
[root@app transform]# cat zeptrion_sw.map
// \ = esccape character
OFF = cmd=off
ON = cmd=on
S1 = cmd=recall_s1
S2 = cmd=recall_s2
S3 = cmd=recall_s3
S4 = cmd=recall_s4

sitemap home label=“Home” {

Frame label="Licht" {
   Switch item=sw_bad_decke mappings=[ON="ON",S1="Scene1",S2="Scene2"]
   Switch item=sw_bad_decke mappings=[OFF="OFF",S3="Scene3",S4="Scene4"]
    }
}

~

Well, I experienced an issue while investigating the http binding. In fact, the map-file is correct,

ON=cmd\=on

will result in a mapping, when item is ON, transformation is cmd=on.
Unfortunately, it seems that the neither mapping is recognized in http binding nor default.

See Http binding POST does not work as expected 


Good Morning Udo

I was reading true the oracle java documentation and agree with you. The escaping method is correct.

https://docs.oracle.com/javase/tutorial/java/data/characters.html

I highly appreciate your help!

Christian

Good Morning Christian
I’ve got a lot of ZeptrionAir Staff.
It’s difficult to setup in openHAB.
Do you know ho to setup a DIMMER?
Kind regards
René

Hallo Reni, kommt die eMail an ?
Gruss
Christian

Sali Christian

Ja ist angekommen 


Lieber Gruss

René

Hoi René, ganz kurz - bin am kochen.

Ich habe das ganze nicht mit OpenHab gelöst sondern mit Homebridge. Verwenden zuhause Appledevice

Dimmen geht nicht so einfach: Evt. Kann man das mit CodeRed lösen. Wird aber nicht einfach.

Ich verwende zwei Schalter - EIN / AUS / und eine Fixe Dimmung.

Wenn du fĂŒr Homebridge Hilfe benötigst , einfach melden. Am besten Telefon. Wird sonst zu lange
.

Gruss
Christian

“accessories”: [
{
“accessory”: “HttpMultiswitch”,
“switch_type”: “Switch”,
“name”: “Eingang Licht”,
“http_method”: “POST”,
“base_url”: “http://zapp-17170017.ch/zrap/chctrl/ch1/?cmd=”,
“on_url”: “on”,
“off_url”: “off”
},
{
“accessory”: “HttpMultiswitch”,
“switch_type”: “Switch”,
“name”: “Eingang Licht LOW”,
“http_method”: “POST”,
“base_url”: “http://zapp-17170017.ch/zrap/chctrl/ch1/?cmd=”,
“on_url”: “dim_150”,
“off_url”: “off,”
},

Sali Christian

Wie und wann kann ich dich erreichen?

LG René

Ja, passt