logo elektroda
logo elektroda
X
logo elektroda

[OpenBeken] Push button actions multi press and hold down etc

matt303 7929 37
ADVERTISEMENT
  • #1 20366593
    matt303
    Level 3  
    I'm looking at flashing all my tuya devices and before I do this I want to know if a few things are possible, I have read through docs etc all the commands and GPIO options. I have a few old Tasmota switch devices I use with Home Assistant and want to create same functions with the new Tuya one's, they have the CBU module containing the BK7231N

    In Tasmota I can use Multi press buttons and adjusted to suit my needs. For example I use quick press to switch lights on and off ( physical group of lights connected to the relay ) Now in HA if the lights are on and connected to wifi I use double press for max brightness and triple press for min brightness and if I hold down the button the brightness increases, if it reaches the max then it will decrease the brightness and vice versa in a loop. Note: The lights are grouped in HA also since HA is adjusting the brightness levels etc

    If I remember correctly Tasmota had to be configured so lights switched off on falling edge, but an update fixed this issue, was quite some time ago. There were also some custom rules, but all of these events were sent back to HA so they could be used with Automations etc

    1x press = lights on rising edge/lights switch off falling edge ( I think )
    2x press = max brightness
    3x press = min brightness
    hold press = adjust brightness

    I have added some links to some Tasmota vids containing multi press buttons, hope it helps to understand, I could not find any information about multi button presses with your integration of Tasmota or does it work in the exact same way?









    Here is an example of some of the Tasmota rules:

    Tasmota Dimming Rules
  • ADVERTISEMENT
  • #2 20367050
    p.kaczmarek2
    Moderator Smart Home
    Hello, we are still working on documentation, but the topic was covered in this video:
    https://www.youtube.com/watch?v=KU0tDwtjfjw&feature=emb_title
    Here is example script - autoexec.bat (create file in LittleFS tab in Web App):
    
    // P21 role is Btn, a power button that works without scripting
    // set button hold/repeat/etc times
    SetButtonTimes 10 3 3
    // alias to turn off LED after 4 secs (repeating event with 1 repeat)
    alias add_turnoff_event addRepeatingEvent 4 1 led_enableAll 0
    // button events - 23, 22, etc are pin numbers
    addEventHandler OnHold 23 add_dimmer 10
    addEventHandler OnHold 22 add_dimmer -10
    addEventHandler OnDblClick 22 led_dimmer 5
    addEventHandler OnDblClick 23 led_dimmer 100
    addEventHandler OnClick 20 add_turnoff_event
    // IR events
    addEventHandler2 IR_Samsung 0x707 0x62 add_dimmer 10
    addEventHandler2 IR_Samsung 0x707 0x65 add_dimmer -10
    addEventHandler2 IR_Samsung 0x707 0x61 led_enableAll 0
    addEventHandler2 IR_Samsung 0x707 0x60 led_enableAll 1
    

    23, etc is a pin index for button with Btn or Btn_ScriptOnly role.
    The only thing missing seems to be "OnTripleClick", but I think I can add it for you, if that's needed.

    Basically you set a button role to Btn_ScriptOnly and can assign event handlers for events like OnClick, OnDblClick, OnHoldStart, OnHold, OnRelease...

    We have different syntax because we support script threads from LittleFS, but more about that later.

    We will be also releasing soon a Windows Simulator where you can write scripts and test them without IoT device:
    [OpenBeken] Push button actions multi press and hold down etc

    Here is how your code would look like:
    
    //1x press = toggle relay
    addEventHandler OnClick 23 POWER toggle
    //2x press = max brightness
    addEventHandler OnDblClick 23 led_dimmer 100
    //3x press = min brightness
    // TODO
    //hold press = adjust brightness
    addEventHandler OnHold 23 add_dimmer 10 1
    

    The code above works for LED strip. It's just an example, it might need adjustments for your specific use case.

    Our docs (work in progress):
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md

    You can adjust 'repeat' times with SetButtonTimes...

    Quote:

    lights on rising edge/lights switch off falling edge ( I think )

    I am not sure about that, we support both "toggle channel on toggle" for old style switches with two stable states, and simple "Button" with click, etc events for a momentary switches (that you press down and they come back automatically like a mouse button).


    My question: are you using Tasmota device groups? Or how do you forward dimmer events from switches to lights?

    Dodano po 3 [godziny] 16 [minuty]:

    UPDATE: I have added "triple click" event for you!
    It will be in the next update.
    Just like one could use OnClick or OnDblClick, now we also support events: On3Click and On4Click.

    So now the "triple click" issue is solved, now let's do remaining things together.

    I am still not sure what do you mean by that "falling edge" button, how your button looks irl?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20368069
    matt303
    Level 3  
    Hi p.kaczmarek2 thanks for quick response and adding in those features.

    I think for the edge detection all we need is up and down events similar to JavaScript mouse events

    Quote:
    onmousedown The event occurs when the user presses a mouse button over an element
    onmouseup The event occurs when a user releases a mouse button over an element


    So we could have OnDown and OnUp events for the button, these events are only fired once when the event happens, in JS you can execute a function based on that event, in our case the events can be used with logic which brings me to my next question.

    Can we use logic in the script like IF/Else/ElseIf etc and comparators like < or > etc Is there variables we can use such as global/local and functions etc

    Now back to solving my issue and understanding the script a bit more

    Quote:
    addEventHandler OnDblClick 23 led_dimmer 100


    will the led_dimmer value be sent as an event to HA via MQTT

    Quote:
    addEventHandler OnHold 23 add_dimmer 10 1


    What is the 1 for after the 10?

    does add_dimmer 10 just add 10 to the led_dimmer is there subtract also?

    I would need to add some additional logic for example if the led_dimmer already == to 100 then OnHold will decrease the led_dimmer etc

    Quote:
    My question: are you using Tasmota device groups? Or how do you forward dimmer events from switches to lights?


    My lights are through LocalTuya and I would consider reflashing all of them, hopefully can be done using cloud-cutter as pull out every downlight will be a big job. They are these Kogan Downlight they can't be flashed with Tasmota since they now have the WB3L module.

    I was just using HA Automations to detect the events from tasmota switch and then adjust the brightness, now I have to wait for WIFI to connect first since the switch module relay physically switches power off to the downlights

    I could use Tasmota groups if that will be better, would just need to flash all the downlights.
    What is the best method for converting lot's of devices? In Tasmota you can save the config and then use backup to store the config in all the other devices and just change each device name.
  • #4 20368289
    p.kaczmarek2
    Moderator Smart Home
    matt303 wrote:

    I think for the edge detection all we need is up and down events similar to JavaScript mouse events

    There are indeed OnHoldStart and OnRelease events, and you can set any arbitrary channel in OnHoldStart (command: "setChannel 10 0"), increase it in OnHold (command "addChannel 10 1") and publish in OnRelease (command "publishInt mySpecialVal123 $CH10"), but I am not sure why?

    matt303 wrote:

    Can we use logic in the script like IF/Else/ElseIf etc and comparators like < or > etc Is there variables we can use such as global/local and functions etc

    There is an if command in commands list:
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/docs
    Automatic self testing code can also shed some light on how it's used:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/selftest/selftest_if.c


    matt303 wrote:

    Now back to solving my issue and understanding the script a bit more

    Quote:
    addEventHandler OnDblClick 23 led_dimmer 100


    will the led_dimmer value be sent as an event to HA via MQTT

    Yes, it's like with normal LED driver, it does publish.
    Soon we will also increase the support of Tasmota json syntax for publishes, but it's not ready yet.
    You could also publish anything manually by using:
    
    publishInt YourTopicName $CH12
    

    You can also put math expressions there:
    
    publishFloat YourTopicName $CH12*0.1
    


    matt303 wrote:

    Quote:
    addEventHandler OnHold 23 add_dimmer 10 1


    What is the 1 for after the 10?

    As you can see in the commands docs:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    It's "bWrapAroundInsteadOfHold", so the counter wraps around.

    matt303 wrote:

    does add_dimmer 10 just add 10 to the led_dimmer is there subtract also?


    You can use "add_dimmer -10 1" as well, or you can even do "add_dimmer $CH22 1" - this is an example of using a channel value as a variable. This is how variables are done in our scripts.

    Channel can be used as a loop counter in a script, for example:
    
    setChannel 10 0
    again:
        addChannel 10 1
        if $CH10<3 then goto again
        setChannel 11 234
    

    See related self test:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/selftest/selftest_script.c



    matt303 wrote:

    I would need to add some additional logic for example if the led_dimmer already == to 100 then OnHold will decrease the led_dimmer etc

    If you use the "bWrapAroundInsteadOfClamp" you will get automatically behavior like this: 10% 20% 30% .... 80% 90% 100% 0% 10% 20%
    It's not the same as what you describe (it's wrapping around instead of ping-ponging), but maybe it would be good enough for you?

    If you really want to script your behaviour, it's still possible to do this, I'm just saying bWrapAroundInsteadOfClamp can do all the job.


    matt303 wrote:

    My lights are through LocalTuya and I would consider reflashing all of them, hopefully can be done using cloud-cutter as pull out every downlight will be a big job. They are these Kogan Downlight they can't be flashed with Tasmota since they now have the WB3L module.

    Please submit a teardown for us:
    https://openbekeniot.github.io/webapp/devicesList.html
    We're getting now past 200 devices mark, but some of them are ESP and are on the list for the sake of consistency.


    matt303 wrote:

    I was just using HA Automations to detect the events from tasmota switch and then adjust the brightness, not I have to wait for WIFI to connect first since the switch module relay physically switches power off to the downlights

    With obk, you could even do:
    
    addEventHandler OnDblClick 23 publish MyCoolEvent Click2x
    addEventHandler On3Click 23 publish MyCoolEvent Click3x
    addEventHandler On4Click 23 publish MyCoolEvent Click4x
    

    Remember that we also have "SendGet" command as well.

    matt303 wrote:

    What is the best method for converting lot's of devices? In Tasmota you can save the config and then use backup to store the config in all the other devices and just change each device name.

    We have discussed it here:
    https://www.elektroda.com/rtvforum/topic3942155.html

    If there is any specific feature you need, just tell me, and I will try to implement it for you.
    Helpful post? Buy me a coffee.
  • #5 20368374
    matt303
    Level 3  
    Okay It's all making a lot more sense now how it's all tied together.

    Quote:
    There are indeed OnHoldStart and OnRelease events


    Is there a list for all these events? I can't see them in the commands list or anywhere so don't know if they exist, or do I have to dig through the code for these?

    Quote:
    Yes, it's like with normal LED driver, it does publish.


    Can the publish be disabled? I see this causing issues, for example if I had a switch dimmer module and I want smooth dimming, not steps. So increase dimming value by 1 every 20ms in a loop on button hold, I would suspect this would break MQTT, or is this perfectly fine?

    This leads me to having scenes etc say fade in and out, rainbow, music, moods, reading, movie etc Is there an option to create scenes or select preset scenes. Some of these can be achieved via HA but I don't think the high speed one's can be done. ( I'm referring to the RGBCCT lights here )

    Quote:
    If you use the "bWrapAroundInsteadOfClamp" you will get automatically behavior like this: 10% 20% 30% .... 80% 90% 100% 0% 10% 20%
    It's not the same as what you describe (it's wrapping around instead of ping-ponging), but maybe it would be good enough for you?


    This may be fine, I will have to see how I like it. I like the other way because if it's not quite right It will just start decreasing down from 100 instead of starting at the min value again.

    Quote:
    Please submit a teardown for us:
    https://openbekeniot.github.io/webapp/devicesList.html
    We're getting now past 200 devices mark, but some of them are ESP and are on the list for the sake of consistency.


    Yes I will do tear downs on these devices. I'm in the process of replacing and upgrading my wiring so when this is all ready I will add them all. I will add my test devices when I do them in the next few days.

    Quote:
    Soon we will also increase the support of Tasmota json syntax for publishes, but it's not ready yet.


    Will this allow for full Tasmota support so the HA Tasmota Add On and Auto discovery all work? How soon, as I may just be best to wait for this?

    Quote:
    If there is any specific feature you need, just tell me, and I will try to implement it for you.


    Thanks a lot for this. I did have an idea for the scripting, if you could embed and create C functions for more complex stuff in the future, not needed yet but just a thought.

    Where can I find the simulator to do these tests etc?
  • #6 20370092
    matt303
    Level 3  
    I have now flashed a few of my devices and got them up and running. I did have a few issues with the flashing for both devices, your new flash tool would not work for either of them.

    Tuya CBU module BK7231N I had to use the python tool for both reading the flash and writing Tuya WB3L modules BK7231T I had to use the BKwritter and use that to read the flash and use the python tool to do the write

    Seems odd to me, but maybe you can shed some light on these issues.

    Setting up the RGB CCT light took quite some time since one PWM channel had to be inverted and flag 8 had to be set

    Quote:
    Flag 8 - [LED] Alternate CW light mode (first PWM for warm/cold slider, second for brightness)


    I have noticed HA can take anywhere from 5 - 25 sec to pick up it is available again, is there any way to speed this up or keep it constant?

    I have got the basics of the switch module working, have not tried double/triple and hold yet. I have found a bug/issue I have setup on the start to be -1 to remember last state, this works fine. But if the switch is on and I disconnect power and reapply power the switch switches back on, but if I switch the switch off before it has connected back to wifi it switches itself back on and should stay off.

    I would like to do a tear down for these and post them but I can't find out where the option is to export the config or JSON so it can be added to the list
  • ADVERTISEMENT
  • #7 20370118
    p.kaczmarek2
    Moderator Smart Home
    Hey @matt303 , I will try to answer your questions today or tomorrow, but in general, very good job with flashing and figuring out PWM stuff, I am looking forward to seeing your teardowns.

    I am not sure about the problems with flash tool, I would need to get more information, at least where it fails.

    Again, I will try to reply your remaining questions soon, if you have any more, also feel free to ask.

    PS: we're finalizing a Youtube guide for RGBCW bulb and it will be ready in few hours, so stay tuned.
    Helpful post? Buy me a coffee.
  • #8 20370167
    matt303
    Level 3  
    No problem at all, look forward to the replies. I have made good progress so far and have to go work now anyway so won't be back until later.

    I did just edit my post with a bug/issues and a question regarding HA unavailable and available times.

    Here is a screenshot of tool error hopefully it helps

    [OpenBeken] Push button actions multi press and hold down etc
  • ADVERTISEMENT
  • #9 20370180
    p.kaczmarek2
    Moderator Smart Home
    @matt303 can you double check if it's really a BK7231N device?
    I had this error while testing and it always happened in "trying to read BK7231T in BK7231N mode scenario".
    Helpful post? Buy me a coffee.
  • #10 20370199
    matt303
    Level 3  
    It is an N version as that is what was used when I used the python version of the software here is Tuya datasheet. And the N version firmware loaded on fine and no issues.

    https://developer.tuya.com/en/docs/iot/cbu-module-datasheet?id=Ka07pykl5dk4u

    Added after 9 [hours] 18 [minutes]:

    Is there a way to manually add HA MQTT Auto Discovery as seen like below? Possibly have a JSON output where the yaml output is with all the correct parameters and just run it as a script, this would be a good workaround until auto discovery works for everything?

    https://community.home-assistant.io/t/manually-add-mqtt-entities/264695/7

    The Integration into HA using manual yaml only shows as an entity and not as a device with entities. This is important in order to use HA Automations. In HA Automations you can only select devices and then you can use the entities/attributes. The MQTT in the Automation section is very limited.

    Is there a way to speed up the MQTT Messages to HA? At the moment when holding the button the new values only come through every 1sec ideally 250ms or even 500ms would be better. I think it may be MQTT Explorer reading it slow, as HA MQTT Listening seems a lot faster
  • #11 20370483
    p.kaczmarek2
    Moderator Smart Home
    matt303 wrote:

    Is there a list for all these events? I can't see them in the commands list or anywhere so don't know if they exist, or do I have to dig through the code for these?

    We're still building docs for that one, maybe I will take it as a priority for the upcoming days,
    Currently full list is only in code.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/cmnds/cmd_eventHandlers.c
    EVENT_ParseEventName

    matt303 wrote:

    Can the publish be disabled? I see this causing issues, for example if I had a switch dimmer module and I want smooth dimming, not steps. So increase dimming value by 1 every 20ms in a loop on button hold, I would suspect this would break MQTT, or is this perfectly fine?

    LED driver is using MQTT deduper and culls quick changes (if too many messages wants to be sent, then only the most recent one is send after about a 1 second delay; but that's only for LED params)

    but I can add a flag to disable it, if you want. But... how would you use it with HA later then?

    matt303 wrote:

    This leads me to having scenes etc say fade in and out, rainbow, music, moods, reading, movie etc Is there an option to create scenes or select preset scenes. Some of these can be achieved via HA but I don't think the high speed one's can be done. ( I'm referring to the RGBCCT lights here )

    Theoretically some of those effects could be done via scripts, but I'd prefer to have them in code.
    What kind of animations do you need?


    matt303 wrote:

    This may be fine, I will have to see how I like it. I like the other way because if it's not quite right It will just start decreasing down from 100 instead of starting at the min value again.

    I might think about a solution for your way that does not require advanced scripting because it's a common thing to do and people may benefit from having a ready to go solution (instead of going scripting by hand route)

    matt303 wrote:

    Will this allow for full Tasmota support so the HA Tasmota Add On and Auto discovery all work? How soon, as I may just be best to wait for this?

    It is very hard to tell without specifics, it would be better if you gave a me a list of things you need, for example:
    "I want device to reply to cmnd/obkDevice/STATUS MQTT with payload 08 with such json string [json_content_here]", etc, etc.
    If you gave me such a list (but not a link to entire Tasmota doc, just a link of required messages) then it would be way easier to do.

    I can emulate a chosen set of features for you in code.

    We already have compatibility with Tasmota Control from Google Play.

    matt303 wrote:

    Where can I find the simulator to do these test etc?

    Not yet released, but would you help with testing that? I can make an alpha release for you.


    matt303 wrote:
    Is there a way to speed up the MQTT Messages to HA? At the moment when holding the button the new values only come through every 1sec ideally 250ms or even 500ms would be better. I think it may be MQTT Explorer reading it slow, as HA MQTT Listening seems a lot faster

    Are you really sure? I will need to test that.
    From what I can see, there is no rate limit on channel MQTT publish and on a scripted MQTT publish.
    Only LED params are going through the deduper.

    matt303 wrote:

    Is there a way to manually add HA MQTT Auto Discovery as seen like below? Possibly have an JSON output where the yaml output is with all the correct parameters and just run it as a script, this would be a good work around until auto discovery works for everything?

    This is new to me and seems very useful. Let me process that, so basically you want to write your own JSON and let OBK publish it as it were a autodiscovery? Huh, that's a good idea. I can add it, I think. @iprak , what do you think?
    Helpful post? Buy me a coffee.
  • #12 20370554
    matt303
    Level 3  
    Quote:
    but I can add a flag to disable it, if you want. But... how would you use it with HA later then?


    I don't think it would be needed if it's not possible to overload MQTT messaging.

    Quote:
    Theoretically some of those effects could be done via scripts, but I'd prefer to have them in code.
    What kind of animations do you need?


    I don't need anything as of yet but was just a thought. Would be cool to have music syncing, blinking different set colours, fading in and out, etc WLED project has some cool stuff for LED Strip lighting but may give you some ideas.

    Quote:
    I might think about a solution for your way that does not require advanced scripting because it's a common thing to do and people may benefit from having a ready to go solution (instead of going scripting by hand route)


    Maybe just have it as an second option like addEventHandler OnHold 23 add_dimmer 10 2 ( Instead of 1 )

    Quote:
    I can emulate a chosen set of features for you in code.


    No problem, anything specific I need will just mention it. Is there plans to support different I2C sensors etc

    Quote:
    Not yet released, but would you help with testing that? I can make an alpha release for you.


    If you release an alpha I will give it ago. Can it simulate MQTT so it can be tested with HA like as if it was a physical device?

    Quote:
    Are you really sure? I will need to test that.
    From what I can see, there is no rate limit on channel MQTT publish and on a scripted MQTT publish.
    Only LED params are going through the deduper.


    It may be just some rate limiting built into the MQTT Explorer HA add on
    I have noticed HA is slow to detect when it becomes unavailable, it detects becoming available quicker, but would suspect it to be instant as soon as MQTT is connected or disconnected.

    Quote:
    This is new to me and seems very useful. Let me process that, so basically you want to write your own JSON and let OBK publish it as it were a autodiscovery? Huh, that's a good idea. I can add it, I think. @iprak , what do you think?


    From my understanding they are using the HA scripting function to manually add it as if it was auto discovered. Here are the examples they used:

    ## MQTT Discovery Test
      example_create:
        alias: 'Example MQTT Light - Create'
        sequence:
          service: mqtt.publish
          data:
            topic: 'homeassistant/light/example/config'
            retain: true
            payload: >
              {
                "name": "Example",
                "unique_id": "ABC123",
                "stat_t": "home/example",
                "cmd_t": "home/example/set",
                "bri_stat_t": "home/example/brightness",
                "bri_cmd_t": "home/example/brightness/set"
              }
    
      example_delete:
        alias: 'Example MQTT Light - Delete'
        sequence:
          service: mqtt.publish
          data:
            topic: 'homeassistant/light/example/config'
            retain: true
            payload: ''


    - service: mqtt.publish
            data:
              topic: homeassistant/switch/pool_pump/config
              retain: true
              payload: >
                {
                  "name": "Pool Pump",
                  "state_topic": "home/pump/powerstate",
                  "command_topic": "command/pump/powerstate",
                  "payload_on": "1",
                  "payload_off": "0",
                  "state_on": "1",
                  "state_off": "0",
                  "unique_id": "x10_pool_pump_switch",
                  "device": {
                      "identifiers": ["x10"],
                      "name": "X10 CM11A",
                      "model": "CM11A",
                      "manufacturer": "X10",
                      "sw_version": "1.X"
                  }
                }


    What I thought was in the HA config section where it generates the YAML is to have an option to auto generate this format above with correct parameters, device settings can just be FW for sw_version, manufacture: OpenBeken etc It's just the unique ID that has to be different for multiple of the same device. This is upto to user configuring the device

    Here is some more info on HA scripting ( can be done inside of the YAML file also )
    https://www.home-assistant.io/integrations/script/

    Quote:
    Here you can read device flash directly. RF config is Beken internal configuration memory and Config is our configuration structure.


    Does the config structure hold all of the parameters like pin configs/flags/scripts/startup options etc?
    I see an option to download it but not to restore it?
    This would be a good way if you had multiple of the same devices you could just load the same config file and all you have todo is change the unique IDs/names of the devices
    I don't see any other way of taking a backup of the device and restoring everything. I did read through the post you linked me to but I see that as a difficult way and it's missing your scripts etc if each device has custom scripts you would have to go put them into each device manually.
  • #13 20370591
    p.kaczmarek2
    Moderator Smart Home
    matt303 wrote:

    Maybe just have it as an second option like addEventHandler OnHold 23 add_dimmer 10 2 ( Instead of 1 )

    Yes, I was thinking about the same, I implemented it quickly thanks to Windows Simulator I can develop REALLY FAST and now it's working:
    [OpenBeken] Push button actions multi press and hold down etc
    Here's a commit:
    https://github.com/openshwprojects/OpenBK7231...mmit/949c2541cee0253f9dc4d6fcb2c3a25e6faafab5
    I can implement each requested feature for you, but you just need to be specific in your requirements.


    matt303 wrote:

    No problem, anything specific I need will just mention it. Is there plans to support different I2C sensors etc

    I was going to do software I2C in the upcoming days and more I2C sensors but everything changes very quickly, I am doing things that are requested by users.

    matt303 wrote:

    What I thought was in the HA config section where it generates the YAML is to have an option to auto generate this format above with correct parameters, device settings can just be FW for sw_version, manufacture: OpenBeken etc It's just the unique ID that has to be different for multiple of the same device. This is upto to user configuring the device

    @iprak , what do you think? Add a checkbox to this page:
    [OpenBeken] Push button actions multi press and hold down etc
    [ ] Show HA Discovery format ?

    Dodano po 4 [godziny] 5 [minuty]:

    matt303 wrote:

    If you release an alpha I will give it ago. Can it simulate MQTT so it can be tested with HA like as if it was a physical device?

    I'm getting it done for you now.
    [OpenBeken] Push button actions multi press and hold down etc
    [OpenBeken] Push button actions multi press and hold down etc
    It's almost working. It's gonna be very nice and useful. I am testing with the following script:
    
    addRepeatingEvent 1 -1 backlog addChannel 1 1; publishInt myTestTopic $CH1
    
    Helpful post? Buy me a coffee.
  • #14 20371984
    matt303
    Level 3  
    Quote:
    It's almost working. It's gonna be very nice and useful. I am testing with the following script:


    That's good to hear, I think this would help a lot of people with setting up devices, testing scripts, automations in HA or Node-Red etc

    I did have a few other ideas. With tuyalocal on the RGBCW lights, if you were on the RGB colours/mode and then selected white it would automatically go back to the cw mode and preset setting. Can we have an option flag for the same behavior? At the moment you have to adjust the CW temp slider to go back and try to get it back to where you left it which you may be matched with all the lights in the house

    Another idea, is using the short name as the device's wifi host name? I use angry IP scanner to scan devices on my network and if the host name was the device's short name this would help tracking down the devices and their IPs. When I was mucking around with ESP32s I was able to set host names and have them show up in the scanner. I don't know how the Beken mc work, but I think this would help a lot of people, especially when you are stuck with DHCP on your router (even assigning static ip's in router they still change sometimes) Even having option for manual network settings on the device would help in some situations.

    Quote:
    Does the config structure hold all of the parameters like pin configs/flags/scripts/startup options etc?
    I see an option to download it but not to restore it?
    This would be a good way if you had multiple of the same devices you could just load the same config file and all you have to do is change the unique IDs/names of the devices
    I don't see any other way of taking a backup of the device and restoring everything. I did read through the post you linked me to but I see that as a difficult way and it's missing your scripts etc if each device has custom scripts you would have to go put them into each device manually.


    Do you have any thoughts on this? Maybe option to output config as JSON so it can be loaded straight into DB and same JSON to restore/load device settings
  • #15 20372116
    p.kaczmarek2
    Moderator Smart Home
    Windows Simulator MQTT works, now even with HA Discovery! Development speed will increase again. We can test MQTT stuff without having IoT device (and with Home Assistant on VMWare), so I can develop OBK even while being on plane! Futhermore I can use MSVC debuger in that Windows build, which is also a great improvement over running stuff on BK.




    matt303 wrote:

    I did have a few other ideas. With tuyalocal on the RGBCW lights, if you were on the RGB colours/mode and then selected white it would automatically go back to the cw mode and preset setting. Can we have an option flag for the same behavior? At the moment you have to adjust the CW temp slider to go back and try to get it back to where you left it which you may be matched with all the lights in the house

    Do you mean that selecting 255 255 255 here enables Temperature mode?
    [OpenBeken] Push button actions multi press and hold down etc
    That's.... strange, I must admit. I can do that, but is it really used by people?

    matt303 wrote:

    Another idea, is using the short name as the devices wifi host name?

    It is using the Long Device name, but I can add a flag and make it using short name.
    You mean, that one?
    [OpenBeken] Push button actions multi press and hold down etc
    Please confirm and I will add that flag for you.
    BTW: Look at the "Online for" counter.

    matt303 wrote:

    Quote:
    Does the config structure hold all of the parameters like pin configs/flags/scripts/startup options etc?
    I see an option to download it but not to restore it?
    This would be a good way if you had multiple of the same devices you could just load the same config file and all you have todo is change the unique IDs/names of the devices
    I don't see any other way of taking a backup of the device and restoring everything. I did read through the post you linked me to but I see that as a difficult way and it's missing your scripts etc if each device has custom scripts you would have to go put them into each device manually.


    Do you have any thoughts on this? Maybe option to output config as JSON so it can be loaded straight into DB and same JSON to restore/load device settings

    YES, very good suggestion. It will be done. I can easily test it on Windows.
    I will just note thing: the core device config is separate from LittleFS due to the way LittleFS works to prevent flash wear, but I hope it won't be a problem for you.
    Futhermore, for now, it would be way faster to support simple "download config" and "restore config" in binary form, in a form of a direct memory dump, because we already have that mechanism implemented in Web App...

    Hmmm.... the second option would be to use the existing flash memory REST API for the Web Application and add a whole system in that Web Application, I mean, in Javascript... it would be great because it would have 0 bytes flash memory footprint... I will think about it.

    I hope you are aware how our Web Application works - the native HTTP interface is in flash memory, but Web Application is on Github. It makes everything more lightweight and optimal. We can add many features to Web Application with almost 0 flash memory footprint.

    If you have any other suggestions that I may have missed, please feel free to remind me. I will look into that config stuff in the upcoming days, although I also considered doing software I2C and Windows Simulator release.
    Helpful post? Buy me a coffee.
  • #16 20372156
    matt303
    Level 3  
    Quote:
    Windows Simulator MQTT works, now even with HA Discovery!


    Awesome that will help a lot. Is that including the new JSON script way to manually add discovered devices? I feel that is an important one to get devices working correctly in HA (As I have quickly found out)

    Quote:
    Do you mean that selecting 255 255 255 here enables Temperature mode?


    Yes that's the one, this is great because I may have a temperature set exactly how I like it and all I have to do to get back to it from using RGB is select white and we are back to normal lighting. I think a flag for this option would be fine. For example I may have 8x downlights in my lounge in a group, all I have to do is change the RGB to white and they go back to the CW mode

    Quote:
    It is using the Long Device name, but I can add a flag and make it using short name. You mean, that one?


    Short name would be useful as well since that's what I'm using to name each individual device. But that's interesting it's already using the long name and it's not displaying or showing up in Angry IP scanner, my other devices on my Network do, routers, PCs, Android, RPI etc I will see if I can access the device and ping it using the long name hostname, maybe it's just not broadcasting or something?

    I have just done some tests, I can't access webserver via http://LongName and if I try to ping the long name the host can't be found, may have to look into that one.

    Quote:
    the core device config is separate from LittleFS due to the way LittleFS works to prevent flash wear


    Is it only the script function using LittleFS? I feel if the simulator works well the scripts can be tested on the sim first and then could be put onto the main flash memory?

    Quote:
    I hope you are aware how our Web Application works - the native HTTP interface is in flash memory, but Web Application is on Github. It makes everything more lightweight and optimal. We can add many features to Web Application with almost 0 flash memory footprint.


    Nope I wasn't aware of this... hmmm this could cause issues for me in future. My testing devices currently have Internet access, but all my HA devices are on a wireless VLAN which is blocked from the internet (blocking tuya devices from the cloud) I could use another VLAN for these devices with internet access. It makes sense otherwise that is a lot of web code to store on the MC

    Quote:
    If you have any other suggestions that I may have missed, please feel free to remind me. I will look into that config stuff in the upcoming days, although I also considered doing software I2C and Windows Simulator release.


    You focus on what you think is more important first. I think the adding manual HA discovery is important so the devices can be used correctly in HA, what do you think?
  • #17 20372215
    p.kaczmarek2
    Moderator Smart Home
    Custom JSON is not yet here, but I am aware about it.

    I will do both "white setting" and "short name" flags tomorrow morning.

    Regarding the host name as device address issue.... I am not sure. I don't have experience in this specific field. I know that my Router sees the device host names well:
    [OpenBeken] Push button actions multi press and hold down etc
    so it must be a router issue? Maybe you must configure something on your router to access devices by their host names?
    Or maybe does the device needs to also transmit something else? I never used that host names for local Domain Name Server before...
    matt303 wrote:

    I have just done some tests, I can't access webserver via http://LongName and if I try to ping the long name the host can't be found, may have to look into that one.

    Can you elaborate on that? For me, it doesn't work for Tasmota either. I always access by IP. I assumed that kind of access must use some kind of DNS server on your router so it can resolve the "LongName" to IP.

    matt303 wrote:

    Quote:
    I hope you are aware how our Web Application works - the native HTTP interface is in flash memory, but Web Application is on Github. It makes everything more lightweight and optimal. We can add many features to Web Application with almost 0 flash memory footprint.


    Nope I wasn't aware of this... hmmm this could cause issues for me in future. My testing devices currently have Internet access, but all my HA devices are on a wireless VLAN which is blocked from the internet ( blocking tuya devices from the cloud ) I could use another VLAN for these devices with internet access. It make's sense otherwise that is a lot of web code to store on the MC

    Don't worry, you can always host the javascript files on your own server. Everything is open source. The Web App URL is configurable in options. These days you can host it even on Raspberry Pi-style mini PC consuming 0.5W or so .


    matt303 wrote:

    Is it only the script function using LittleFS? I feel if the simulator works well the scripts can be tested on the sim first and then could be put onto the main flash memory?

    Only scripts are using LittleFS. But....
    I wouldn't worry about that, because you can easily add whole files to LittleFS with REST interface.
    it could be easily automated if needed. That way you could flash hundreds of devices easily along with setting up the script.

    Btw:
    [Tutorial] Provisioning using HomeAssistant
    Helpful post? Buy me a coffee.
  • #18 20375232
    p.kaczmarek2
    Moderator Smart Home
    matt303 wrote:

    Quote:
    Do you mean that selecting 255 255 255 here enables Temperature mode?


    Yes that's the one, this is great because I may have an temperature set exactly how I like it and all I have todo to get back to it from using RGB is select white and we are back to normal lighting. I think a flag for this option would be fine. For example I may have 8x downlights in my lounge in a group, all I have todo it change the RGB to white and they go back to the CW mode

    Added that one:
    https://github.com/openshwprojects/OpenBK7231...mmit/2e142d0463e7ea24db99476ac055e00ec6f72190
    Next one soon
    Helpful post? Buy me a coffee.
  • #19 20375335
    matt303
    Level 3  
    Quote:
    so it must be a router issue? Maybe you must configure something on your router to access devices by their host names?
    Or maybe does the device needs to also transmit something else? I never used that host names for local Domain Name Server before...


    So I opened up a can of worms on this one... decided to update my router ( running OpenWRT ) this worked fine, went to load my backup nothing worked ( was a major update ) so I decided to roll back and it failed halfway through flashing and now bricked... time to pull apart.

    Quote:
    Can you elaborate on that? For me, it doesn't work for Tasmota either. I always access by IP. I assumed that kind of access must use some kind of DNS server on your router so it can resolve the "LongName" to IP.


    Yes the DNS server in your router handles this, most modern routers can do this fine. For example I use Raspberry PI host name to ssh into it and I have been in process of designing ESP32 MPPT charger with wifi web config and I can access it using host name no problem.

    Quote:
    Only scripts are using LittleFS. But....
    I wouldn't worry about that, because you can easily add whole files to LittleFS with REST interface.
    it could be easily automated if needed. That way you could flash hundreds of devices easily along with setting up the script.


    I think this would be the best way and end goal, would be great to keep backups of all your devices also and if you upgrade firmware you can just load your working config back in

    Quote:


    Awesome look forward to testing it when I sort out this damn router issue
  • #20 20375448
    p.kaczmarek2
    Moderator Smart Home
    Well, I hope you will resolve it. If you want, you can take that chance and submit a router teardown for our forum section.

    In a meantime, I added another flag, but it will be working in the following hours, because I must first update the App, and then SDKs, and then App again.
    p.kaczmarek2 wrote:

    matt303 wrote:

    Another idea, is using the short name as the devices wifi host name?

    It is using the Long Device name, but I can add a flag and make it using short name.
    You mean, that one?
    [OpenBeken] Push button actions multi press and hold down etc
    Please confirm and I will add that flag for you.

    https://github.com/openshwprojects/OpenBK7231...mmit/edf16afd9b3da17529608f598a4566bbc9a05604

    We are also finalizing Treatlife flashing guide for our channel:
    https://www.youtube.com/watch?v=KU0tDwtjfjw&ab_channel=Elektrodacom

    More requiring changes will also be done soon.
    Helpful post? Buy me a coffee.
  • #21 20375796
    matt303
    Level 3  
    Quote:
    Well, I hope you will resolve it. If you want, you can take that chance and submit a router teardown for our forum section.


    Luckily I was able to use the MikroTik boot loader recovery and reflash with their RouterOS and then I reflashed with OpenWRT. I have had to reconfigure the whole router manually though which has taken a day to get right with the latest version ( pleased to say the hostnames now show up! )

    As you can see in the picture I can access the device via the hostname! When you get the short name done I will test with devices' short name.

    [OpenBeken] Push button actions multi press and hold down etc

    Quote:
    More requiring changes will also be done soon.


    I will wait until these have been done and test it all out.

    Have you had any other thoughts on adding the JSON Manual MQTT Discovery?
  • #22 20375934
    p.kaczmarek2
    Moderator Smart Home
    It looks like a cool feature, I have never used it before. It seems I must look into my router why my devices are not accessible by hostnames. Futhermore, it seems my browser tries to redirect to google while entering such hostnames.

    I am using SSDP for that kind of thing:
    [OpenBeken] Push button actions multi press and hold down etc
    Just use startDriver SSDP in autoexec.bat or in startup command and you'll get the same.

    The hostname selection flag should work by now.

    No progress yet on Manual MQTT Discovery, for today we have scheduled merge of colours/gamma calibration for LEDs and CHT8305 driver merge. And maybe Treatlife video release and maybe simulator, but it still has one little issue (it has a lag if MQTT is offline, connect must be made non-blocking).
    Recently published video: https://www.youtube.com/watch?v=2e1SUQNMrgY
    You can always give us a like, subscribe or a comment on YT, we're just starting so every activity counts.
    Helpful post? Buy me a coffee.
  • #23 20377141
    matt303
    Level 3  
    Quote:
    It looks like a cool feature, I have never used it before. It seems I must look into my router why my devices are not accessible by hostnames. Furthermore, it seems my browser tries to redirect to google while entering such hostnames.


    Have you entered http://hostname ? Also try in incognito mode in case it's dns cache issue or something in the browser

    Quote:
    Just use startDriver SSDP in autoexec.bat or in startup command and you'll get the same.
    The hostname selection flag should work by now.


    That's interesting and good to know... I don't know if it will in my case since my devices are in an IOT Vlan with different subnet

    Quote:
    Recently published video: https://www.youtube.com/watch?v=2e1SUQNMrgY
    You can always give us a like, subscribe or a comment on YT, we're just starting so every activity counts.


    All done! Have you considered reaching out to the big YT channels to see if they will cover it and do a video to show people how to do it? Or you are not ready for that type of exposure yet?

    Quote:
    No progress yet on Manual MQTT Discovery


    No problem, I will be waiting for this one. It's a major for me in order to properly use my devices in HA
  • #24 20382535
    matt303
    Level 3  
    Just wondering if you support the HA MQTT LWT? I'm having issues where if I disconnect the device from power it still shows as available in HA anywhere from 3 - 5 min and then even timed 7 min once. I have dug into this a little and seems you need to use the MQTT LWT. I can't correctly use automations when the device still thinks it's connected when it's actually long gone. Tasmota/ESPHome use LWT

    https://github.com/dawidchyrzynski/arduino-home-assistant/issues/7

    https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament/

    Quote:
    BIRTH AND LAST WILL MESSAGES
    Home Assistant’s MQTT integration supports so-called Birth and Last Will and Testament (LWT) messages. The former is used to send a message after the service has started, and the latter is used to notify other clients about a disconnected client. Please note that the LWT message will be sent both in case of a clean (e.g. Home Assistant shutting down) and in case of an unclean (e.g. Home Assistant crashing or losing its network connection) disconnect.

    By default, Home Assistant sends online and offline to homeassistant/status.

    MQTT Birth and Last Will messages can be customized or disabled from the UI. To do this, click on “Configure” in the integration page in the UI, then “Re-configure MQTT” and then “Next”.


    I'm hoping this will solve those messages. I also read HA responds better with discovery and a device rather than manually added. I'm going to try manually add the devices via the script method and see if that helps. Will keep you updated.
  • #25 20384629
    p.kaczmarek2
    Moderator Smart Home
    That's a perfect idea, @matt303 . I will try to do so once the Simulator is done. Next fixes were added there last days, along with some generic OBK features like software I2C, etc.c Exciting days are coming!

    I've been also thinking about your "custom json" and I realized that it could be done entirely in the Web App - with 0 extra flash memory footprint. The future is now.

    And again, please note: you don't have to worry about getting web app from the internet, you can just host it yourself on your local network.

    Ok, LWT? I don't know much about LWT, but isn't it just like a "retain"? We support "retain" flags, so sensor can report its state every once and then and HA will keep it. Or is it different?

    No luck for HTTP hostname access for me on my router. Idk what's wrong, the DNS IP is set to the Ip of my router.

    Can I somehow debug it with nslookup or a similar command?
    Helpful post? Buy me a coffee.
  • #26 20385611
    matt303
    Level 3  
    Quote:
    I will try to do so once the Simulator is done. Next fixes were added there last days, along with some generic OBK features like software I2C, etc. Exciting days are coming!


    Sounds like good progress has been made! Looking forward to the future releases! When will the simulator be available?

    Quote:
    I've been also thinking about your "custom json" and I realized that it could be done entirely in the Web App - with 0 extra flash memory footprint. The future is now.


    Would it just be best to focus on the native HA discovery for everything or is that a lot of work to get that working? Having the custom JSON is probably a good feature for any unusual devices that may be added.

    Quote:
    Ok, LWT? I don't know much about LWT, but isn't it just like a "retain"? We support "retain" flags, so sensor can report its state every once and then and HA will keep it. Or is it different?


    It is different. LWT handles how MQTT is disconnect or connection lost. My understanding is the device has a set time out and the broker keeps checking this, if the connection is suddenly lost or power disconnected the broker will detect this automatically and update other clients ( HA in this case ) and HA can instantly change the online and offline status.

    From my reading this is quite important and both ESPHome and Tasmota and few other MQTT integrations all use this. So if timeout on the device was set to 1sec or 5sec the broker will detect this and update and HA will update device status in 1sec or 5sec etc no waiting 5 minutes for the offline status to appear.

    I first thought it was an issue with HA not updating the device... but after digging into this a bit with MQTT Explorer and monitoring the broker, if I disconnected the device from power, the broker was taking 3 - 5 min to change from online to offline, as soon as the broker updated the status changed in HA as well. So I think we need to use LWT to properly update broker on device connection status.

    Quote:
    No luck for HTTP hostname access for me on my router. Idk what's wrong, the DNS IP is set to the Ip of my router.


    Is the DNS server in your router the only DNS server on the Network? You don't have pihole or anything else etc. Does your router support mDNS ( multicasting enabled/supported ) can you assign custom hostname and IP in your router and test if that works? Can you access your router via its hostname? What router have you got?

    Quote:
    Can I somehow debug it with nslookup or a similar command?


    I think your issue will most likely be the router itself and mDNS, I have not used nslookup on local network but if you can see hostname and resolve IP it should work. If you go into cmd and try ping the hostname does it work?
  • #27 20405119
    p.kaczmarek2
    Moderator Smart Home
    If you are interested that much into simulator, maybe I could arrange something for you, maybe a beta, private, only for you build? What do you think?

    Last days were very busy and full of progress. New drivers has been added, including basic Alexa support, ioBroker support (the TELE message was missing but now we are really Tasmota-compatible), BL602 OTA was added (it was missing and it was problematic). Really great progress was made.
    Also a BK7231 datasheet topic was created:
    https://www.elektroda.com/rtvforum/topic3951016.html
    I also added some more automatic self tests, some of them demonstrate special scriptable use cases, here's an example of mapping 0-100 value to 3 relays selecting FAN speed:
    https://github.com/openshwprojects/OpenBK7231.../selftest/selftest_demo_mapFanSpeedToRelays.c

    I will look into that LWT soon.

    I have no other DNS services. My PC network card has DNS set to 192.168.0.1, which is main router. I am using Archer C6 v3.20 and I haven't found a setting for that yet. I've found this guide but it doesn't seem to be helpful, IPTV has nothing to do with what I am looking for:
    https://help.ptzoptics.com/support/solutions/...k-archer-c1200-v3-for-use-with-mdns-multicast
    Cmd says:
    ping TasmotaBathroom
    Ping request could not find host TasmotaBathroom. Please check the name and try again.
    ping TasmotaBathroom.local
    Ping request could not find host TasmotaBathroom.local. Please check the name and try again.
    

    but wait...
    [OpenBeken] Push button actions multi press and hold down etc
    No, there doesn't seem to be anything like that here:
    [OpenBeken] Push button actions multi press and hold down etc
    Helpful post? Buy me a coffee.
  • #28 20405180
    matt303
    Level 3  
    Quote:
    If you are interested that much into simulator, maybe I could arrange something for you, maybe a beta, private, only for you build? What do you think?


    I can wait until the actual release, no real need for it just yet, but will do in the future with a few plans I have.

    Quote:
    Last days were very busy and full of progress


    I have been following and keeping an eye on the progress and looks really good. How are you getting on with HA discovery?

    Quote:
    The TELE message was missing but now we are really Tasmota-compatible


    Does this mean we can use the Tasmota HA integration now?

    On another note and don't know if it will interest you. But I'm looking at building a custom Alarm Control Panel PCB based on an ESP32-S2 and have easy integration into HA but also have it fully operate offline disconnected from HA as redundancy. I will use an RS485 link to a touch screen such as these:

    https://sonoff.tech/product/central-control-panel/nspanel/

    These are very hackable, they use esp chip and a nextion display so can easily use for an independent keypad. As for the control panel it will be designed to use proper alarm sensor with end of line termination resistors, relay and digital outputs, onboard charger, Ethernet WIFI, etc

    I will get started on this once I have completed my MPPT PCB and Firmware

    Quote:
    I am using Archer C6 v3.20


    Have you considered flashing it to OpenWRT?

    https://openwrt.org/toh/tp-link/archer_c6_v3
  • #29 20405231
    p.kaczmarek2
    Moderator Smart Home
    matt303 wrote:

    I can wait until the actual release, no real need for it just yet, but will do in the future with a few plans I have.

    Sending you a private beta is no problem, I can send you on private message and we can keep discussion on the forum. I'll send you exe tomorrow if you want.
    You could help us finding the most obvious issues and bugs.
    Just look at that - that's me testing ioBroker sonoff plugin:



    Can you imagine how fast now development can be?

    matt303 wrote:

    I have been following and keeping an eye on the progress and looks really good. How are you getting on with HA discovery?


    No news on more advanced HA discovery, altough if you want to be able to "discover" custom JSON then I am strongly leaning towards Web App solution because (unless I'm much mistaken) it can be done right now fully in Javascript, with 0bytes flash footprint. And don't worry - as I said, people without internet connection can host that javascript on any mini TCP server, it would be possible even to host that one of the Beken devices, I think...

    Much of the work this month went into our YT channel (but my assistant is mostly doing video cutting and merging stuff and voicing, so maybe it's not that bad....)
    https://www.youtube.com/@elektrodacom
    [OpenBeken] Push button actions multi press and hold down etc
    matt303 wrote:
    Does this mean we can use the Tasmota HA integration now?

    I don't know, would you like to check? If not, I will look into that as well.

    It depends on what kind of packets do they expect and use.

    I have also added aliases for our old commands, so "led_dimmer" is now also "Dimmer", etc. I will also fix "Color" command because in old OBK it was writing directly to PWMs but now we will use it just like in Tasmota (instead of "led_basecolor_rgb").

    matt303 wrote:

    On another note and don't know if it will interest you. But I'm looking at building a custom Alarm Control Panel PCB based of an ESP32-S2 and have easy integration into HA but also have it fully operate offline disconnected from HA as redundancy. I will use an RS485 link to a touch screen such as these:

    https://sonoff.tech/product/central-control-panel/nspanel/

    These are very hackable, they use esp chip and a nextion display so can easily use for an independent keypad. As for the control panel it will be designed to use proper alarm sensor with end of line termination resistors, relay and digital outputs, onboard charger, Ethernet + WIFI, etc

    I will get started on this once I have completed my MPPT PCB and Firmware

    Very nice project, I would do it myself but right now I am very busy with OpenBK. Still, if you're doing that, you can consider posting it on our forums to get some free gifts: https://www.elektroda.com/rtvforum/topic3950844.html


    matt303 wrote:

    Have you considered flashing it to OpenWRT?

    https://openwrt.org/toh/tp-link/archer_c6_v3

    I'm only aware about the existence of such firmware and I saw the UART ports while doing router teardowns, I haven't time to play around with it yet. I will most likely choose to flash it at some point in the future (and make an article about it) but I will need first to consider the risks, I hope the risk of bricking the router is not high.
    Helpful post? Buy me a coffee.
  • #30 20618932
    jrhenk
    Level 10  

    Hi!
    I ran into a small issue with the OnHold condition: I want it to send an MQTT message but only do it once - with using delay and stop in HA automations as a workaround I can prevent HA from doing the same thing multiple times a bit better and I get that for dimming it's nice if it keeps repeating the same action, but if you want to use it for only on/off it would be great if there would be an "OnHoldOnce" option. Or maybe there is something like this already?

Topic summary

The discussion revolves around the implementation of multi-press and hold actions for Tuya devices using the OpenBeken firmware, specifically targeting devices with the BK7231N module. Users seek to replicate functionalities from Tasmota, such as controlling light brightness through various button presses and holds. The conversation includes scripting examples for button actions, event handling, and MQTT integration with Home Assistant (HA). Key features discussed include OnHoldStart, OnRelease events, and the need for improved documentation. Users also address issues with flashing devices, MQTT message delays, and the importance of Last Will and Testament (LWT) for device status updates in HA. Suggestions for enhancements, such as custom JSON for MQTT discovery and improved LED control, are also proposed.
Summary generated by the language model.
ADVERTISEMENT