Giter Site home page Giter Site logo

aqara-mqtt's People

Contributors

eburtsev avatar jerryzz avatar jon1012 avatar monster1025 avatar radumpopescu avatar seblucas avatar techdada 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

Watchers

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

aqara-mqtt's Issues

Question: Should sensor data stream in automaticly?

I'm having several issues, but I'm probably just doing it wrong.

I'm trying to get all sensor data from my aqara sensors into rabbitmq (using the mqtt plugin). I'm not using Home Assistant.

I'm currently running the x64 container. It connects to the gateway and detects my 14 sensors, which I've added to the config file. (It was not clear at first where I could find the sids but after running locally with debug output I got the necessary info)

There are a few mqtt messages for the sensor types in polling_models, but not for all sensors of those models. Other sensor models don't generate messages at all.

These are my sensor models:

  • 86sw1
  • sensor_wleak.aq1
  • sensor_motion.aq2
  • sensor_magnet.aq2
  • sensor_switch.aq2
  • weather.v1

I've also noticed that most of my sensor types are not defined in the code. But the code that should tell that these are not supported is never executed.

device_type = None
            if model in sensors:
                device_type = 'sensor'
            elif model in binary_sensors:
                device_type = 'binary_sensor'
            elif model in switches:
                device_type = 'switch'
            else:
                device_type = 'sensor' #not really matters

            if device_type == None:
                _LOGGER.error('Unsupported devices : {0}'.format(model))
            else:
                self.XIAOMI_DEVICES[device_type].append(xiaomi_device)

The code logging an error will never be reached because the device_type is always set by the last else in the model checking if. Happy to do a PR to make it log the error, or to remove the obsolete code.

If it's ok I'll also do a PR to add the missing sensor models. But I was wondering if it wouldn't be more logical to regex match the model string to find the sensor type. (.*motion.*, .*switch.*,...).

I dit a small local test with my sensor types added, but still no mqtt messages for sensors not in the polling list.

Thank you for your work and your time!

PS:
Is there a reason why you don't auto add the detected sensors and make the config with a recognizable name optional? (it would be nice for my use case)

Python

Добрый день. Я так понимаю это у вас сборка под доскер, но всё написано на питон тоесть это всё можно запустить на устройстве с python? Какие при этом зависимости или какой питон нужен?

Question regarding HA setup of switch

Hi there,
Do you have an example of configuring the switch as a input withou coupling it to a automation directly.
Is it possible to assign a friendly name to each each type of click?

docker problem

Я наконец-то дорос до Docker. Но он у меня запущен на synology. Скачал ваш контейнер, но выдаёт ошибку при старте

FileNotFoundError: [Errno 2] No such file or directory: 'config/config.yaml'

я так понимаю он просто не видет папку конфига в которой прописаны mqtt сервер и датчики?

Important question about Aqara devices

Hi mates, please apologize me if I create an issue, I need to comunicate with someone expert about Aqara and I don't know how I can find this people, please apologize again.
I've 3 main questions, I hope you can sove me them:

  1. I've some led bulbs that are not compatible with wall switch without neutral, they don't let it activate and they "slightly vibrate". If I add a classiv bulb to them the problem disappears, it's pretty evident for me the reason but I want to know if this will be solved when I buy another wall switch with neutral, in that place luckly I can arrange the neutral wire.
  2. Now I have all wall switches without neutral, but I don't have in any of them the long press function and the doble press, only on wireless switch. Are them present in wall switch with neutral?
  3. I can't figure out how to send a voice command to Aqara hub, only Siri (and similars) can work? I've read it has inside a microphone, but what for? Spy us?
    Thank you a lot!

Write command for switch does not work.

Hey there,

I'm writing my own python bindings and found this repo.

I'm trying to emulate a switch click event with:

{"model": "switch", "cmd": "write", "data": {"status": "click", "key": "A1997D2D474F616BB03FCEC6D2XXX"}, "short_id": 46909, "sid": "158d00011XXXXX"}

But I get back:

{'cmd': 'write_ack', 'data': {"error":"Unsupported device"}, 'sid': '158d00011XXXXX'}

It looks like you can only write to a plug and a ctrl?
Have you been able to successfully write a click to a switch?
Everything else works: read, get_id_list. Maybe you can enlighten me?

Blocked in _read_unwanted_data

Hi,

I started to test your program last week and for an unknown reason it wasn't working at all. At first I was blaming my iptables setup, next docker and finally I spend some time to debug and found out that once started it remained stuck in _read_unwanted_data (exactly here)

I saw that you added it with this commit : 54eda12

For now I just put a return at the top of the function and it seems to work fine (I'll let it run a day or two before being sure)

I'm not using your docker python container (because I use a small armhf SBC) but mine should be almost the same :

  • Docker 17.05.0-ce
  • Python 3.5.2
  • Latest git revision of this repo
  • The command line I'm using to start the docker image : docker run -it --rm --net host -v /var/opt/docker/aqara/:/app/config seblucas/alpine-aqara:1.7

This function has to be useful and the problem got to be on my end, I hope you have an idea ;)

