andyboeh / mediola2mqtt

Mediola MQTT Gateway
11 stars 13 forks source link

WAREMA EWFS #6

Open Tomphson71 opened 2 years ago

Tomphson71 commented 2 years ago

I want to control my WAREMA EWFS Blinds with this addon, but Icant add the type: WA to the configuration. Only ER and RT works.

I get: Fehler beim Speichern der Add-on-Konfiguration, does not match regular expression ER|RT.

All the other things i know: 74FC333333 (example for open the blind 333333) 74F8333333 (example for close the blind 333333)

74 = always the same FC = open blind F8 = close blind

rorso commented 2 years ago

This addon utilizes the mediola API, but it's quite difficult to get access to the documentation. I tried without success, but @andyboeh has.

I did my own extension for generic 433MHz devices that are stored as "IR" and it turned out to be a quite easy task - once you have the correct command URLs.

There is a very old version on PDF around that documents only a fraction. "Warema" is not included.

The API calls are of the form /cmd?XC_FNC=SendSC&type=ER&data=0101 but this depends on the mediola version (4, 4+, 5, 5+, 6, ...).

So if accessing your blinds should result in something like /cmd?XC_FNC=SendSC&type=WA&data=74FC333333 then implementation might be no problem. Did you verify that? How did you find these codes?

For blinds there should at least exist a "stop" code, but in general there should be:

If your blinds have single stepping, then there would additionally be commands for

The latter might serve as "open" and "close" too or vice versa.

Depending on the blind, there might be a couple of other commands too. Just up and down might be too few.

Tomphson71 commented 2 years ago

I have the mediola cloud. At https://cloud.mediola.com/configuration there i can see the codes of my warema ewfs blinds.

rorso commented 2 years ago

The addon talks directly to the Mediola Gateway and you can check for yourself whether the commands would do what you intend.

Try: http://192.168.x.x/cmd?XC_FNC=GetStates in your favorite browser. Replace the IP address-dummy with the IP address of your Mediola Box. You should get something in return that reflects the learned devices on the gateway. If you did configure a password, you will have to provide that one too.

If this works, you can try the http://192.168.x.x/cmd?XC_FNC=SendSC&type=WA&data=74FC333333 command and see whether it does what you want.

If not, you might try to spy on the LAN traffic what happens when you utilize the blind with the Mediola APP. If it does, it would be helpful if you can provide the codes for your complete set of commands like

74XXnnnnnn

nnnnnn = device address XX: FC = open F8 = close ...

And please note which of the AIO gateways you use.

andyboeh commented 2 years ago

@rorso thanks for adding your knowledge here! Unfortunately, WAREWA EWFS is not included in the v5 API documentation either. If @Tomphson71 can figure out the commands, adding support for it is easy, as you said.

brookxxl commented 1 year ago

Hello Thomphson71 (and andyboeh + rorso) and thank you for the addon and this entry.

I am a newcomer to HomeAssistant and can hardly speak English either, so thanks to google for the translation 😉

I need help as I've reached a point where I don't know what to do anymore. Also, I'm not sure if I've implemented everything correctly so far. Some things were a challenge for me as a layman. Maybe my settings are wrong.

I have 7 Warema EWFS wireless roller shutter motors I bought a used Mediola Gateway V5 I installed the app iqontrol I have configured all shutters in the gateway I have installed and configured the addon mediola2mqtt I have installed and configured the Mosquitto broker addon I activated and configured the core-mosquitto integration

Everything seems to be going so far. What do I have to do now to see my motors in HomeAssistant?

Here are some screenshots of my installations. Many thanks for the support.

Mediola-to-MQTT-konfig Mediola-to-MQTT-log Mosquitto-broker-log-start1 Mosquitto-broker-log-start2 MQTT-konfig

rorso commented 1 year ago

Now you still have to link the learned blinds from the Mediola Gateway to MQTT by filling out the "blinds" section in the config.

But first of all you should check the result of the Mediola API from this URL:

