logo elektroda
logo elektroda
X
logo elektroda

Настройка прошивки OpenBK для работы с газовым краном. Tuya (RQF-1T)

halfyear360 1011 10
ADVERTISEMENT
  • #1 21272597
    halfyear360
    Level 2  
    Image shows a circuit board with a BK7231N module and various electronic components.
    Close-up of a circuit board with electronic components, including a CBU BK7231N module. Electric valve with a black casing mounted on a metal pipe.

    Данное устройство на CBU = BK7231N. Прошился без проблем.
    Electronic circuit with BK7231N microcontroller with connecting wires. Printed circuit board with mounted electrical components and connected cables.

    Брокер работает, команды проходят. Но есть маленькая проблемка... У крана есть период закрытия... (время поворота). Поскольку протокол MQTT подразумевает доставку... респонденту не сразу. Я бы хотел как-то получать точку начала поворота и флаг о завершении. Если в период поворота пропадет свет, то надо понимать состояние крана... (закрыт или открыт или в середине). Буду благодарен за помощь.
  • ADVERTISEMENT
  • #2 21272630
    p.kaczmarek2
    Moderator Smart Home
    Hello, this probably could be done with scripting. When the turn starts? Which channel is used for Relay?
    See:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Probably something like that could be adjusted to your needs:
    
    // addRepeatingEvent	[IntervalSeconds][RepeatsOr-1][CommandToRun]
    alias publish_after_time addRepeatingEvent 5 1 publish myState moved
    addChangeHandler Channel1 == 1 publish_after_time 
    

    This will publish value "moved" under topic "myState" 5 seconds after channel 1 becomes 1...

    Alternatively, you can just modify OBK source code to suit your needs: https://www.elektroda.com/rtvforum/topic4033833.html#20946719
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21273756
    halfyear360
    Level 2  
    Ваше решение, пока не попробовал, но обязательно попробую и отпишусь. У меня другая проблемка появилась. Хотел прошить второй кран и не смог.. спалил три конвертера USB-> TTL. Я предполагаю, что проблема в конверторах.. они все перегрелись. (китайские чипы нонейм ). Three USB to TTL converters on a paper background with technical graphics and text. Three USB to TTL converters labeled YP-01 on a white background. Screenshot of the BK7231 Easy UART Flasher program with a dropdown menu for baud rate selection. Поэтому просьба : Мне нужен прошивальщик bk7231flasher_1.3.3 с меньшими скоростями порта. Вы не могли бы скомпилировать для меня новое приложение, учитывающее мои пожелания ?

    Программа захватывает порт и пишет, что скорость не поддерживается... :( Очень выручите.

    Added after 10 [hours] 44 [minutes]:

    >>21272630 Этот метод работает. Спасибо за совет.
    ==============================================================
    alias publish_after_time addRepeatingEvent 5 1 publish myState closed
    addChangeHandler Channel1 == 1 publish_after_time
    alias publish_after_time_off addRepeatingEvent1 5 1 publish myState open
    addChangeHandler Channel1 == 0 publish_after_time_off
  • ADVERTISEMENT
  • #4 21391625
    halfyear360
    Level 2  
    Вопрос? Как публиковать данные в формате JSON и сохранить // addChangeHandler Channel1 == 1 publish_after_time //. Просто кранов будет штук 10. И в открытом формате публиковать слишком громоздко для чтения.. Надо в одну строку JSON.
  • ADVERTISEMENT
  • #5 21391642
    p.kaczmarek2
    Moderator Smart Home
    option 1) Tasmota syntax



    Screenshot from a browser showing the result of a command in JSON format with IP address 192.168.0.163.
    Screenshot of a browser showing command results at 192.168.0.163, displaying channel values CH0 and CH1 as 100, and CH5 and CH6 as 0.

    option 2) use script
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/selftest/selftest_mqtt.c
    
    publish myTestDevice/test "{\"temperature\":$CH0,\"humidity\":$CH1}" 1
    

    
    publish myTestDevice/test "{\"temperature\":$CH0,\"humidity\":$CH1}" 1
    

    option 3) do custom driver https://www.elektroda.com/rtvforum/topic4056286.html
    Helpful post? Buy me a coffee.
  • #6 21467096
    halfyear360
    Level 2  
    Если брокер Mosquitto на Keenetic (роутер) зависнет, я могу управлять с ESP32 через wifi по http? Как послать команду (какую) по http на адрес устройства, чтобы закрыть кран? Нужно ли настроить сам девайс?
    .
  • #7 21467251
    p.kaczmarek2
    Moderator Smart Home
    Yes, you can control OBK via HTTP from ESP. To toggle power, send:
    
    http://ipaddress/cm?cmnd=Power%20On
    http://ipaddress/cm?cmnd=Power%20Off
    http://ipaddress/cm?cmnd=Power%20Toggle
    

    Basically, you can send any command this way:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md

    It's the same like in Tasmota.
    Helpful post? Buy me a coffee.
  • #8 21468339
    halfyear360
    Level 2  
    Понял. Протестирую..
    User interface of MQTT Explorer displaying a structure of topics and messages.

    if mystate=opened then need closed !!!
    http://192.168.1.49/cm?cmnd=POWER0

    Спасибо.

    А получить значение myState без mosquitto ?
  • #9 21473571
    halfyear360
    Level 2  
    Я имею одну проблемку... Дело в том, что я использую Mosquitto Бридж (wqtt). Проблема выглядит так. При включении автоматики (ESP32) я получаю состояние с локального брокера, который поднят на модеме Keenetic. Вижу состояние выключен (OFF=0), но в это время приходит сообщение через мост с wqtt (ON=1) (был включен) и мой кран открывается.. при этом команды на открытие от ESP32 не было. Кран открывается.. автоматика начинает работать и снова закрывает кран. Это переключение туда и обратно очень раздражает. А если автомат не включился.. кран так и останется в состояние включен, а это уже беда. Мне надо чтобы РАБОТА крана была под моим контролем. При этом я конечно хочу сохранить возможность управлять краном с ESP32 и через WQTT (облачный брокер). Как это реализовать ?
  • #10 21475126
    halfyear360
    Level 2  
    Пока вижу так :
    1) При включении установить значение "Closed"
    2)
    again: (loop)
    if dev/status==online (ESP32 work) then MqttHost="192.168.1.1"
    else MqttHost="" // или SetChannelPrivate 1 (1 channel)
    goto again

    Как получить dev/status==online ?
  • #11 21530621
    halfyear360
    Level 2  
    Новая микросхема Beken 7231N - необходимо перезаписать загрузчик. Как это сделать ?
    Starting flash new (no backup)!
    Now is: 25 апреля 2025 г. 18:24:33.
    Flasher mode: BK7231N
    Going to open port: COM8.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus failed, will try again - 0/100!
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 1560EB
    Will now search for Flash def in out database...
    Flash def found! For: 1560EB
    Flash information: mid: 1560EB, icName: TH25Q_16HB, manufacturer: TH, szMem: 1000000, szSR: 2, cwUnp: 0, cwEnp: 7, cwMsk: 407C, sb: 2, lb: 5, cwdRd: 05-35-FF-FF, cwdWr: 01-FF-FF-FF
    Entering SetProtectState(True)...
    sr: 0
    sr: 0
    final sr: 0
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    SetProtectState(True) success!
    Going to read encryption key...
    Encryption key read done!
    Encryption key: 00000000 00000000 00000000 00000000
    ^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
    WARNING! Non-standard encryption key!
    Please report to forum https://www.elektroda.com/rtvforum/forum51.html
    Or just try using BK7231M mode
    ^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^

Topic summary

The discussion revolves around configuring the OpenBK firmware for a gas valve (Tuya RQF-1T) using the BK7231N chip. The user successfully flashed the device but faces challenges with the valve's closing period and MQTT protocol delays. They seek a method to publish the start and end states of the valve's movement to monitor its status during power outages. Suggestions include using scripting to publish state changes and modifying the OpenBK source code. The user also encountered issues with USB to TTL converters while attempting to flash a second valve and requested a modified flashing tool with lower baud rates. Additionally, they inquired about publishing data in JSON format for multiple devices to streamline data handling.
Summary generated by the language model.
ADVERTISEMENT