Giter Site home page Giter Site logo

Comments (5)

monster1025 avatar monster1025 commented on June 7, 2024

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.

groggemans avatar groggemans commented on June 7, 2024

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.

groggemans avatar groggemans commented on June 7, 2024

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.

monster1025 avatar monster1025 commented on June 7, 2024

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.

groggemans avatar groggemans commented on June 7, 2024

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)

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.