From 1c39ff6cef1cc94a129cb4154aadac440f03f50a Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Tue, 24 Jan 2023 17:55:28 +1000 Subject: [PATCH] add tuyamcubr_web_sensor to do a simple display of the dp values. (#17776) the format shows the type+dpid on the left hand side (eg, Bool1, Value2, Enum3, etc), and the value with %u on the right hand side. --- .../tasmota_xdrv_driver/xdrv_65_tuyamcubr.ino | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_65_tuyamcubr.ino b/tasmota/tasmota_xdrv_driver/xdrv_65_tuyamcubr.ino index 8b5dc9e07..48697e41e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_65_tuyamcubr.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_65_tuyamcubr.ino @@ -1007,6 +1007,22 @@ tuyamcubr_loop(struct tuyamcubr_softc *sc) * Interface */ +#ifdef USE_WEBSERVER +static void +tuyamcubr_web_sensor(struct tuyamcubr_softc *sc) +{ + struct tuyamcubr_dp *dp; + const struct tuyamcubr_data_type *dt; + + STAILQ_FOREACH(dp, &sc->sc_dps, dp_entry) { + dt = &tuyamcubr_data_types[dp->dp_type]; + + WSContentSend_PD(PSTR("{s}%s%u{m}%u{e}"), + dt->t_name, dp->dp_id, dp->dp_value); + } +} +#endif // USE_WEBSERVER + static const char tuyamcubr_cmnd_names[] PROGMEM = D_CMND_TUYAMCUBR_PREFIX "|" D_CMND_TUYAMCUBR_DATA_BOOL @@ -1067,6 +1083,13 @@ Xdrv65(uint32_t function) case FUNC_AFTER_TELEPERIOD: tuyamcubr_publish(sc); break; +#ifdef USE_WEBSERVER + case FUNC_WEB_ADD_MAIN_BUTTON: + break; + case FUNC_WEB_SENSOR: + tuyamcubr_web_sensor(sc); + break; +#endif // USE_WEBSERVER case FUNC_COMMAND: result = DecodeCommand(tuyamcubr_cmnd_names, tuyamcubr_cmnds);