Giter VIP home page Giter VIP logo

mi-home's People

Contributors

dependabot[bot] avatar iberisoft avatar jurgen-kluft avatar niksan321 avatar pachman avatar sergey-brutsky 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  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

mi-home's Issues

Method Named

Hi, how do I discover which available methods there are for any given device please?
E.g gateway?.EnableLight() is one that you mention in your resdme but how do I find all methods that can be used? I am thinking about trying to use this for my Roborock s5 max vacuum.
Thanks Ben

Unable to Connect to Mi gateway

Hi. I tried your code example from MiHomeConsole. And it is not working for me.
miHome.GetGateway() is always null and miHome.GetDevices() is always empty. I tried both ways - with password and SSID and without them.

Here is my HUB info
photo_2020-02-15_00-32-53 (2)
photo_2020-02-15_00-32-53

I tried to connect to router via Ethernet cable and via Wi-Fi.
IPTV router setting is enabled:
image

I do not have Hyper-V/Virtual box network adapters:
image

My firewall and antivirus are disabled.
I created 4 firewall rules to allow TCP and UDP ingoing and outgoing connection on 9898 port.

I created the forwarding rule for my router:
image

Domoticz is also not working for me. It stuck on http://127.0.0.1:8080/#/Devices page:
image

Have you any more suggestions?
Thank you in advance!

Wireless Switch

Here is the code for the Wireless Switch, have one at home and are running your library with this added Switch, works nicely.

using System;
using Newtonsoft.Json.Linq;

namespace MiHomeLib.Devices
{
    public class WirelessSwitch : MiHomeDevice
    {
        public event EventHandler OnClick;
        public event EventHandler OnDoubleClick;
        public event EventHandler OnLongClickRelease;
        public event EventHandler OnLongClickPress;

        public WirelessSwitch(string sid) : base(sid, "switch") 
        {
            Status = "idle";
        }

        public float? Voltage { get; set; }

        public string Status { get; private set; }

        public override void ParseData(string command)
        {
            var jObject = JObject.Parse(command);

            if (jObject["status"] != null)
            {
                Status = jObject["status"].ToString();

                if (Status == "click")
                {
                    OnClick?.Invoke(this, EventArgs.Empty);
                }
                else if (Status == "double_click")
                {
                    OnDoubleClick?.Invoke(this, EventArgs.Empty);
                }
                else if (Status == "long_click_press")
                {
                    OnLongClickPress?.Invoke(this, EventArgs.Empty);
                }
                else if (Status == "long_click_release")
                {
                    OnLongClickRelease?.Invoke(this, EventArgs.Empty);
                }
            }

            if (jObject["voltage"] != null && float.TryParse(jObject["voltage"].ToString(), out float v))
            {
                Voltage = v / 1000;
            }
        }
        public override string ToString()
        {
            return $"Status: {Status}, Voltage: {Voltage}V";
        }
    }
}

Gateway version 2.61.3

After updating gateway to the latest avaible version (2.61.3) I can't find any device anymore... I tryed controlling if lan mode was still active, but there's no way to have the 2 more menus tapping on the version number. Any idea?

Gateway and Temperature and humidity sensor

Hi,
I have a Xiaomi Mi Home Gateway and two Temperature and humidity sensors that I would like to read using a script in C#.

Could you please provide an example of how to do that?

I followed the guide in https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara) and I can get the readings from Domoticz but I cannot make it working using your library in a C# Visual Studio script.
Do I need to specify the IP address of the gateway?
What am I missing?

I am very new on this and I really appreciate some help.
Thanks!

Get Error at first time initial

it will get 0 devices first time,
and get error message when dispose miHome object, error:

The given key 'ctrl_ln2.aq1' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at MiHomeLib.MiHome.GetOrAddDeviceByCommand(ResponseCommand cmd)
   at MiHomeLib.MiHome.ProcessReport(ResponseCommand cmd)
   at MiHomeLib.MiHome.StartReceivingMessages(CancellationToken ct)

but if i use debugger go back to new MiHome, it will get devices (but not aqua wall switch)

And the above error will continue display.

Please help, thanks.

Can't reach any device

Hi,

I tried your example code snippets but nothing happened. I tried to search for all devices, also tried to reach my gateway, but can't see anything (though I have a switch, a cube and a plug). How should these events work? For example when should the OnSocketPlug event fire exactly?
I checked your python script which you mentioned at an other issue, and I receive my gateway's heartbeats, so I guess I should reach it.

Thank you very much in advance,
Peter

Не отрабатывают EventHandler'ы

Здравствуйте!
Имеется следующая проблема. Инициализирую объект MiHome c паролем и сидом гейта.
Определяются все подключенные к нему устройства. После подписки по сиду датчика влажности и температуры на события ничего не происходит.
miHome = new MiHome("j3kvvz9x4ufgvyzr", "7c49eb88ce6f"); Task.Delay(10000).Wait(); var thSensor = miHome.GetDeviceBySid<ThSensor>("158d0002b54977"); thSensor.OnHumidityChange += ThSensor_OnHumidityChange; thSensor.OnTemperatureChange += ThSensor_OnTemperatureChange;
события не файрятся =(
Помогите пожалуйста разобраться с проблемой. В какую сторону копать.

Can this be used as a relay?

Hi Sergey,
I was wondering if this could be used to relay events from xiaomi devices to somewhere like Hubitat or WebCore? I use Xiaomi devices connected directly to Hubitat and SmartThings hubs but find that the xiaomi devices always drop their connections and the devices do not report back to the hubs in a timely enough manner. It would be more stable to use the actual Xiaomi Gateway hub and then relay the events from the devices to my other hubs. Do you think this would work?

thanks

MiHome._devicesList is not thread-safe

I have encountered an exception related to the device list that is owned by the class MiHome. After digging through the behaviour of this class and the async task(s) that add items to the list it is clear that exposing this list as public is dangerous. I have changed the code on my machine to use a ConcurrentDictionary<string, MiHomeDevice> where the key is the SID of the MiHomeDevice (which should be unique). So now adding devices is thread-safe when other places are using this collection.
Also the GetDevices() function returns a List which i construct from the concurrent dictionary before giving the list to the caller, like so:
List<MiHomeDevice> devices = _devicesList.Values.ToList()

No problems so far.

Unable to Connect to Mi gateway

I tried to connect to mi gateway which locates at the same LAN. However, i didn't see any multicast message located in 224.0.0.50:9898, instead, i saw the multicast on 224.0.0.251:9898. When I send the discover message get_id_list to 224.0.0.251, the returned message is not received by the program, the socket is not able to connect. Here is the error: SocketException: The socket is not connected
System.Net.Sockets.Socket.Shutdown (System.Net.Sockets.SocketShutdown how) (at <3845a180c26b4889bc2d47593a665814>:0)

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.