aholstenson / miio

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
1.87k stars 354 forks source link

React Native integration #225

Open eddiecooro opened 5 years ago

eddiecooro commented 5 years ago

I'd like to use this package on a react-native application. I would like to fork and change some parts in order to work correctly with react native if you put me in the right direction. Do you think it's possible?

dmatora commented 3 years ago

Also tried to use it with React Native and failed Fixed error: Error: Unable to resolve module 'util' from 'node_modules/miio/lib/discovery.js' with yarn add util

Tried to fix error: Error: Unable to resolve module 'dns' from 'node_modules/miio/lib/discovery.js': with yarn add dns but got error hawk@0.10.2: The engine "node" is incompatible with this module. Expected version "0.8.x". Got "10.22.0"

dmatora commented 3 years ago

miio/lib/discovery.js uses https://nodejs.org/api/dns.html which must be replaced with https://github.com/tableau/react-native-dns-lookup

miio/lib/network.js uses https://nodejs.org/api/dgram.html which must be replaced with https://github.com/tradle/react-native-udp

miio/lib/packet.js uses https://nodejs.org/api/crypto.html which must be replaced with https://github.com/tradle/react-native-crypto

miio/lib/tokens.js uses https://nodejs.org/api/fs.html and I can't think of straightforward replacement for react-native miio/lib/tokens.js could be reimplemented to store tokens in local storage, but this is little over my head

dmatora commented 1 month ago

@eddiecooro I've just published https://www.npmjs.com/package/react-native-miio