npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

midea-msmarthome-ac-euosk105

v1.1.1

Published

This package contains a Typescript implementation of the Midea MSmartHome AC API via the osk105 wifi adapter.

Downloads

571

Readme

MIDEA-MSMARTHOME-AC-EUOSK105

This package contains NodeJS based services to control Midea devices via the Local Area Network (V3 protocol) using the EU-OSK105 wifi dongle. The package has been used as the underlying library for airconditioners control via the Homey Pro 2023 and has been tested against various split unit airconditioning devices from Carrier.

The library requires an MSmartHome account.

The knowledge to create this library is based on reverse engineering (LUA scripts, documents on the web etc.). Special thanks to Mac ZHou, NeoAcheron, Nenad Bogojevic and Rene Klootwijk.

How to use

The Driver is the entrypoint of the service library and can be used to discover devices and retrieve one specific device based on its ID.

	Driver.listDevices().then(devices: Device[] => {
		console.log(util.inspect(devices)); /* circular */
	})

Various actions have been implemented using the Command design pattern (Get/SetState, GetCapabilities``, ListAppliances and ListHomeGroups). In this example we retrieve the state from a device (GetStateCommand) and re-use that state object to adjust the device (SetStateCommand). The GetStateResponse and the SetStateCommand are subclasses of the DeviceState class.

Authentication is done by device.authenticate(...). It accepts a SecurityContext object with the MSmartHome account email address and its password. It returns an updated SecurityContext with the cloud and local area network accesstoken and the TOKEN and KEY of the airconditioning appliance (necessary for the v3 communication protocol). Each device needs to be authenticated individually.

Under the hood a user will be logged in into the MSmartHome Cloud and then locally to the device. Re-authentication into the cloud is not necessary for each device, which is handled in the authenticate method (uses the expired date of the cloud accesstoken to check whether a re-authenticate is necessary). The connection to the local device is using sockets and the timeout after 30 seconds, which then requires a re-authenticate locally (not cloud) which is handled under the hood.

	Driver.getDevice(/*id*/123456789012345).then(async device: Device => {
		let securityContext: SecurityContext = new SecurityContext('<account>', '<password>');
		securityContext = await device.authenticate(securityContext);

		const getState: GetStateCommand = new GetStateCommand(device);
		let state: GetStateResponse = await getState.execute();
		console.log(JSON.stringify(state));

		state.powerOn = true;
		const setState: SetStateCommand = new SetStateCommand(device, state);
		state: GetStateResponse = await setState.execute();
		console.log(JSON.stringify(state));
	})