libretiny-eu / upk2esphome

Automatically generate ESPHome YAML for Tuya IoT devices
https://upk.libretiny.eu/
MIT License
13 stars 4 forks source link

add remote_receiver yaml block #8

Closed Habbie closed 8 months ago

kuba2k2 commented 9 months ago

Maybe simply call it "remote.py" so that transmitter could be added in future?

As for the copyright, feel free to put your name/nickname there, otherwise remove it (as I didn't write it haha).

Cossid commented 9 months ago

Maybe simply call it "remote.py" so that transmitter could be added in future?

It's a separate component/block for esphome, makes sense to leave them as separate files. I also don't think anything Tuya comes with transmit stuff in the config, that's all programmable stuff.

kuba2k2 commented 9 months ago

The modules aren't named by ESPHome components, but by parts of upk data.

Habbie commented 9 months ago

The modules aren't named by ESPHome components, but by parts of upk data.

ok, ir then?

kuba2k2 commented 9 months ago

ir means infrared only, but reality tells us that RF is used here too. So remote seems appropriate to me.

EDIT: lint checks are failing now, please run black on the project code

Habbie commented 9 months ago

renamed, blacked

kuba2k2 commented 9 months ago

Here's an interesting one: https://tuya-cloudcutter.github.io/api/devices/tuya-generic-ir-rf-universal-remote-controller-v2.0.8.json

    "device_configuration": {
        "crc": 88,
        "infre": 7,
        "infrr": 8,
        "netnc": 0,
        "netyc": 1,
        "owm": 0,
        "rf_study_feq": 0,
        "rsthold": 3,
        "wfst_lv": 1,
        "wfst_pin": 9
    },

image

Apparently it supports both IR and RF, not sure how. Is this a receiver or a transmitter? No idea, but there are both infre and infrr keys.

kuba2k2 commented 9 months ago

Logs from a different (but similar) IR/RF bridge device:

[01-01 18:12:15 TUYA Notice][lr:0x595b5] pConfig = {reset_pin:26,wfst_pin:24,owm:1,reset_lv:0,rsthold:3,wfst_lv:1,netyc:1,infrr:8,netnc:0,infre:7,crc:32,}---config len:103
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:reset_pin:-----val:26----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:reset_lv:-----val:0----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:infre:-----val:7----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:infrr:-----val:8----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:wfst_pin:-----val:24----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:wfst_lv:-----val:1----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:rsthold:-----val:3----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:owm:-----val:1----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:netyc:-----val:1----len:1
[01-01 18:12:16 TUYA Notice][lr:0x59709] key:netnc:-----val:0----len:1
[01-01 18:12:16 TUYA Notice][lr:0x594c7] ir_send =7
[01-01 18:12:16 TUYA Notice][lr:0x594cf] ir_recv =8
[01-01 18:12:16 TUYA Notice][lr:0x594d7] owm =1
[01-01 18:12:16 TUYA Notice][lr:0x594df] led detect_sta =1
[01-01 18:12:16 TUYA Notice][lr:0x594e7] led_num =24
[01-01 18:12:16 TUYA Notice][lr:0x594ef] netn =0
[01-01 18:12:16 TUYA Notice][lr:0x594f7] nety =1
[01-01 18:12:16 TUYA Notice][lr:0x594ff] key detect_sta =0
[01-01 18:12:16 TUYA Notice][lr:0x59507] key_num =26
[01-01 18:12:16 TUYA Notice][lr:0x5950f] long_key_time =3
kuba2k2 commented 9 months ago

Oh, nevermind, they use a CMT2300A chip for RF. These pins are purely for IR RX/TX.

Cossid commented 9 months ago

Correct, infre and infrr are infrared emit and infrared receive. RF is a separate module and not in the config, but on pins P26 & P6 on https://tuya-cloudcutter.github.io/api/devices/tuya-generic-ir-rf-universal-remote-controller-v2.0.8.json

Habbie commented 8 months ago

ok, shall I do all of:

then?

Cossid commented 8 months ago

ok, shall I do all of:

* generate receiver blocks for both `ir` and `infrr`

* generate transmitter blocks for `irfre`

then?

Yes, that sounds correct.

kuba2k2 commented 8 months ago

@Habbie I've removed the copyright line for now, since there was my name and it was incorrect. If you want to add your name there, please comment or make a PR.

Habbie commented 8 months ago

@Habbie I've removed the copyright line for now, since there was my name and it was incorrect. If you want to add your name there, please comment or make a PR.

ah yes, of course. I don't need my name there, git history is enough credit :)

kuba2k2 commented 8 months ago

Oh, I just noticed that yr.found = True is missing, so it can throw a "Found no actual components" error for some devices.