Thanks in advance

Issues receiving packets with both x64 & arm docker images.

Hi, thanks for taking the time to develop this useful tool!
I am having issues receiving packets. I have 4 devices (motion, temperature, button, and magnet) but not receiving data from any. Tested both on my macbook and on an rpi3.

The log:

aqara    | INFO:mqtt:Starting mqtt loop.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/+/set.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/write.
aqara    | INFO:mqtt:Subscribing to home/plug/+/status/set.
aqara    | INFO:xiaomihub:"Read unwanted data" fix is True
aqara    | INFO:xiaomihub:Discovering Xiaomi Gateways using address 192.168.1.153
aqara    | INFO:mqtt:Connected to mqtt server.
aqara    | INFO:xiaomihub:Gateway found on IP 192.168.1.153
aqara    | INFO:xiaomihub:Creating Multicast Socket
aqara    | INFO:xiaomihub:Listening
aqara    | INFO:xiaomihub:Discovering Xiaomi Devices
aqara    | INFO:xiaomihub:Found 4 devices
aqara    | INFO:mqtt:Publishing message to topic home/motion/158d0001d672d0/voltage: 3065.

It appears to not do anything after that last publish.

With some extra info:

aqara    | INFO:mqtt:Starting mqtt loop.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/+/set.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/write.
aqara    | INFO:mqtt:Connected to mqtt server.
aqara    | INFO:mqtt:Subscribing to home/plug/+/status/set.
aqara    | INFO:xiaomihub:"Read unwanted data" fix is True
aqara    | INFO:xiaomihub:Discovering Xiaomi Gateways using address 192.168.1.153
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"whois"}
aqara    | INFO:xiaomihub:Recieved from GW {'ip': '192.168.1.153', 'cmd': 'iam', 'sid': '7811dcb7c98b', 'port': '9898', 'model': 'gateway'}
aqara    | INFO:xiaomihub:Gateway found on IP 192.168.1.153
aqara    | INFO:xiaomihub:Creating Multicast Socket
aqara    | INFO:xiaomihub:Listening
aqara    | INFO:xiaomihub:Discovering Xiaomi Devices
aqara    | INFO:xiaomihub:Sending to GW {"cmd" : "get_id_list"}
aqara    | INFO:xiaomihub:Recieved from GW {'cmd': 'get_id_list_ack', 'token': '5Jwf8YoNZJcOIJkH', 'sid': '7811dcb7c98b', 'data': '["158d0001fa518f","158d0001d672d0","158d0001f3b212","158d0001e5c0f0"]'}
aqara    | INFO:xiaomihub:Found 4 devices
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001fa518f"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 12923, 'cmd': 'read_ack', 'model': 'sensor_ht', 'sid': '158d0001fa518f', 'data': '{"voltage":3005,"temperature":"1853","humidity":"5763"}'}
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001f3b212"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 59356, 'cmd': 'read_ack', 'model': 'magnet', 'sid': '158d0001f3b212', 'data': '{"voltage":3085,"status":"close"}'}
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001e5c0f0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 52916, 'cmd': 'read_ack', 'model': 'switch', 'sid': '158d0001e5c0f0', 'data': '{"voltage":3102}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}

Docker version:

Client:
 Version:       17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:03:51 2017
 OS/Arch:       darwin/amd64

Server:
 Engine:
  Version:      17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:        Wed Dec 27 20:12:29 2017
  OS/Arch:      linux/amd64
  Experimental: true

Hope you can help!

Play ringtone already supported ;)

Hi,

I don't know if you knew but you already support playing ringtone (I'm using it for a few months but never thought of writing about it). It work perfectly fine with :

mosquitto_pub -h 192.168.0.108 -m '{"mid":10,"vol":5}' -t home/gateway/main/write

mid can be any of those :
0="police car 1",
1="police car 2",
2="accident",
3="countdown",
4="ghost",
5="sniper rifle",
6="battle",
7="air raid",
8="bark",
10="doorbell",
11="knock at a door",
12="amuse",
13="alarm clock",
20="mimix",
21="enthusuastic",
22="guitar classic",
23="ice world piano",
24="leisure time",
25="child hood",
26="morning stream liet",
27="music box",
28="orange",
29="thinker"
10000="stop" <- Actually stop anything being played

and vol has to be between 0 and 99.

You can close it as it's not a real issue. It can be better integrated (like it was done with rgb ring) but it works.

how to install?

would love to try this aqara-mqtt but there is lack of info how to install it. any hints maybe?

Setting color and brightness of Hub

After updating today to the latest firmware and see that I was receiving reports any time I changed color on the gateway, I tried to send write commands to the gateway, without success. Then I realized that comment on your readme:

"exclude Brightness+RGB value of gateway - you need to send it in xiaomi format"

What do you mean with "xiaomi format" ?

Thank you!

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.