logo elektroda
logo elektroda
X
logo elektroda

[BK7231T] Tuya Smart IR NAS-IR02W6 v3: Flashing & Compatibility Issues with Home Assistant

jpuerto 7677 25
ADVERTISEMENT
  • #1 20325803
    jpuerto
    Level 2  
    Hello, I just got this device and it works perfectly with the Smart life application. Unfortunately, the HA tuya integration does not support the IR devices.

    I have disassembled the device and checked if it is tasmota compatible, but I've found that it's a BK7231T based device. Googling, I have found this forum and I want to share my experience.

    [BK7231T] Tuya Smart IR NAS-IR02W6 v3: Flashing & Compatibility Issues with Home Assistant

    I have tried to read/flash the device with a USB to TTL adapter and with an Arduino as a TTL converter. For both cases, the Windows tool simply does not detect anything. I have tested the two points labeled as RX and TX. Then I load the firmware and click program, the short CEN to GND to reset. The device seems to reset, but nothing is detected. By the LEDs in the USB to TTL adaptor, it looks like it's not getting any data from the BK7231T.

    I have spent some hours on it and I was not able to make it work; I don't see what else could I try.

    Does somebody was able to flash this device? Or have any advice? I have run out of ideas
  • ADVERTISEMENT
  • #2 20326548
    p.kaczmarek2
    Moderator Smart Home
    Have you tried different baud rates? Lower or... a higher, it also might help? What kind of USB to TTL adapter do you have?

    Have you ensured that device has enough current to run?

    How did you exactly connect the device?
    I'd do:
    1. power the device from the cable as usual
    2. connect Rx, TX and GND from USB to UART converter
    3. Start flash operation in bkWriter 1.60
    4. temporary disconnect and reconnect power
    It should proceed. If power reconnect method fails, then CEN should work, but CEN method is tricky, it requires you to short CEN to GND for about 0.25s
    Helpful post? Buy me a coffee.
  • #3 20329162
    thanos_kalos
    Level 6  
    Hello

    I have the same IR Blaster made by CoollSer which is the same as the Tuya.
    I have successfully flashed the device by using the CEN -> GND trick. Naturally I did a lot of trial and error but finally I made it.
    The issue is that the support by the BK7231T project is limited but you can try.
    As a reference use Pin 8: IRrecv , Pin 26: IRsend .
    The issue I am currently facing is that though it was reading the IR codes correctly and sensing back, after some updates it stopped reading and instead is producing an IR output of the following:
    Info:IR:IR IR_PulseDistance 0x91A 0x908 0

    with any IR signal. I am investigating to try to figure out what is causing that.


    [BK7231T] Tuya Smart IR NAS-IR02W6 v3: Flashing & Compatibility Issues with Home Assistant
  • #4 20329239
    p.kaczmarek2
    Moderator Smart Home
    I'll forward this issue to @btsimonh , he might have a better knowledge about our IR integration. Let's hope he finds some time to look into it.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20329256
    btsimonh
    Level 11  
    @thanos_kalos - I'm currently looking at IR, aiming at running the IR fast interrupt (20khz) only when we need to.
    Your issue is not one that I have seen before.
    However, we may wish to change library. Apparently the ESP8266 version has more protocols.
    What I would love is an RX library which works off an edge interrupt, rather than a 50us poll.... and to control TX more exactly (currently it drives the TX from the 50us poll, which introduces some jitter in transmitted segments).

    Let me now if you find anything interesting in your investigations....
    (my IR blaster is N based, but basically the same).
  • #6 20329268
    thanos_kalos
    Level 6  
    Hello

    Upon reflashing the device I start having again the IR Codes back.
    I did try to send some codes like the following and it worked fine.

    IRsend Onkyo 0x80C0 0xA811 0 repeats 0

    Regards and keep up the good job.
  • #7 20341130
    jpuerto
    Level 2  
    p.kaczmarek2 wrote:
    Have you tried different baud rates? Lower or... a higher, it also might help? What kind of USB to TTL adapter do you have?

    Have you ensured that the device has enough current to run?

    How did you exactly connect the device?
    I'd do:
    1. power the device from the cable as usual
    2. connect Rx, TX and GND from USB to UART converter
    3. Start flash operation in bkWriter 1.60
    4. temporary disconnect and reconnect power
    It should proceed. If the power reconnect method fails, then CEN should work, but the CEN method is tricky, it requires you to short CEN to GND for about 0.25s


    Thanks for the reply. I've tested almost everything: different baud rates, power device from different sources, power on connection and CEN connection to ground...

    I don't know the USB to TTL I have, but I have used it to tasmotize other devices before. Also, I have tested with the Arduino as an adapter.

    I'm going to try again next year following your instructions, I think that probably I had a bad wire connection and I messed up while trying to fix it.
  • #8 20342272
    p.kaczmarek2
    Moderator Smart Home
    Maybe TX0 or RX0 is used also for button or for diode and it interferes with flashing?
    Helpful post? Buy me a coffee.
  • #9 20362686
    thanos_kalos
    Level 6  
    thanos_kalos wrote:
    Hello

    Upon reflashing the device I start having again the IR Codes back.
    I did try to send some codes like the following and work fine.

    IRsend Onkyo 0x80C0 0xA811 0 repeats 0

    Regards and keep up the good job.


    Hello and Happy New Year

    All worked well with the IR receiver up to version 1.15.253. After this version almost all the same IR receive signals are interpreted either as unknown or IR_Pulse_Distance.

    I had to revert back to 253 for correct functionality.
    Also please let me know what is the status of the IRsend with MQTT from Home Assistant. I will try to integrate it with SmartIR https://github.com/smartHomeHub/SmartIR on HA.
  • #10 20362740
    p.kaczmarek2
    Moderator Smart Home
    Are you sure that 1.15.253 works and 1.15.254 is already broken? I would need to narrow down which change broke.

    Dodano po 28 [minuty]:

    EDIT:
    [BK7231T] Tuya Smart IR NAS-IR02W6 v3: Flashing & Compatibility Issues with Home Assistant
    Well, according to my quick test with my test device on breadboard, it still works... at least for Samsung.
    [BK7231T] Tuya Smart IR NAS-IR02W6 v3: Flashing & Compatibility Issues with Home Assistant
    
    Chipset: BK7231T
    
    Build: Build on Jan 1 2023 15:58:42 version 1.15.268
    
    Helpful post? Buy me a coffee.
  • #11 20362958
    thanos_kalos
    Level 6  
    Hello

    On my device with 1.15.254 I start having issues. Same distance same Remote with 1.15.253 is being correctly identified with one only fail.

    The following is with 1.15.254
    Info:GEN:dhcp=0 ip=192.168.178.71 gate=192.168.178.1 mask=255.255.255.0 mac=c
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-54,ssid=Home-USR,bssid=80:2a:a8:a1:c0:74 ,channel=9,cipher_type:CCMP
    Info:GEN:dhcp=0 ip=192.168.178.71 gate=192.168.178.1 mask=255.255.255.0 mac=c
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-54,ssid=Home-USR,bssid=80:2a:a8:a1:c0:74 ,channel=9,cipher_type:CCMP
    Info:MQTT:Publishing val IR_UNKNOWN 0x5D142775 0 to BK-IR1/ir/get retain=0
    Info:IR:IR MQTT publish IR_UNKNOWN 0x5D142775 0 took 9ms
    Info:MQTT:Publishing val {"IrReceived":{"Protocol":"UNKNOWN","Bits":32,"Data":"0x5D142775"}} to BK-IR1/RESULT retain=0
    Info:MQTT:Publishing val IR_PulseDistance 0x91A 0x908 0 to BK-IR1/ir/get retain=0
    Info:IR:IR MQTT publish IR_PulseDistance 0x91A 0x908 0 took 9ms
    Info:MQTT:Publishing val {"IrReceived":{"Protocol":"PulseDistance","Bits":32,"Data":"0xA81384C0"}} to BK-IR1/RESULT retain=0
    Info:GEN:dhcp=0 ip=192.168.178.71 gate=192.168.178.1 mask=255.255.255.0 mac=c8:47:8c:00:00:00
    Info:GEN:sta: 1, softap: 0, b/g/n


    With 1.15.253

    Info:GEN:sta:rssi=-43,ssid=Home-USR,bssid=80:2a:a8:a1:c0:74 ,channel=9,cipher_type:CCMP
    Info:IR:IR MQTT publish IR_Onkyo 0x84C0 0xA813 0 took 0ms
    Info:IR:IR MQTT publish IR_Onkyo 0x84C0 0xA813 0 took 1ms
    Info:IR:IR MQTT publish IR_Onkyo 0x84C0 0xA813 0 took 0ms
    Info:IR:IR MQTT publish IR_Onkyo 0x84C0 0xA813 0 took 0ms
    Info:IR:IR MQTT publish IR_PulseDistance 0xA20 0xA0A 0 took 0ms
    Info:IR:IR MQTT publish IR_Onkyo 0x84C0 0xA813 0 took 0ms
    Info:GEN:dhcp=0 ip=192.168.178.71 gate=192.168.178.1 mask=255.255.255.0 mac=c8:47:8c:00:00:00
    Info:GEN:sta: 1, softap: 0, b/g/n
  • #12 20363146
    p.kaczmarek2
    Moderator Smart Home
    BK7231T or N?
    1.15.254 starts having issues, that exact version?

    Can you check that one version?
    https://github.com/openshwprojects/OpenBK7231T_App/releases/tag/1.15.271
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #14 20365664
    p.kaczmarek2
    Moderator Smart Home
    @thanos_kalos so the issue is resolved now? Please be more clear on what is wrong with which version.

    Or are you trying to say that it works on BK7231T but breaks on BK7231N?

    What do you mean by "MQTT integration"? We already publish received IR data to Tasmota format and we also support executing commands through MQTT - so you can send IR send from HA..

    You can execute any command through the MQTT, like cmnd/obkdevice123/IRSend with payload arguments...
    Helpful post? Buy me a coffee.
  • #15 20365674
    thanos_kalos
    Level 6  
    p.kaczmarek2 wrote:
    @thanos_kalos so the issue is resolved now? Please be more clear on what is wrong with which version.

    Or are you trying to say that it works on BK7231T but breaks on BK7231N?

    What do you mean by "MQTT integration"? We already publish received IR data to Tasmota format and we also support executing commands through MQTT - so you can send IR send from HA..

    You can execute any command through the MQTT, like cmnd/obkdevice123/IRSend with payload arguments...


    Hello
    No I meant that I was trying with the BK7231T. I have not tried with BK7231N since I have none.
    As for the MQTT integration the IR receive I know it works. I am checking the IR Send now with MQTT which I thought there was an issue.
    I will try now though.

    Best Regards and thanks for the quick reply and fixations.
  • #16 20365728
    p.kaczmarek2
    Moderator Smart Home
    If there is an issue with IRSend, then it's related to command and not to MQTT. Please tell me a specific use case where it fails.

    MQTT is not "aware" about commands, it just forward them to the device.

    You can execute commands by:
    - MQTT cmnd/obkDev/[CommandText] topic with args payload (like in Tasmota)
    - through HTTP, /cm?cmnd=command (like in Tasmota
    - through scripts (event handlers, etc)
    - through TCP interface (Putty)
    and commands are all the same in all cases
    Helpful post? Buy me a coffee.
  • #17 20367626
    lone
    Level 2  
    For Samsung TV works for me (XXX_topic example) - Chipset: BK7231T - Version: 1.15.163
    on:
    Code: Bash
    Log in, to see the code

    off:
    Code: Bash
    Log in, to see the code
  • #18 20376493
    jorgwici
    Level 1  
    Hi all, this discussion helped me a lot during the last few days in getting this device almost completely working and integrated with HA. Thanks everybody, but in particular all the people who made all of this possible in the first place. Just sharing my experience here. I took off using tuya-cloudcutter, which now supports this device without opening it. I had it opened before, since when I started, it was not yet even mentioned, thus I actually also produced a dump of the original firmware. However, when trying to generate a profile the bktools then still complain about missing data, which is a bit annoying, since I was not able to find how to get that as well. Anyway, since it is now supported, I was able to skip that step and upload version 1.15.272, which first did not work, but after a bit of fiddling and actually uploading it through the serial USB dongle it was all fine. Next step was then to check what to do to get it integrated with HA. I ended up playing around with the custom component SmartIR, which does provide sub-classes of media-player, climate and fan devices. That's neat, but for some things not really required. What I wanted to achieve was the following:

    - Control at least on/off and potentially volume of our really old Samsung TV, which only has IR.
    - Synchronize state with the connected Googlecast device already on HA as a media device.
    - Synchronize state with an Amp which is switched on/off by a WIFI controlled power switch and already on HA.
    - Allow switching using the HA web I/F, but also using a really simple IR remote. This allows people to switch on the setup without touching HA and start streaming content from their phones. The remote I ended up using was an old Apple Front-Row, which only has two buttons and a four way cursor and a centre button.

    Using the logs tab of the flashed IR blaster OpenBK7231T_app web page I decoded all the relevant IR codes for the Samsung TV and the Apple remote and mapped them to MQTT commands of the TV using SmartIR with the provided MQTT integration. I just had to provide the IR codes in a JSON file and change the SmartIR config to read that. After that I had a new media-player representing the TV. Here is the JSON file for the Samsung TV:

    
    {"manufacturer":"Samsung",
      "supportedModels":[
        "HomeTV"
      ],
      "supportedController":"MQTT",
      "commandsEncoding":"Raw",
      "commands":{
        "off":"Samsung 0x707 0x2 2",
        "on":"Samsung 0x707 0x2 2",
        "previousChannel":"Samsung-707-10",
        "nextChannel":"Samsung-707-12",
        "volumeDown":"Samsung-707-B",
        "volumeUp":"Samsung-707-7",
        "mute":"Samsung-707-F",
        "source":"Samsung-707-1",
        "sources": {
    	"Input":"Samsung-707-1",
    	"Channel 0":"Samsung-707-61",
    	"Channel 1":["Samsung-707-61","Samsung-707-61"],
    	"Channel 2":["Samsung-707-61","Samsung-707-61","Samsung-707-61"],
    	"Channel 3":["Samsung-707-61","Samsung-707-61","Samsung-707-61","Samsung-707-61"],
    	"Channel 4":["Samsung-707-61","Samsung-707-61","Samsung-707-61","Samsung-707-61","Samsung-707-61"]
    	},
        "up":"Samsung-707-60",
        "down":"Samsung-707-61",
        "right":"Samsung-707-62",
        "left":"Samsung-707-65",
        "exit":"Samsung-707-2D",
        "return":"Samsung-707-58",
        "menu":"Samsung-707-1A"
      }
    }
    


    The channel part is a bit of a trick, because the TV does only allows toggling through the sources. I also have the code for the HA automations, but I'm still experimenting with those. Quite happy already with the result.

    Also tried to add a DAIKIN aircon, but for some reason the irblaster does not recognize the codes sent by the remote. Will have a look at that later.
  • #19 20395007
    vsfonov
    Level 1  
    Hello, thank you for excellent work!
    I just converted a cheap IR blaster to OpenBeken IOT (FRANKEVER Model: FK-UFO-R4, based on BK7231T). My original plan was to control a Wall AC unit from Fujitsu. I made sure that IR send and receive functions actually work - tested with a Panasonic and Onkyo remotes. However, it turns out that the AC unit uses a more complicated protocol than TV remotes. In Tasmota, it is handled by the IRHVAC command: https://tasmota.github.io/docs/Tasmota-IR/#sending-irhvac-commands, that will probably support the DAIKIN as well.

    So, are there any plans of implementing these protocols in OpenBeken IOT? I have some software development experience and can try to help too.
  • #20 20395078
    p.kaczmarek2
    Moderator Smart Home
    Hello @vsfonov . We are using the IRRemote library just like Tasmota, but we have older version. We simply need to update it. If you want to help, please write here on Github and I can show you what needs to be done:
    https://github.com/openshwprojects/OpenBK7231T_App/issues/526
    I can also help with testing.
    Helpful post? Buy me a coffee.
  • #21 20520354
    grmrgecko
    Level 1  
    Thought I'd share my experience and info for those wanting to flash this device:
    P6 (PWM0) - The button
    P9 (PWM3) - The WiFi Status LED
    P8 (PWM2) - IR Receive
    P26 (PWM5) - IR Send

    Photo of test pads used for flashing:
    [BK7231T] Tuya Smart IR NAS-IR02W6 v3: Flashing & Compatibility Issues with Home Assistant

    I'm still working out how to work with this device. I have found https://developer.tuya.com/en/docs/iot/bk7231t-cob-hardware-design-guideline?id=Ka97u6dz0h8b8 which shows the chipset details.

    Firmware version 1.15.639 seems to be working for me.
  • ADVERTISEMENT
  • #22 20760957
    dipish
    Level 7  

    I have the same device but with BK7231N on board.

    The button input on P6 (PWM0) does not work. I tried to find another solution and tested everything in GPIO doctor, but found nothing.
  • #23 20761124
    p.kaczmarek2
    Moderator Smart Home
    What about Tuya Config partition?
    https://www.youtube.com/watch?v=WunlqIMAdgw
    Helpful post? Buy me a coffee.
  • #24 20765755
    dipish
    Level 7  

    afaik there is no readable information

    Code: Text
    Log in, to see the code



    TUYA JSON:
    Code: JSON
    Log in, to see the code

  • #25 21098915
    dappeloe
    Level 1  
    jorgwici wrote:
    Hi all, this discussion helped me a lot during the last few days in getting this device almost completely working and integrated with HA. Thanks everybody, but in particular all the people who made all of this possible in the first place. Just sharing my experience here. I took off using tuya-cloudcutter, which now supports this device without opening it. I had it opened before, since when I started, it was not yet even mentioned, thus I actually also produced a dump of the original firmware. However, when trying to generate a profile the bktools then still complain about missing data, which is a bit annoying, since I was not able to find how to get that as well. Anyway, since it is now supported, I was able to skip that step and upload version 1.15.272, which first did not work, but after a bit of fiddling and actually uploading it through the serial USB dongle it was all fine. Next step was then to check what to do to get it integrated with HA. I ended up playing around with the custom component SmartIR, which does provide sub-classes of media-player, climate and fan devices. That's neat, but for some things not really required. What I wanted to achieve was the following:

    - Control at least on/off and potentially volume of our really old Samsung TV, which only has IR.
    - Synchronize state with the connected Googlecast device already on HA as a media device.
    - Synchronize state with an Amp which is switched on/off by a WIFI controlled power switch and already on HA.
    - Allow switching using the HA web I/F, but also using a really simple IR remote. This allows people to switch on the setup without touching HA and start streaming content from their phones. The remote I ended up using was an old Apple Front-Row, which only has two buttons and a four way cursor and a centre button.

    Using the logs tab of the flashed IR blaster OpenBK7231T_app web page I decoded all the relevant IR codes for the Samsung TV and the Apple remote and mapped them to MQTT commands of the TV using SmartIR with the provided MQTT integration. I just had to provide the IR codes in a JSON file and change the SmartIR config to read that. After that I had a new media-player representing the TV. Here is the JSON file for the Samsung TV:

    
    {"manufacturer":"Samsung",
      "supportedModels":[
        "HomeTV"
      ],
      "supportedController":"MQTT",
      "commandsEncoding":"Raw",
      "commands":{
        "off":"Samsung 0x707 0x2 2",
        "on":"Samsung 0x707 0x2 2",
        "previousChannel":"Samsung-707-10",
        "nextChannel":"Samsung-707-12",
        "volumeDown":"Samsung-707-B",
        "volumeUp":"Samsung-707-7",
        "mute":"Samsung-707-F",
        "source":"Samsung-707-1",
        "sources": {
       "Input":"Samsung-707-1",
       "Channel 0":"Samsung-707-61",
       "Channel 1":["Samsung-707-61","Samsung-707-61"],
       "Channel 2":["Samsung-707-61","Samsung-707-61","Samsung-707-61"],
       "Channel 3":["Samsung-707-61","Samsung-707-61","Samsung-707-61","Samsung-707-61"],
       "Channel 4":["Samsung-707-61","Samsung-707-61","Samsung-707-61","Samsung-707-61","Samsung-707-61"]
       },
        "up":"Samsung-707-60",
        "down":"Samsung-707-61",
        "right":"Samsung-707-62",
        "left":"Samsung-707-65",
        "exit":"Samsung-707-2D",
        "return":"Samsung-707-58",
        "menu":"Samsung-707-1A"
      }
    }
    


    The channel part is a bit of a trick, because the TV does only allows toggling through the sources. I also have the code for the HA automations, but I'm still experimenting with those. Quite happy already with the result.

    Also tried to add a DAIKIN aircon, but for some reason the irblaster does not recognize the codes sent by the remote. Will have a look at that later.




    I created an account just for posting this reply.
    Between this forum, and a few others (regarding MQTT publishing), I have gotten my little "SENCKIT" IR receiver/blaster working in Home Assistant -- it is functional but not a fully GUI with a bunch of easy wizard menus.

    Link to Product: https://www.amazon.co.uk/dp/B0BFQYK7ZW

    My device is indeed running on a BK7231N chip.
    My pins are:

    "pins": {
    "6": "Btn;0",
    "7": "IRSend;0",
    "8": "IRRecv;0",
    "9": "WifiLED_n;0"
    },

    And I've set the device to listen on a brand-new MQTT Topic called "IR-Blaster".

    As mentioned in the quoted text, if you simply go to the OpenBK7231N_app web page and click on the 'logs' panel (deselect everything except for CMD, IR, and MQTT to declutter the noise) : and then point an IR remote at the device and click a button, you'll see a readout on the logline of what IR signal was received. Let's use an example of an IR signal that I've been working with. On my soundbar, the 'Volume Up' Button on the remote sent the signal "IR_Samsung 0x2C2C 0x17 0 (32-bits)" (as recorded in the logs).

    To have the IR blaster send out this signal using Home Assistant -- I made a new script, and the action was 'MQTT Publish'.
    Topic: cmnd/IR-Blaster/IRSend
    Payload: Samsung-2C2C-17-0-32

    Then I simply made a new button on my dashboard which activates that script each time I press it.

    So far, I have my little IR blaster controlling some electronic candles, the TV Power ON/OFF, and the soundbar volume.
  • #26 21151293
    ivanconde
    Level 4  
    Will we get IRHVAC decode at some point?

    Thanks to this now I can read and reply to my IR commands, which is great, but in JSON I have raw HEX and it would be great to understand what did I send (change mode? which setpoint?)

    Thanks for this neat work!

Topic summary

The discussion revolves around flashing and compatibility issues with the Tuya Smart IR NAS-IR02W6 v3 device, which is based on the BK7231T chipset. Users report successful integration with the Smart Life app but face challenges with Home Assistant (HA) due to the lack of support for IR devices. Various methods for flashing the device using USB to TTL adapters and Arduino are explored, with suggestions to try different baud rates and ensure proper connections. Some users successfully flashed similar devices, while others encountered issues with firmware updates affecting IR functionality. The conversation also touches on MQTT integration for IR commands and the need for improved library support for IR protocols. Users share experiences with different firmware versions and troubleshooting steps, including the use of tuya-cloudcutter for easier flashing without disassembly.
Summary generated by the language model.
ADVERTISEMENT