kind3r / livolo-rf-codes

Generate Home Assistant configuration for Livolo RF switches used via Broadlink RM 2/RM Pro/RM Plus remote
https://kind3r.github.io/livolo-rf-codes/
GNU General Public License v3.0
5 stars 4 forks source link

Support dimmers #1

Closed JoryHogeveen closed 4 years ago

JoryHogeveen commented 4 years ago

First of all, very cool utility you've made here!

Would be awesome if this script would also support dimmers. Codes can be found here: https://forum.arduino.cc/index.php?topic=153525.165#msg_3611201

Remote ID 18287 (VL-RMT-02, 4 button): 8=10 - ON/OFF (toggle) 16=18 - DIM UP (6 modes) 56=58 - DIM DOWN (6 modes) 42=40 - OFF

Remote ID 18288 (VL-RMT-03 or VL-RMT-04, touch): 0=2 - ON/OFF (toggle) 4=6 - SAVE/DELETE SCENE 68=70 - TOGGLE DIM (5 modes) 106=104 - OFF 90=88 - DIM 25% 114=112 - DIM 50% 10=8 - DIM 75% 18=16 - ON

Dim codes only:

16=18 - DIM UP (6 modes) 56=58 - DIM DOWN (6 modes) 90=88 - DIM 25% 114=112 - DIM 50% 10=8 - DIM 75%

JoryHogeveen commented 4 years ago

When/if you are starting on this. Keep in mind that dimmers only come in 1 gang switches. There are no 2 or 3 gang dimmers.

I'll also take a look at your script! Though I'm not as familiar with vue..

kind3r commented 4 years ago

I was about to ask that but I see they are on sale with 2 and 3 gangs but only on italian standard:

https://case-smart.ro/categorie-produs/intrerupatoare-touch/filter_functie/62/filter_brand/livolo/

Vue is very easy to learn (as opposed to angular). Just clone, npm install and npm run serve.

JoryHogeveen commented 4 years ago

Updated https://www.tyjtyj.com/livolo.php for dimmers:

https://github.com/JoryHogeveen/livolo-rf-codes/blob/master/livolo.php

Tested with an extra remoteID for VL-RMT-02 remote (with dim+ and - buttons) and it works perfectly.

Added this how-to to the script:

How to teach your livolo dimmers for use the code (dim+ and dim-)

  1. Generate the code using any VL-RMT-02 buttons. You will need the toggle, dim+ and dim- codes.
  2. Touch Livolo dimmer for 5 sec till you hear a beep.
  3. Send the TOGGLE code. You will hear the beep when Livolo learn correctly.
  4. Send the same code again, your Livolo dimmer should toggle on/off.
  5. Now that this remote is learned by the dimmer it will automatically recognize the dim+ and dim- commands.
kind3r commented 4 years ago

https://github.com/JoryHogeveen/livolo-rf-codes/blob/master/livolo.php

Ah, good, though you have to learn the DIM+/- also, that saves an extra step (altho you still have to learn the TOGGLE and ON/OFF from the 2nd remote). What did you use for remote ID ?

JoryHogeveen commented 4 years ago

I've updated the script again. It now also has a button reference table at the bottom.

I used 32765 for my dim function. And indeed, dimming is a feature for the VL-RMT-02 remote which can only control one dimmer (or multiple with the same signal of course). From the pictures the VL-RMT-03 remote should also feature dimming function but I cant find any reference to the codes for this remote or how it actually works. From the forums I understood that the codes are the same as the VL-RMT-04 (which I have) but it only has less buttons... This is a mystery to me, especially the dimming function for this remote.

I also couldn't find BTN10, Scene 3 and Scene 4 on any of the remotes available online. I added a note in the table for this.

JoryHogeveen commented 4 years ago

One note to add. The DIM+ function also turns on the lights if it's off. The DIM- function doesn't turn of the light if it is at it's lowest dim setting though.

kind3r commented 4 years ago

One note to add. The DIM+ function also turns on the lights if it's off. The DIM- function doesn't turn of the light if it is at it's lowest dim setting though.

Wow, that is great ! :D As I was scratching my head on what to do with the input_boolean assigned with the switch when dimming down as I had no way of knowing when it's really off. I'll upload a commit with the changes for the dimmer in a few minutes on the dimmers branch, would be great if you could give it a test before merging it.

kind3r commented 4 years ago

Ok, so I put a commit in the dimmers branch that includes the dimmers support as follows:

So, for dimmers, an extra learning step is required for the DIM LEARN code, after that the DIM + and DIM - should just work.

If this works 🤞 , I will also update the pairing instructions.

JoryHogeveen commented 4 years ago

Awesome, code looks good. Is there a page I can check or should I set this up locally?

kind3r commented 4 years ago

Awesome, code looks good. Is there a page I can check or should I set this up locally?

Only locally for now, untill we make sure it works (especially the new dimmer +/- remote IDs). Clone repo, checkout dimmers branch, npm i, npm run serve.

JoryHogeveen commented 4 years ago

Just tested the dimmer branch here and it looks good. The HA UI is a bit odd (only available with executing script) but other than that it worked great!

I see you already switch to btn1 for dimmers but how are you finding the correct remote ID's at the moment (for toggle and on/off)?

EDIT: forgot to mention, you have a typo in the generated HA code: broadlink_id should be broadlink_ip

kind3r commented 4 years ago

Just tested the dimmer branch here and it looks good. The HA UI is a bit odd (only available with executing script) but other than that it worked great!

You mean the HA Config tab or in HA itself ? Cause the DIM + and DIM - for now should be only accesible via scripts in HA, don't really know how to implement them any other way. Dimmable lights have a dim slider, but I can't simulate that.

How are you finding the correct remote ID's at the moment?

For the normal remotes I use the following rules:

Same rules for the 4 buttons DIM +/- except they need to have an even number of 1's

EDIT: forgot to mention, you have a typo in the generated HA code: broadlink_id should be broadlink_ip

LOL :) fixed

JoryHogeveen commented 4 years ago

Dimmable lights have a dim slider, but I can't simulate that.

Yeah I couldn't find something quickly at the moment. I'll do some more research but as it looks like now the user will need to add the entities manually to the cards etc. or create a custom UI.

between 16399 and 32767

Alright, if I find anything elke in terms of patterns I'll let you know!

kind3r commented 4 years ago

Do the DIM + and DIM - work ok ? I set them on 64 repeat as I was not sure if they work on repeat while pressed or one press dims x% and you have to re-press for more.

JoryHogeveen commented 4 years ago

Yep, they work fine here! These buttons are a single press, btn B and C on this remote: image

So I don't think you'd need to change the repeat value. I didn't test on longer distances yet.

kind3r commented 4 years ago

Ah, that remote I have, I just thought the one for dimmers is different (similar, but more intuitive, as B and C for dimming ... pff).

kind3r commented 4 years ago

Before I go to bed and forget, looking at the template for lights and considering we have DIM + and assuming we know how many times to repeat the button press to get from 0% to 100%, we could set a certain brightness by turning the light off and then issuing DIM + commands until we reach the required brightness (or close enough). This would take some time (to turn off and go to the desired lvl) but it's better than nothing. Food for thought.

JoryHogeveen commented 4 years ago

Sounds like a cool idea but not sure whether the dimmers would pick this up correctly. I'd be happy to test this if you want but I'm not sure how to create the HA code. Did you find documentation on how to do this? EDIT: I looked at the link you've posted but I can't understand how to "link" a brightness level to a command.