veeceeoh / xiaomi-hubitat Goto Github PK
View Code? Open in Web Editor NEWveeceeoh's Xiaomi device drivers for the Hubitat Elevation Hub
License: Apache License 2.0
veeceeoh's Xiaomi device drivers for the Hubitat Elevation Hub
License: Apache License 2.0
Version 0.2.1b I think
It looks like the face extraction is not quite right, changing a couple of lines seems to fix it.
private Map getMotionResult(String value) {
String motionType = value[2..3]
String binaryValue = hexToBin(value[0..1])
Integer sourceFace = Integer.parseInt(binaryValue[2..4],2)
Integer targetFace = Integer.parseInt(binaryValue[5..7],2)
Version 0.7.2 I think
The "description" passed into parse() when wet/dry is missing a lot of the expected fields.
I get
Xiaomi Aqara Leak Sensor: Parsing message: zone status 0x0001 -- extended status 0x00
Xiaomi Aqara Leak Sensor: Parsing message: zone status 0x0000 -- extended status 0x00
Fixed for me by refactoring code in parse to look like:
/ Parse incoming device messages to generate events
// wet/dry message can look like: 'zone status 0x0000 -- extended status 0x00'
// no attrId
def parse(String description) {
displayDebugLog("Parsing message: ${description}")
def status = (description?.startsWith('zone status')) ? description[17] : ""
displayDebugLog("status: ${status}")
// there isn't always an attrId, so the coding for that happens later on
Map map = [:]
// lastCheckin can be used with webCoRE
sendEvent(name: "lastCheckin", value: now())
// Send message data to appropriate parsing function based on the type of report
if (status) {
// Parse dry / wet status report
displayDebugLog("dry/wet status")
map = parseZoneStatusMessage(Integer.parseInt(status))
} else {
def attrId = status ? "" : description.split(",").find {it.split(":")[0].trim() == "attrId"}?.split(":")[1].trim()
displayDebugLog("attrId: ${attrId}")
def encoding = Integer.parseInt(description.split(",").find {it.split(":")[0].trim() == "encoding"}?.split(":")[1].trim(), 16)
displayDebugLog("encoding: ${encoding}")
def valueHex = description.split(",").find {it.split(":")[0].trim() == "value"}?.split(":")[1].trim()
displayDebugLog("valueHex: ${valueHex}")
if (!oldFirmware & valueHex != null & encoding > 0x18 & encoding < 0x3e) {
displayDebugLog("Data type of payload is little-endian; reversing byte order")
// Reverse order of bytes in description's payload for LE data types - required for Hubitat firmware 2.0.5 or newer
valueHex = reverseHexString(valueHex)
}
displayDebugLog("Message payload: ${valueHex}")
if (attrId == "0005") {
displayDebugLog("Reset button was short-pressed")
// Parse battery level from longer type of announcement message
map = (valueHex.size() > 60) ? parseBattery(valueHex.split('FF42')[1]) : [:]
} else if (attrId == "FF01") {
// Parse battery level from hourly announcement message
map = parseBattery(valueHex)
} else {
displayDebugLog("Unable to parse message")
}
}
...
All my xiaomi devices stop working after I update my hubitat to 2.1.7. Any idea about what is going on? Thanks
Line 196, the else if test for attired == "ff05" fails, as the actual device message contains "FF05". I changed the ff to uppercase and all is well with the rotation events.
There appears to be an additional action that the cube reports for dropping it (or throwing it up and catching). It reports as motionType: 00, binaryValue: 00000011
. Would be great to expose this as a new button event.
While you are able to subscribe to some Xiaomi Cube events from the MQTT app, they are never published to the MQTT broker. Further it seems that by virtue of subscribing to Xiaomi Cube events, after awhile the MQTT bridge stops receiving events. Causing a bridge reset (by adding / removing device subscription) restores event processing. Based on this it would seem the issue is with the Xiaomi Cube device driver, however not being familiar with driver requirements in general, not exactly sure what the problem may be.
You of course can make the case that there is no point in subscribing to Xiaomi Cube events if they are not published to the broker, but perhaps the two issues are related and someone more familiar with the code can determine the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.