arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
466 stars 103 forks source link

MQTTThing + Mi Flower Care #149

Open clipse2004 opened 4 years ago

clipse2004 commented 4 years ago

Hi Guys, I use this plugin to get some informations from my Mi Flower Care to my HomeKit, but I have some Problems. At the moment I get the humidity, battery and Temperatur. What I also need is: 

"light" and "conductivity". And is there a way to show (at homekit) all in 1 „device“?

Thanks!

tobekas commented 4 years ago

Especially for iOS 13 this would be interesting. With iOS <=12 HomeApp will show one tile per Service(!) even if the belong to the same accessory.

With iOS 13 there will be one tile per Accessory. If an accessory held multiple services (e.g. TemperatureSensor, HumiditySensor, LightSensor) they will be grouped.

At the moment all "types" (=possible [combinations of] services and their characteristics) are defined by this MqttThing-Plugin. It would be great, if it was possible to offer kind of a „custom type“ accessory, where you can freely choose/mix multiple services. As a first step maybe only for a "custom sensor accessory" with just read-Characteristics. As a second step for completely free combinations. This would also be great for experimenting...

tobekas commented 4 years ago

See also #144

clipse2004 commented 4 years ago

I already use iOS 13 and there is no custom accessory :/

tobekas commented 4 years ago

There are no custom (service/characteristic) types, which will be shown within Apples Home App, right. (Different in Eve App, where custom characteristics are shown.) But for HomeKit default services, they will be grouped. For example if you use weatherStation, with Temp and Humidity services, they will be grouped in iOS13 whereas two separate tiles appear in iOS12.

arachnetech commented 4 years ago

Interesting idea, and shouldn’t be too hard to do. I’ll have a look at your ‘custom sensor’ idea when I get a chance. It shouldn’t be too hard using the existing topics etc.

clipse2004 commented 4 years ago

But how can i do a sensor for "light" and "conductivity"? (for Mi Flower)?

regards

bubez81 commented 4 years ago

hello, there are news about this accessory? conductivity is not supported in home app but light is, it's a possibility to create an accessory with humidity, temperature and light sensor?

arachnetech commented 4 years ago

Yes, you should be able to configure that now.

Can you share example MQTT messages for the properties?

bubez81 commented 4 years ago

this is my solution for now: { "accessory": "mqttthing", "type": "weatherStation", "name": "Limone", "serviceNames": { "temperature": "Temperatura Limone", "humidity": "Umidità del Terreno Limone" }, "url": "mqtt://xxxxx", "username": "xxxxx", "password": "xxxxx", "topics": { "getCurrentTemperature": { "topic": "miflora/Limone", "apply": "return JSON.parse(message).temperature;" }, "getCurrentRelativeHumidity": { "topic": "miflora/Limone", "apply": "return JSON.parse(message).moisture;" }, "getStatusLowBattery": { "topic": "miflora/Limone", "apply": "return JSON.parse(message).battery;" } }, "history": "true" },

but so I can't insert the brightness

bubez81 commented 4 years ago

Yes, you should be able to configure that now.

Can you share example MQTT messages for the properties?

sure!

{"light": 14, "temperature": 26.5, "moisture": 39, "conductivity": 135, "battery": 100}

arachnetech commented 4 years ago

Here's a configuration for humidity, temperature and light sensors:

        {
            "accessory": "mqttthing",
            "type": "custom",
            "name": "Flower Care",
            "url": "homebridge",
            "logMqtt": true,
            "codec": "json",
            "jsonCodec": {
                "properties": {
                    "currentRelativeHumidity": "moisture",
                    "currentTemperature": "temperature",
                    "currentAmbientLightLevel": "light",
                    "statusLowBattery": "battery"
                }
            },
            "services": [
                {
                    "type": "humiditySensor",
                    "topics": {
                        "getCurrentRelativeHumidity": "miflora/Limone",
                        "getStatusLowBattery": { "topic": "miflora/Limone", "apply": "return message < 20;" }
                    }
                }, 
                {
                    "type": "temperatureSensor",
                    "topics": {
                        "getCurrentTemperature": "miflora/Limone",
                        "getStatusLowBattery": { "topic": "miflora/Limone", "apply": "return message < 20;" }
                    }
                },
                {
                    "type": "lightSensor",
                    "topics": {
                        "getCurrentAmbientLightLevel": "miflora/Limone",
                        "getStatusLowBattery": { "topic": "miflora/Limone", "apply": "return message < 20;" }
                    }
                }
            ]
        },

Uses grouped (custom) accessories and the JSON codec.

bubez81 commented 4 years ago

wow thank you works great, only one thing, there is a possibility to add "history": "true",?