diff --git a/docs/README.md b/docs/README.md index 512f3b11b..245dcf43b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ Do not add anything here, as it will overwritten with next rebuild. | [FAQ](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/faq.md) (27 total) | Here is a detailed list of questions you may ask. Some information from docs is repeated here. | | [Console/Script commands](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md) (278 total) | There are multiple console commands that allow you to automate your devices. Commands can be entered manually in command line, can be send by HTTP (just like in Tasmota), can be send by MQTT and also can be scripted. | | [Command Examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commandExamples.md) (10 total) | Here you can find some examples of console commands usage | -| [Autoexec.bat examples (configs)](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md) (16 total) | Here you can find examples of autoexec.bat configs. The autoexec.bat file can be created in Web Application, under LittleFS tab, and is run every time device reboots (unless device enters safe mode/AP mode). The autoexec.bat file allows you to create more advanced configs, setup TuyaMCU mappings, etc | +| [Autoexec.bat examples (configs)](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md) (17 total) | Here you can find examples of autoexec.bat configs. The autoexec.bat file can be created in Web Application, under LittleFS tab, and is run every time device reboots (unless device enters safe mode/AP mode). The autoexec.bat file allows you to create more advanced configs, setup TuyaMCU mappings, etc | | [MQTT Topics](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/mqttTopics.md) (25 total) | MQTT topic names and content for incoming and ougoing OBK MQTT publishes | -| [Script examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/scriptExamples.md) (5 total) | Scripts can be put in autoexec.bat and then they will start automatically on reboot, you can also put script in other LittleFS file and use startScript [fileName] [Label] command to run them. From the firmware point of view, scripts and autoexecs are basically the same thing. There is, however, a little bit more advanced system of execution for scripts which can be written in a form of scripts threads that run over time, can have delays within then, conditional checks and jumps. | +| [Script examples](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/scriptExamples.md) (6 total) | Scripts can be put in autoexec.bat and then they will start automatically on reboot, you can also put script in other LittleFS file and use startScript [fileName] [Label] command to run them. From the firmware point of view, scripts and autoexecs are basically the same thing. There is, however, a little bit more advanced system of execution for scripts which can be written in a form of scripts threads that run over time, can have delays within then, conditional checks and jumps. | | [Console/Script commands [Extended Edition]](https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md) (278 total) | More details on commands. | diff --git a/src/httpserver/hass.c b/src/httpserver/hass.c index ea4d23641..bf9069fcf 100644 --- a/src/httpserver/hass.c +++ b/src/httpserver/hass.c @@ -273,8 +273,14 @@ HassDeviceInfo* hass_init_device_info(ENTITY_TYPE type, int index, char* payload /// @brief Initializes HomeAssistant relay device discovery storage. /// @param index /// @return -HassDeviceInfo* hass_init_relay_device_info(int index, ENTITY_TYPE type) { - HassDeviceInfo* info = hass_init_device_info(type, index, "1", "0"); +HassDeviceInfo* hass_init_relay_device_info(int index, ENTITY_TYPE type, bool bToggleInv) { + HassDeviceInfo* info; + if (bToggleInv) { + info = hass_init_device_info(type, index, "0", "1"); + } + else { + info = hass_init_device_info(type, index, "1", "0"); + } sprintf(g_hassBuffer, "~/%i/get", index); cJSON_AddStringToObject(info->root, "stat_t", g_hassBuffer); //state_topic diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 562871f7c..906bf3ae7 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -278,11 +278,12 @@ int http_fn_index(http_request_t* request) { if (BIT_CHECK(g_hiddenChannels, i)) { continue; // hidden } + bool bToggleInv = channelType == ChType_Toggle_Inv; if (h_isChannelRelay(i) || channelType == ChType_Toggle) { if (i <= 1) { hprintf255(request, "