http://192.168.2.**/command?XC_FNC=GetStates

The result should look similar to this one (mine) which lists a couple of learned "ER" devices. for My "Elero" Blinds.

{XC_SUC}[{"type":"EVENT","adr":"FF","state":"0"},{"type":"ER","adr":"08","state":"0000"},{"type":"ER","adr":"09","state":"0000"},{"type":"ER","adr":"0A","state":"0000"},{"type":"ER","adr":"0B","state":"0000"},{"type":"ER","adr":"0C","state":"0000"},{"type":"ER","adr":"0D","state":"0000"},{"type":"ER","adr":"01","state":"0000"},{"type":"ER","adr":"02","state":"0000"},{"type":"ER","adr":"03","state":"0000"},{"type":"ER","adr":"04","state":"0000"},{"type":"ER","adr":"05","state":"0000"},{"type":"ER","adr":"06","state":"0000"},{"type":"ER","adr":"07","state":"0000"},{"type":"EVENT","adr":"01","state":"0"},{"type":"EVENT","adr":"02","state":"0"}]

Dependig on that result you sould be able to create the properly named entries in the "blinds" section similar to mine:

- type: ER
  adr: "01"
  name: Büro Ost
  template: tpl_blind
- type: ER
  adr: "02"
  name: Büro Süd-Ost
  template: tpl_blind
....

You see, the "type" and "adr" have been taken from the query for each blind and I added a proper name that will show up in MQTT and later HASS

But to be sure, please post the result of YOUR query. Maybe the config has to be tweaked.

andyboeh commented 1 year ago

WAREA EWFS blinds are not (yet) supported. You need to add support for it to mediola2mqtt.py.

brookxxl commented 1 year ago

Hi and thanks for the quick reply. I had already tried the URL, but the result is very modest. Therefore, I did not publish it here. Here is the feedback: {XC_SUC} [{"type":"EVENT","adr":"FF","state":"0"},{"type":"EVENT","adr":"01","state":"1"}]

Do I have to provide a user and a password? Or is something to consider in iqontrol in the settings.

brookxxl commented 1 year ago

@andyboeh : Is it a big project to complement the support for Warema EWFS. If I can support here, I will gladly try. However, I am not able to program ☹.

rorso commented 1 year ago

Hi and thanks for the quick reply. I had already tried the URL, but the result is very modest. Therefore, I did not publish it here. Here is the feedback: {XC_SUC} [{"type":"EVENT","adr":"FF","state":"0"},{"type":"EVENT","adr":"01","state":"1"}]

So your V5 has some stored Events, but no stored Devices. That essentially means that all the magic is done within iQONTROL and the Mediola is just the "Antenna" to broadcast the prepared data. This is usually the case with non-encrypted air-communication like the ubiquituous "Intertechno Remotes". In this case the entire learned configuration resides in the APP/Cloud and not the device.

You have a good chance to capture and "replay" the specific commands to handle the blinds. Ideally you would use Wireshark to capture the communication between your Smartphone and the Mediola gateway to look what API commands are sent for each of the functions.

On the other hand, Mediola is quite "chatty" on the UDP Port, broadcasting each and every signal it can decode from either the Air- or the IR interface, "learned" or not. Be sure to set "debug" to "true" in the mqtt section!

Depending on the Mediola Model, you may have to change the UDP Port to 1901 instead of 1902 like I have to do with my V5 (non +) to see the data. Just try a TV-Remote at the Mediola. You should get some log entries of "Received Message" like

EVT:{"type":"IR","data":"19082600000100240508E2045E009600850096019A0096272108E2022C000101010102010201020202020102010201020101010201010201020202010202030403"} or EVT:{"type":"IT","data":"3C5B14A0"} or even EVT:{"type":"","data":"6EE0"}

The last one is my door bell, that I found by chance in the log...

If you get some values, try your remote control for the blinds.

The "Data" might be either some "Standard Protocol" like "IT" or "HE", or they might be "unknown RAW data" like the one in the IR example. Either way, replaying these commands should act the same like pressing the original button, as long as the communication is not encrypted.

