Comments (5)
Hi.
It was not clear at first where I could find the sids but after running locally with debug output I got the necessary info
The main logic of gateway to change SID to 'nice' name when it found in config. If it can't find sesor sid in config - it will send raw sid value instead of nice name.
There are a few mqtt messages for the sensor types in polling_models
Usually you don't need polling, i have writed this routine when I have problems with connection to aqara gateway (my raspberry pi was connected to Xiaomi\Aqara gw via wifi connection and some of my packets was dropped, but when i switched to ethernet - I didn't have any packet miss). But if you need polling of this models - you can freely add it to arrays.
This scheme is not perfect because I have taken code that works with aqara gw from lazcad plugin, and I want to rewrite it later (I need to remove all device type checking, and maybe rewrite all communication logic, because it didn't support multi-threading requests) - but didn't have any free time for now =(
These are my sensor models:
All un-supported device types must work with 'default' sensor type('sensor'). And yes - code bellow will never be executed:
if device_type == None:
_LOGGER.error('Unsupported devices : {0}'.format(model))
I dit a small local test with my sensor types added, but still no mqtt messages for sensors not in the polling list.
It must work without polling (at least battery reports - if no 'events' occur in sensors, but for example - if you press button on 'sensor_switch.aq2' - it must generate click event, you can't 'poll' switches, it can be read only while 'listening' for events).
Try to switch logging level to DEBUG and click on button - you must see click events in log.
But also - if you have not known 'models' - i think you will need to add your models to code bellow, because it change 'state' values to more accurate (for example xiaomi motion sensor sends 'motion=true' - and after motion is compleate it sends 'no_motion' property with time -> we need to fix it to motion=false):
event_based_sensors = ["switch", "cube"]
motion_sensors = ["motion", "sensor_motion.aq2"]
magnet_sensors = ["magnet"]
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)
It must work 'out-of-box', you will get sids and original model instead of 'human-readable' names =)
P.S. PR are always welcome =)
from aqara-mqtt.
Oke, thanks for the reply! I'll try to do some more debugging.
Let me first create a PR to add my sensors models and to remove the dead code.
from aqara-mqtt.
A little more debugging showed me that my local firewall was one of the issues. After disabling the firewall messages from the gateway started coming in. Can you tell me some more about which ports should be open? or on which port this application will listen?
Messages are now coming in, but still aren't send to mqtt. I'll try to do some more debugging to figure this out.
from aqara-mqtt.
It will listen on UDP:
MULTICAST_PORT = 9898
GATEWAY_DISCOVERY_PORT = 4321
and also it will connect to 1883 (? - as described in config) TCP - MQTT.
from aqara-mqtt.
Port 9898 seems to be enough. Also solved a few other issues at my end.
I think I can get it going now. Thanks for your assistance!
from aqara-mqtt.
Related Issues (12)
- Write command for switch does not work. HOT 2
- Play ringtone already supported ;) HOT 1
- Python HOT 2
- License HOT 2
- docker problem HOT 11
- Issues receiving packets with both x64 & arm docker images. HOT 3
- Setting color and brightness of Hub HOT 2
- how to install? HOT 1
- Important question about Aqara devices HOT 1
- Question regarding HA setup of switch HOT 11
- Blocked in _read_unwanted_data HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aqara-mqtt.