mirror of https://github.com/arendst/Tasmota.git
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.
This commit is contained in:
parent
36fd8358d6
commit
1c39ff6cef
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue