logo elektroda
logo elektroda
X
logo elektroda

How to Rename openBK Switch Entity and Separate External Switch in HASS with BK7231N?

brazoayeye 24 2
ADVERTISEMENT
  • #1 21581787
    brazoayeye
    Level 3  
    I flashed without problems a device like this one
    I want to use the device with HASS in the most flexible way, I set with default parameters and they works without problems but i'm unable to understand if some features can be used with openBK or if the firmware doesn't support it
      "pins": {
        "6": "TglChanOnTgl;1",
        "7": "Rel;1",
        "23": "Btn_Tgl_All;0",
        "26": "WifiLED_n;0"
      },
      "command": "PowerSave 1",


    Since it can't work with HASS Api (Am I wrong?) I setup MQTT and I recive following informations in HASS:

    How to Rename openBK Switch Entity and Separate External Switch in HASS with BK7231N?

    Here my questions:
    1. Is there a way to change from openBK the "1" name for the switch with a more friendly one? Inside cfg_name i only see device name (Short, full).
    2. Is there a way to see the external switch as a separate identity keeping the switch function on the relay?

    I used another identical device with EspHome with following config:
    esphome: 
      name: "aubess-switch-4"
    bk72xx: 
      board: generic-bk7231n-qfn32-tuya
    
    # Enable Home Assistant API
    api:
    logger:
    ota:
      platform: esphome
    
    wifi:
      power_save_mode: HIGH
      networks:
        - ssid: "Dim-GB"
          password: !secret wifi_password
    
      # Enable fallback hotspot (captive portal) in case wifi connection fails 
      ap: 
    
    binary_sensor: 
      - platform: gpio
        pin: 
          number: P23 
          mode: 
            input: true 
            pullup: true 
          inverted: true
        name: "PB_reset" 
        on_press: 
          - switch.toggle: relay
    
      - platform: gpio 
        pin: 
          number: P6 
          mode: 
            input: true 
            pullup: True 
          inverted: true
        name: "PB_ext"
        on_press: 
          - switch.toggle: relay
        on_release: 
          - switch.toggle: relay
    
      - platform: status 
        name: "Status"
    
    sensor: 
      - platform: wifi_signal 
        update_interval: 30s 
        name: "signal"
      - platform: uptime
        name: "Uptime" 
    
    output: 
      - platform: gpio 
        pin: P26
        id: led
    
    switch: 
      - platform: gpio 
        name: "relay" 
        pin: P7 
        id: relay
        restore_mode: RESTORE_DEFAULT_OFF
        on_turn_on: 
          then: 
            - output.turn_on: led 
        on_turn_off: 
          then: 
            - output.turn_off: led
    
    captive_portal: 


    But i read on internet that even with power_save_mode: HIGH che espHome consumption is much higher than openBK with startup "PowerSave 1".
    Does someone have proof or tested that consumption (and how can you measure it?)

    Last, Is there a well known device with power monitor that I can buy and flash to be used locally without clouds?

    Thanks
  • ADVERTISEMENT
  • #2 21581797
    p.kaczmarek2
    Moderator Smart Home
    What is HASS API? we have HASS Discovery in OBK.

    1. Sure, use SetChannelLabel
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    2. You can set separate channel index for your button or whatever you want, you can also set channel type toggle for that in the web app and it should work good, along with HASS Discovery

    I don't recommend untested software, last time I checked they didn't even have powersave, but I seem to remember that one of our user just copied some of OBK power save to them, maybe not reliably, cause OBK power save requires less frequent tick for dynamic sleep to kick in.
    Helpful post? Buy me a coffee.
  • #3 21581825
    brazoayeye
    Level 3  
    HASS discovery works, but it's an MQTT packet to be sent to HASS to describe the device.
    HASS API is described here and it's also written the main advantages. For me the main advantage is that there is nothing to set up, but also MQTT works well


    1. Perfect, I wrote in app -> Log -> Console "SetChannelLabel 1 switch". It would be useful to have the link you provided directly on the web UI near the console (I tried help w/o results)
    2. I set as shown above, but in hass I only see the switch

    How to Rename openBK Switch Entity and Separate External Switch in HASS with BK7231N?

    setting dInput I see the value in HASS but even if it's ok when I connect a bistable button, it's not good for a push button pressed very fast. It would be better to have a variable that toggles between on and off with the push so I'm sure to detect the push even with network latency.

    Many thanks
ADVERTISEMENT