Closed szupi-ipuzs closed 9 months ago
Hi,
Thank you for your pull request, just to be sure: isn't the S2 in essential not the same as fut089 but with only 1 group? The last week there was a problem receiving fut089 remote signals, thats solved in the latest code. I'm curious to how far these signals are similar?
I have no S2 to test with, but how far are you able to receive S2 commands when you configure a fut089 as light device in ESPhome?
No, as I wrote in #26 , in my tests fut089 type (=protocol 0x25) was not working at all, but I've got some results with fut091 (=protocol 0x21), so I started from that and copied the rest from other formatters.
Not sure about the groups, I still don't really grasp the idea here, tbh. If you look into the code you'll see I've set number of groups to 4, but this was just a copy-paste. Where do I get this number from?
Just to confirm - the convertions seem to be more or less correct, as I've got this setup working fully in HA (with colors!), using eventsensor integration and this simple automation:
alias: MI RF Remote Handler
description: MI RF Remote Handler
trigger:
- platform: state
entity_id:
- sensor.mi_remote_1
attribute: time_fired
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: "{{ (states('sensor.mi_remote_1')|from_json)['state'] == 'ON' }}"
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.woox_ambient_light_light
- conditions:
- condition: template
value_template: "{{ (states('sensor.mi_remote_1')|from_json)['state'] == 'OFF' }}"
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.woox_ambient_light_light
- conditions:
- condition: template
value_template: >-
{{ (states('sensor.mi_remote_1')|from_json).brightness is defined
}}
sequence:
- service: light.turn_on
data:
brightness: >-
{{ (states('sensor.mi_remote_1')|from_json)['brightness'] | int
}}
target:
entity_id: light.woox_ambient_light_light
- conditions:
- condition: template
value_template: "{{ (states('sensor.mi_remote_1')|from_json).kelvin is defined }}"
sequence:
- service: light.turn_on
data:
color_temp_kelvin: "{{ (states('sensor.mi_remote_1')|from_json)['kelvin'] | int }}"
target:
entity_id: light.woox_ambient_light_light
- conditions:
- condition: template
value_template: "{{ (states('sensor.mi_remote_1')|from_json).hue is defined }}"
sequence:
- service: light.turn_on
data:
hs_color:
- "{{ (states('sensor.mi_remote_1')|from_json)['hue'] | int }}"
- >-
{{ (state_attr('light.woox_ambient_light_light',
'hs_color')[1] or 0) }}
target:
entity_id: light.woox_ambient_light_light
- conditions:
- condition: template
value_template: >-
{{ (states('sensor.mi_remote_1')|from_json).saturation is defined
}}
sequence:
- service: light.turn_on
data:
hs_color:
- >-
{{ (state_attr('light.woox_ambient_light_light',
'hs_color')[0] or 0) }}
- >-
{{ (states('sensor.mi_remote_1')|from_json)['saturation'] |
int }}
target:
entity_id: light.woox_ambient_light_light
mode: queued
max: 20
Once I get this polished, I will publish an HA blueprint.
By combining two different packet formatters, I managed to have my Mi Light S2 remote working somewhat - at least the part that decodes packets and sends them to HA. As I don't have any compatible MI light, I am not sure if the converted values make sense. I am hoping someone (possibly with the same remote and the actual light) can help me with that. Or I can post here the raw values sent by remote and we might compare them against other remotes and see if any of them produces exactly the same - then we can re-use this part of code from these remotes. Btw. the manual for this remote can be found here.
BRIGTHNESS CMD=5, ARG=0-100 SATURATION CMD=4, ARG=0-100 KELVIN CMD=3, ARG=0-100 COLOR CMD=2, ARG=255-0 DYNAMIC_MODE_SWITCHING CMD=6, ARG=0-8
I got S2 almost working in HA (ie. use it to control a Wifi-enabled RGB-CCT light), but still working for changing colors - as the remote provides them in hsb and not rgb.
Of course this is not meant to be merged yet, I only opened this PR to ask for help with finishing it :)