Widget designed for 1x1 habpanel dashboard grid
Note: Use 100% of browser zoom
things/*.things file:
Thing mihome:sensor_magnet:YOUR ID "Xiaomi Door Sensor" [itemId="YOUR ID"]
items/*.items file:
// Xiaomi Window Switch Contact WindowSwitch_Status "Window State" { channel="mihome:sensor_magnet:YOUR ID:isOpen" } Number WindowSwitch_AlarmTimer "Window Alarm Timer" { channel="mihome:sensor_magnet:YOUR ID:isOpenAlarmTimer" } DateTime WindowSwitch_LastOpened "Window Last Opened [%1$tY-%1$tm-%1$td %1$tH:%1$tM]" { channel="mihome:sensor_magnet:YOUR ID:lastOpened" } Number WindowSwitch_Battery "Window Battery" { channel="mihome:sensor_magnet:YOUR ID:batteryLevel" } Switch WindowSwitch_BatteryLow "Window Battery Low" { channel="mihome:sensor_magnet:YOUR ID:lowBattery" }
sitemaps/*.sitemap file:
Switch item=WindowSwitch_Status label="Window status" mappings=[OPEN="Opened"] visibility=[WindowSwitch_Status==OPEN] Switch item=WindowSwitch_Status label="Window status" mappings=[CLOSED="Closed"] visibility=[WindowSwitch_Status==CLOSED] Text item=WindowSwitch_LastOpened label="Opened timed" visibility=[WindowSwitch_Status==OPEN] Text item=WindowSwitch_LastOpened label="Closed time" visibility=[WindowSwitch_Status==CLOSED]
persistence/mysql.persist file:
WindowSwitch_Status : strategy = everyChange, everyDay, restoreOnStartup WindowSwitch_Battery : strategy = everyChange, everyDay, restoreOnStartup

