GithubHelp home page GithubHelp logo

xiaomi-hubitat's People

Contributors

a4refillpad avatar alecm avatar alixjg avatar bspranger avatar foz333 avatar gn0st1c avatar guyeeba avatar jmagnuson avatar rinkek avatar ronvandegraaf avatar snalee avatar tmleafs avatar twonk avatar veeceeoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xiaomi-hubitat's Issues

Magic Cube, incorrect Face Handling

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)

Xiaomi Aqara Leak Sensor has issues parsing wet/dry for me

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")
		}
	}
...

Magic Cube Device Handler - lowercase bug

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.

Xiaomi Aqara 2 Button Smart Switch - has no controls

It would appear that the driver for the 2 button control switch has no commands. Where the single button version has the expected on/off controls, for the 2 button version, it has only the reset of battery - nothing for the control of the actual 2 switches
Aqara 2 button switch

Mi Cube: drop action

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.

MQTT Bridge stops working when subscribing to Xiaomi Cube events.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.