logo elektroda
logo elektroda
X
logo elektroda

OpenBeken - WiFi RSSI for Home Assistant Discovery, device_class, yaml

erdeidominik1999 1335 22
ADVERTISEMENT
  • #1 20773414
    erdeidominik1999
    Level 8  
    Hello! Is there any way to report the wifi signal to home assistant?
  • ADVERTISEMENT
  • #2 20773421
    p.kaczmarek2
    Moderator Smart Home
    Hello @erdeidominik1999 . If you check our MQTT docs, here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/mqttTopics.md
    You can clearly see that RSSI value is being published periodically on MQTT, however, you may need to enable "broadcast self state" flag first.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20773453
    erdeidominik1999
    Level 8  
    Thank you, @p.kaczmarek2, and is there a way to autodiscover it in HA? Also to send in percent not only RSSI?
  • #4 20775324
    erdeidominik1999
    Level 8  
    Is there a command like tasmota SetOption13 1 to set a button only for single press to reduce delay?
  • ADVERTISEMENT
  • #5 20775464
    p.kaczmarek2
    Moderator Smart Home
    Hello, have you checked our docs?
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md
    Quote:

    6 [BTN] Instant touch reaction instead of waiting for release (aka SetOption 13)

    as per RSSI, I can add it to HA discovery if you want. Do you know what would be the HA yaml type for that?
    Helpful post? Buy me a coffee.
  • #6 20775503
    erdeidominik1999
    Level 8  
    p.kaczmarek2 wrote:
    Hello, have you checked our docs?
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md
    Quote:
    6 [BTN] Instant touch reaction instead of waiting for release (aka SetOption 13)

    as per RSSI, I can add it to HA discovery if you want. Do you know what would be the HA yaml type for that?


    Thank you I missed that flag, it works like a charm.
    I think this is what you search for: https://community.home-assistant.io/t/mqtt-vs-template-inconsistency/434145
  • #7 20775530
    p.kaczmarek2
    Moderator Smart Home
    Yes, it seems it should be easy to add that to the HA discovery. The unit here is dBm. I will try to include it in the tomorrows update.
    Helpful post? Buy me a coffee.
  • #8 20775547
    erdeidominik1999
    Level 8  
    p.kaczmarek2 wrote:
    Yes, it seems it should be easy to add that to the HA discovery. The unit here is dBm. I will try to include it in the tomorrows update.

    Thank you! Yes it's dBm. Can you also add a sensor with percent of wifi signal?
    This is the code:
    int WifiGetRssiAsQuality(int rssi) 
     { 
       int quality = 0; 
      
       if (rssi <= -100) {
         quality = 0;
       } else if (rssi >= -50) {
         quality = 100;
       } else {
         quality = 2 * (rssi + 100);
       }
       return quality;
     }


    And if you need it the icons for rssi:
    mdi:access-point
    , and for percent .
  • #9 20776177
    p.kaczmarek2
    Moderator Smart Home
    Setting the icon does not work for me. Maybe I got JSON wrong:
    Screenshot showing a code snippet using the cJSON library.
    Still, with this code:
    Code: C / C++
    Log in, to see the code

    I got that result:
    Panel with toggles and RSSI value of -1 dBm.
    Ignore -1 value, it's a placeholder for simulator:
    Circuit simulation diagram with four bulbs and a WB3S chip.
    Helpful post? Buy me a coffee.
  • #10 20776517
    erdeidominik1999
    Level 8  
    p.kaczmarek2 wrote:
    Setting the icon does not work for me. Maybe I got JSON wrong:

    Still, with this code:
    Code: c Expand Select all Copy to clipboard
    case HASS_RSSI:
    cJSON_AddStringToObject(info->root, "dev_cla", "signal_strength");
    cJSON_AddStringToObject(info->root, "stat_t", "~/rssi");
    cJSON_AddStringToObject(info->root, "unit_of_meas", "dBm");
    //cJSON_AddStringToObject(info->root, "icon_template", "mdi:access-point");

    break;

    I got that result:

    Ignore -1 value, it's a placeholder for simulator:


    I think it should be icon only not icon_template, not?
  • #11 20779543
    ShellDude
    Level 4  

    I just did something very similar with a DIY BME280 sensor and an ESP32 module.

    If you specify the device_class, HA will assign the appropriate icon for you.

    Looks like you're covered with device_class signal_strength. This is the same one I used.
  • #12 20779997
    p.kaczmarek2
    Moderator Smart Home
    Ok, so it's working correctly? What next can I add?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #13 20780499
    erdeidominik1999
    Level 8  
    Hello!
    Is there any way to edit the autoexec file if I boot to safe mode? I use deep sleep and in safe mode the web app loads only a white page.
  • #14 20780542
    p.kaczmarek2
    Moderator Smart Home
    Hello @erdeidominik1999 , as far as I remember, there are two options:
    1. in safe mode you should get a "do unsafe boot" button on http gui, but i am not sure
    2. in safe mode, you can use this command:
    FAQ excerpt on removing autoexec.bat in safe mode.
    See more on our FAQ:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/faq.md
    Helpful post? Buy me a coffee.
  • #15 20780547
    erdeidominik1999
    Level 8  

    p.kaczmarek2 wrote:
    Hello @erdeidominik1999, as far as I remember, there are two options:
    1. In safe mode, you should get a "do unsafe boot" button on the http GUI, but I am not sure.
    2. In safe mode, you can use this command:


    Yes, the first option works, but after boot, it also loads only a white page.
  • #16 20780554
    p.kaczmarek2
    Moderator Smart Home
    Are you sure, @erdeidominik1999 ? But do you know that Web App scripts are loaded from Github? So if you are connected to the AP of OBK, then Web App will not load?

    You need to have network connection via (for example) cable at the same time and it should work, I think.... if it's not working, let me know, there might be a bug that I need to fix
    Helpful post? Buy me a coffee.
  • #17 20780569
    erdeidominik1999
    Level 8  

    p.kaczmarek2 wrote:
    You need to have a network connection via (for example) cable at the same time, and it should work, I think.... if it's not working, let me know, there might be a bug that I need to fix


    I will try this, thank you!
  • #18 20783688
    erdeidominik1999
    Level 8  

    >>20779997

    Hello!
    I could test it only today, it works fine, the dBm is reported and auto discovered in HA, can you also add the signal in percent with auto discover?
    This is the code to generate:
    int WifiGetRssiAsQuality(int rssi) 
     { 
       int quality = 0; 
      
       if (rssi <= -100) {
         quality = 0;
       } else if (rssi >= -50) {
         quality = 100;
       } else {
         quality = 2 * (rssi + 100);
       }
       return quality;
     }

    Thank you!
  • #19 20840407
    erdeidominik1999
    Level 8  

    Hello @p.kaczmarek2!
    Do you plan to implement this feature or is it a bad idea?
  • #20 20840418
    p.kaczmarek2
    Moderator Smart Home
    I will add this, please wait, or you can look at the current code and open a pull request with it. Sorry for the delay, right now I am working on ZMAI-90 support (RN8209 driver) for a donator.
    Helpful post? Buy me a coffee.
  • #21 20844058
    erdeidominik1999
    Level 8  

    Okay @p.kaczmarek2, I didn't want to hurry you. I read in your description that you want to support Realtek chips. Now I got a smart plug with RTL8710 chipset, if you want I can help with it, but I don't know how to start with it. Also do you plan to support ESP chips in the future? Because I think your firmware is better than Tasmota.
  • #22 21377804
    divadiow
    Level 35  
    RTL87x0Cx is now supported as are ESP32 chips
  • #23 21408142
    erdeidominik1999
    Level 8  
    >>21377804
    Thank you, the problem is that I have RTL8710BX.

Topic summary

The discussion focuses on reporting WiFi RSSI values from OpenBeken devices to Home Assistant (HA) via MQTT. The RSSI is published periodically and requires enabling the "broadcast self state" flag. Integration with HA discovery is possible, with the RSSI reported in dBm and plans to add a sensor reporting WiFi signal strength as a percentage using a provided conversion function. The HA device_class "signal_strength" is recommended for automatic icon assignment. Users encountered issues with icon configuration, resolved by using device_class instead of icon_template. Additional topics include editing autoexec files in safe mode and network requirements for the web app. Support for Realtek RTL87x0Cx and ESP32 chips has been added, with ongoing work on RTL8710 and plans to support more chipsets. The firmware is considered a strong alternative to Tasmota.
Summary generated by the language model.
ADVERTISEMENT