... but you may have to configure the blinds as individual "switches".

andyboeh commented 1 year ago

@brookxxl Looks like you speak German, so here is the HTTP API for your blinds: https://mediola.answerbase.com/2007712/Warema-EWFS-Http-Kommandos

Compare that to the first post, looks like the command is static and always the same.

For this simple device, if I were you, I would just create a template cover within Home Assistant and add the HTTP calls as open_cover / close_cover actions. I'm pretty sure that these blinds do not report their position, hence there is no advantage of using mediola2mqtt anyway (compared to Elero blinds that report their position).

@Tomphson71 what did you do in the end?

brookxxl commented 1 year ago

Thanks for all the info. I will try to test the gateway controls tomorrow and will report the result here.

rorso commented 1 year ago

Just for curiosity - can you check whether a button press on your remote does result in a logged "event" within mediola2mqtt?

brookxxl commented 1 year ago

So, unfortunately I didn't have much time to test yet. But the info from @andyboeh was I think exactly what I need. If I call the URL for learning (http://IP of the gateway/command? XC_FNC=LearnSc&type=WA) and then press a button on the remote control, an ID comes as feedback, which I can send again (http://IP of the gateway/command? XC_FNC=SendSC&type=WA&data=ID)

So I can control something directly in HomeAssistant; I have to read up on that, but I can do it. FYI: My remote control has 8 channels and each channel has 6 functions (open, stop, close, A, B, C). So I get 6 ID's that I can use. The functions A, B and C are used to store different positions in advance, e.g. 20%, 50% and 80%. I can then assign them directly. I don't get any feedback on which position the roller shutter is currently located, but I can handle that. Here are the ID's of a channel: Nr. | Zimmer | auf | stopp | zu | A | B | C 1 | Wohnzimmer | 74DC9439 | 34C49439 | 74D89439 | 74C49439 | 74C09439 | 74BC9439

@rorso: I haven't tested much with the log files yet, but no matter what I do (button on the remote control or control via the gateway), nothing is recorded in mediola2mqtt. The only thing there are the entries when starting the add-on. I have already changed the port from 1902 to 1901, but nothing comes.

In the Mosquitto-broker I turned on the debug and there are also many entries no matter if I use 1901 or 1902, or stop mediola2mqtt completely. But unfortunately I can't interpret this lie. But I can post something here again, if there is interest.

brookxxl commented 1 year ago

FYI: I tried to learn the feedback codes of all 8 channels of the remote with each 6 functions via URL. The gateway seems to be very sensitive here though and I've only had a few correct responses. Often only an error came after pressing the button on the remote control. If I try it several times, it will eventually work. Since I have 2 remote controls, I was able to generate some codes with them.

But I noticed that you can quickly add the codes manually, since they follow a certain pattern. Here is my list in Excel. The black numbers were reported back correctly, I added the blue numbers manually:

EWFS-Codes

I therefore assume the following syntax. XXZNRRRR XX = 34 for stop = 74 for everything else Z = counter (always increased by 2) N = fixed number for the controller RRRR = ID of the remote control (since I have 2 remote controls, I can use both numbers or exchange them as desired)

However, the integration into HomeAssistant is more difficult for me than I first thought. I don't know how to create a shutter control map with this information. I have neither a device nor an entity or do I need a helper or an integrity or a special addon? I also can't find a map in the dashboard for the roller shutter control that I could possibly use as a template and I'm not familiar with YAML ☹. One card for each roller shutter with the functions open, stop and close (and possibly A, B, and C) would be ideal. But a discussion about this problem is probably wrong here since it is no longer specifically about mediola2mqtt. Unless I could do something with the ID's here after all?

Many greetings from Germany

andyboeh commented 1 year ago

@brookxxl Check out the template cover: https://www.home-assistant.io/integrations/cover.template/

Yes, this needs to be configured in YAML - but that's easy to learn :)