Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions tasmota/include/xsns_62_esp32_mi.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ struct {
uint32_t updateScan:1;
uint32_t deleteScanTask:1;


uint32_t canConnect:1;
uint32_t willConnect:1;
uint32_t readingDone:1;
Expand Down Expand Up @@ -230,7 +231,7 @@ struct {
uint32_t directBridgeMode:1; // send every received BLE-packet as a MQTT-message in real-time
uint32_t activeScan:1;
uint32_t ignoreBogusBattery:1;
uint32_t minimalSummary:1; // DEPRECATED!!
uint32_t handleEveryDevice:1;
} option;
#ifdef USE_MI_EXT_GUI
uint32_t widgetSlot;
Expand Down Expand Up @@ -271,6 +272,7 @@ struct mi_sensor_t{
uint32_t knob:1;
uint32_t door:1;
uint32_t leak:1;
uint32_t payload:1;
};
uint32_t raw;
} feature;
Expand All @@ -291,6 +293,7 @@ struct mi_sensor_t{
uint32_t longpress:1; //needs no extra feature bit, because knob is sufficient
uint32_t door:1;
uint32_t leak:1;
uint32_t payload:1;
};
uint32_t raw;
} eventType;
Expand Down Expand Up @@ -331,10 +334,15 @@ struct mi_sensor_t{
uint8_t longpress; // dimmer knob pressed without rotating
};
uint8_t door;

};
union {
uint8_t bat; // many values seem to be hard-coded garbage (LYWSD0x, GCD1)
};
struct {
uint8_t * payload = nullptr;
uint8_t payload_len;
};
};

/*********************************************************************************************\
Expand Down Expand Up @@ -475,8 +483,9 @@ enum MI32_BLEInfoMsg {
const char HTTP_BTN_MENU_MI32[] PROGMEM = "<p><form action='m32' method='get'><button>Mi Dashboard</button></form></p>";

const char HTTP_MI32_SCRIPT_1[] PROGMEM =
"function setUp(){setInterval(countUp,1000); setInterval(update,1000);}"
"function countUp(){let ti=document.querySelectorAll('.Ti');"
"function setUp(){setInterval(countUp,1000); setInterval(update,200);}"
"function countUp(){let ti=document.querySelectorAll('.Ti');eb('clock').innerText=Date().slice(4,24);"
"eb('numDev').innerText=eb('pr').childElementCount-1;"
"for(const el of ti){var t=parseInt(el.innerText);el.innerText=t+1;}}"
"function update(){"
"fetch('/m32?wi=1').then(r=>r.text())"
Expand All @@ -499,7 +508,7 @@ const char HTTP_MI32_STYLE[] PROGMEM =
".parent{display:grid;grid-template-columns:repeat(auto-fill,350px);grid-template-rows:repeat(auto-fill,220px);"
"grid-auto-rows:220px;grid-auto-columns:350px;gap:1rem;justify-content:center;}"
"svg{float:inline-end;}"
".box{padding:10px;border-radius:0.8rem;background-color:rgba(221, 221, 221, 0.2);}"
".box{padding:10px;border-radius:0.8rem;background-color:rgba(221, 221, 221, 0.2);overflow-y:auto;}"
"@media screen and (min-width: 720px){.wide{grid-column:span 2;grid-row:span 1;}.big {grid-column:span 2;grid-row:span 2;}}"
".tall {grid-column:span 1;grid-row:span 2;}"
"</style>";
Expand All @@ -515,6 +524,7 @@ const char HTTP_MI32_PARENT_BLE_ROLE[] PROGMEM = "None|Observer|Peripheral|Centr
const char HTTP_MI32_PARENT_START[] PROGMEM =
"<div class='parent'id='pr'>"
"<div class='box tall'><h2>MI32 Bridge</h2>"
"<span id='clock'></span><br><br>"
"Observing <span id='numDev'>%u</span> devices<br><br>"
"Uptime: <span class='Ti'>%u</span> seconds<br><br>"
"Free Heap: %u kB<br><br>"
Expand Down
Loading