logo elektroda
logo elektroda
X
logo elektroda

OpenBeken with Domoticz: Only 6 of 10 Virtual Switches Detected via MQTT

Honsu 645 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20899624
    Honsu
    Level 3  

    I have a 10-button touch switch. In it I additionally created 10 switches. Configuration in autoexec.bat file
    One text field and a timer field.
    Domoticz via MQTT detects 10 physical switches and only 6 of the 10 virtual ones.
    Where to look for the cause of this condition. I would like to see 20 switches in domoticz.
  • ADVERTISEMENT
  • Helpful post
    #2 20901189
    p.kaczmarek2
    Moderator Smart Home
    And does Home Assistant detect all buttons?
    Additionally... I am not familiar with Domoticz, how does Domoticz detect the buttons?

    Can you post your autoexec.bat here so I can test it on my side with HA?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20927280
    Honsu
    Level 3  
    Sorry it took so long
    I have installed Home Assistant. I am a novice user of this system.
    It also only detects 16 of the 20 buttons.

    My code.
    startDriver TuyaMCU
    
    
    setChannelType 1 toggle
    setChannelType 2 toggle
    setChannelType 3 toggle
    setChannelType 4 toggle
    setChannelType 5 toggle
    setChannelType 6 toggle
    setChannelType 7 toggle
    setChannelType 8 toggle
    setChannelType 9 toggle
    setChannelType 10 toggle
    
    setChannelLabel 1 "1"
    setChannelLabel 2 "2"
    setChannelLabel 3 "3"
    setChannelLabel 4 "4"
    setChannelLabel 5 "5"
    setChannelLabel 6 "6"
    setChannelLabel 7 "7"
    setChannelLabel 8 "8"
    setChannelLabel 9 "9"
    setChannelLabel 10 "10"
    
    // Odwzoruj dpID na kanał 1, dpID typu bool
    // linkTuyaMCUOutputToChannel [dpId][varType][channelID]
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 1 2
    linkTuyaMCUOutputToChannel 3 1 3
    linkTuyaMCUOutputToChannel 4 1 4
    linkTuyaMCUOutputToChannel 5 1 5
    linkTuyaMCUOutputToChannel 6 1 6
    linkTuyaMCUOutputToChannel 102 1 7
    linkTuyaMCUOutputToChannel 103 1 8
    linkTuyaMCUOutputToChannel 104 1 9
    linkTuyaMCUOutputToChannel 105 1 10
    
    
    
    
    setChannelType 21 toggle
    setChannelType 22 toggle
    setChannelType 23 toggle
    setChannelType 24 toggle
    setChannelType 25 toggle
    setChannelType 26 toggle
    setChannelType 27 toggle
    setChannelType 28 toggle
    setChannelType 29 toggle
    setChannelType 30 toggle
    
    
    
    SetChannelVisible 21 0
    SetChannelVisible 22 0
    SetChannelVisible 23 0
    SetChannelVisible 24 0
    SetChannelVisible 25 0
    SetChannelVisible 26 0
    SetChannelVisible 27 0
    SetChannelVisible 28 0
    SetChannelVisible 29 0
    SetChannelVisible 30 0
    
    
    setChannelType 11 TimerSeconds
    setChannelLabel 11  "<b><span style='color:red'\>Pozostały czas</span></b>"
    
    alias All_ON  backlog    POWER1 ON;  POWER2 ON;   POWER3 ON;  POWER4 ON;  POWER5 ON; POWER6 ON; POWER7 ON;  POWER8 ON;   POWER9 ON; POWER10 ON
    
    alias ALL_OFF backlog    POWER1 OFF;  POWER2 OFF;   POWER3 OFF;  POWER4 OFF;  POWER5 OFF; POWER6 OFF; POWER7 OFF;  POWER8 OFF;   POWER9 OFF; POWER10 OFF
    
    alias SET_MEM  backlog setChannel 21 $CH1; setChannel 22 $CH2; setChannel 23 $CH3; setChannel 24 $CH4; setChannel 25 $CH5; setChannel 26 $CH6; setChannel 27 $CH7; setChannel 28 $CH8; setChannel 29 $CH9; setChannel 30 $CH10
    
    alias GET_MEM backlog setChannel 1 $CH21; setChannel 2 $CH22;  setChannel 4 $CH24; setChannel 5 $CH25; setChannel 6 $CH26; setChannel 7 $CH27; setChannel 8 $CH28; setChannel 9 $CH29; setChannel 10 $CH30
    
    setChannelLabel 12  "<b><span style='color:orange'\>Ustaw czas swicenia po wykryciu ruchu  *10sec</span></b>"
    setChannelType 12 TextField
    
    
    setChannel 12 $CH201
    
    
    setChannelType 13 OpenClosed
    
    
    alias enable_60min backlog POWER1 ON; setChannel 11 60*60
    alias enable_30min backlog POWER1 ON; setChannel 11 30*60
    alias enable_30sec backlog POWER1 ON; setChannel 11 30
    
    
    startDriver httpButtons
    setButtonEnabled 0 1
    setButtonLabel 0 "Wlacz na 60 minut"
    setButtonCommand 0 "enable_60min"
    setButtonColor 0 "green"
    
    
    setButtonEnabled 1 1
    setButtonLabel 1"Wlacz na 30 minut"
    setButtonCommand 1 "enable_30min"
    setButtonColor 1 "green"
    
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Wlacz na 30 sekund"
    setButtonCommand 2 "enable_30sec"
    setButtonColor 2 "green"
    
    setButtonEnabled 3 1
    setButtonLabel 3 "ALL ON"
    setButtonCommand 3 "All_ON"
    setButtonColor 3 "green"
    
    
    setButtonEnabled 4 1
    setButtonLabel 4 "ALL OFF"
    setButtonCommand 4 "ALL_OFF"
    setButtonColor 4 "darkred"
    
    
    addEventHandler OnChannelChange 12 backlog    setChannel 11 $CH12*10; setChannel 201 $CH12
    
    
    addEventHandler OnChannelChange 13 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; GET_MEM
    
    addChangeHandler Channel1 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 21 $CH1
    addChangeHandler Channel2 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 22 $CH2
    addChangeHandler Channel3 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*450"
    addChangeHandler Channel3 == 0 setChannel 11 $CH12*10
    addChangeHandler Channel4 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 24 $CH4
    addChangeHandler Channel5 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 25 $CH5
    addChangeHandler Channel6 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 26 $CH6
    addChangeHandler Channel7 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 27 $CH7
    addChangeHandler Channel8 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 28 $CH8
    addChangeHandler Channel9 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 29 $CH9
    addChangeHandler Channel10 == 1 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*10"; setChannel 30 $CH10
    
    addChangeHandler Channel1 == 0 if $CH11>1 then  "setChannel 21 $CH1"
    addChangeHandler Channel2 == 0 if $CH11>1 then  "setChannel 22 $CH2"
    //addChangeHandler Channel3 == 0 backlog if $CH11<$CH12*10 then "setChannel 11 $CH12*450"
    //addChangeHandler Channel3 == 0 setChannel 11 $CH12*10
    addChangeHandler Channel4 == 0  if $CH11>1 then "setChannel 24 $CH4"
    addChangeHandler Channel5 == 0  if $CH11>1 then "setChannel 25 $CH5"
    addChangeHandler Channel6 == 0  if $CH11>1 then "setChannel 26 $CH6"
    addChangeHandler Channel7 == 0  if $CH11>1 then "setChannel 27 $CH7"
    addChangeHandler Channel8 == 0  if $CH11>1 then "setChannel 28 $CH8"
    addChangeHandler Channel9 == 0  if $CH11>1 then "setChannel 29 $CH9"
    addChangeHandler Channel10 == 0  if $CH11>1 then "setChannel 30 $CH10"
    
    
    
    
    again:
    // poczekaj sekunde
    delay_s 1
    
    //jezeli jest ciagle ruch to nie pozwol plynac czasowi
    if $CH13==0&&$CH11<$CH12*10 then "setChannel 11 $CH12*10" 
    
    // jesli kanal zadany ze wzgledu na licznik czasu osiagnal 0, czas wolny
    if $CH11==2   then  SET_MEM  
    if $CH11==1    then  ALL_OFF
    //odejmij jeden od czasu, zacznij na 0 i 99999
    addChannel 11 -1 0 999999
    
    //kontynuj petle w nieskonczonosc
    goto again
    .
  • #4 20927377
    p.kaczmarek2
    Moderator Smart Home
    And are you connecting to Home Assistant via MQTT Discovery?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • Helpful post
    #6 20928467
    p.kaczmarek2
    Moderator Smart Home
    So are you talking about Hass Discovery?

    As far as I can see there is a limit of 16 messages, why aren't you reporting that an error was showing up in the log?
    Screenshot of a program code in Microsoft Visual Studio showing the MQTT_QueuePublishWithCommand function, with the queue limit increased to 32.
    I increased the limit to 32:
    https://github.com/openshwprojects/OpenBK7231...mmit/168334343e3c74ad3c6add39fbc515bef6e53f61
    Now it works for me - there are 20 relays:
    Screenshot of a user interface displaying device information and controls. Screenshot of editing /autoexec.bat with a list of setChannelType commands and a save button. Screenshot of editing /autoexec.bat with a list of setChannelType commands and a save button.
    Helpful post? Buy me a coffee.
  • #7 20930937
    Honsu
    Level 3  

    In OpenBeken one channel setChannelType 11 TimerSeconds.
    Is it possible for HA to see it with the possibility to change it?
    Why does Watcham write me out switch.switch_10_basement_7 [missing] scenes.yaml for all entities.
  • ADVERTISEMENT
  • #8 20931026
    p.kaczmarek2
    Moderator Smart Home
    Honsu wrote:

    Is it possible for HA to see it with the ability to change it?

    At the moment no, but I can add it to Discovery. I would just need you to give me the Yaml code you want to represent the value of this timer. I don't know at the moment, is there a special field type (class) for the timer in HA?

    Honsu wrote:

    Why does Watcham write me switch.switch_10_piwatam_7 [missing] scenes.yaml for all entities.

    Must you provide more information, what is watcham, where are these messages?
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around a user experiencing issues with a 10-button touch switch configured in OpenBeken and Domoticz, where only 6 out of 10 virtual switches are detected via MQTT. The user also tested the setup with Home Assistant, which detected only 16 of the 20 buttons. Responses suggest checking the MQTT Discovery settings and the possibility of a message limit in the configuration. A solution was proposed to increase the message limit to 32, which resolved the issue for one participant. Additionally, there are inquiries about integrating timer functionality into Home Assistant and addressing missing entities in the configuration.
Summary generated by the language model.
ADVERTISEMENT