itavero / homebridge-z2m

Expose your Zigbee devices to HomeKit with ease, by integrating 🐝 Zigbee2MQTT with 🏠 Homebridge.
https://z2m.dev
Apache License 2.0
323 stars 49 forks source link

[Feature] DIYRuZ_Flower - soil measurement #423

Closed WojtekWro closed 2 years ago

WojtekWro commented 2 years ago

Please use the template and fill in all the data requested below!

Problem description DIYRuZ_Flower does not show a soil measurement. I wish to see a soil measurement in homekit, because I want to use it in my watering automations. As we know, a soil measurement is still not supported by HomeKit.

Suggested solution A soil measurement is represented by percentage. I think, that the only solution is showing it as a humidity.

Describe alternatives you've considered Another idea is to make a fake switch which is changing its state depends on soil measurement. When the measurement is below some particular level, the switch is OFF, when it goes above this level it switches to ON. But in this case we should have possibility, to set this level individualy.

Additional context This is how Home app shows this device:

Zrzut ekranu 2022-04-22 o 08 47 45

Controller for homekit

Zrzut ekranu 2022-04-22 o 08 49 26

And Zigbee2Mqtt user interface

Zrzut ekranu 2022-04-22 o 08 52 30
"0x00124b002721aed7": {
            "date_code": "22/04/2021 11:13",
            "definition": {
                "description": "[Flower sensor](http://modkam.ru/?p=1700)",
                "exposes": [
                    {
                        "access": 1,
                        "description": "Measured soil moisture value",
                        "name": "soil_moisture",
                        "property": "soil_moisture",
                        "type": "numeric",
                        "unit": "%"
                    },
                    {
                        "access": 1,
                        "description": "Remaining battery in %",
                        "name": "battery",
                        "property": "battery",
                        "type": "numeric",
                        "unit": "%",
                        "value_max": 100,
                        "value_min": 0
                    },
                    {
                        "access": 1,
                        "description": "Raw measured illuminance",
                        "name": "illuminance",
                        "property": "illuminance",
                        "type": "numeric"
                    },
                    {
                        "access": 1,
                        "description": "Measured relative humidity",
                        "name": "humidity",
                        "property": "humidity",
                        "type": "numeric",
                        "unit": "%"
                    },
                    {
                        "access": 1,
                        "description": "The measured atmospheric pressure",
                        "name": "pressure",
                        "property": "pressure",
                        "type": "numeric",
                        "unit": "hPa"
                    },
                    {
                        "access": 1,
                        "description": "Measured temperature value",
                        "endpoint": "ds",
                        "name": "temperature",
                        "property": "temperature_ds",
                        "type": "numeric",
                        "unit": "°C"
                    },
                    {
                        "access": 1,
                        "description": "Measured temperature value",
                        "endpoint": "bme",
                        "name": "temperature",
                        "property": "temperature_bme",
                        "type": "numeric",
                        "unit": "°C"
                    },
                    {
                        "access": 1,
                        "description": "Link quality (signal strength)",
                        "name": "linkquality",
                        "property": "linkquality",
                        "type": "numeric",
                        "unit": "lqi",
                        "value_max": 255,
                        "value_min": 0
                    }
                ],
                "model": "DIYRuZ_Flower",
                "options": [
                    {
                        "access": 2,
                        "description": "Number of digits after decimal point for temperature, takes into effect on next report of device.",
                        "name": "temperature_precision",
                        "property": "temperature_precision",
                        "type": "numeric",
                        "value_max": 3,
                        "value_min": 0
                    },
                    {
                        "access": 2,
                        "description": "Calibrates the temperature value (absolute offset), takes into effect on next report of device.",
                        "name": "temperature_calibration",
                        "property": "temperature_calibration",
                        "type": "numeric"
                    },
                    {
                        "access": 2,
                        "description": "Number of digits after decimal point for humidity, takes into effect on next report of device.",
                        "name": "humidity_precision",
                        "property": "humidity_precision",
                        "type": "numeric",
                        "value_max": 3,
                        "value_min": 0
                    },
                    {
                        "access": 2,
                        "description": "Calibrates the humidity value (absolute offset), takes into effect on next report of device.",
                        "name": "humidity_calibration",
                        "property": "humidity_calibration",
                        "type": "numeric"
                    },
                    {
                        "access": 2,
                        "description": "Number of digits after decimal point for illuminance, takes into effect on next report of device.",
                        "name": "illuminance_precision",
                        "property": "illuminance_precision",
                        "type": "numeric",
                        "value_max": 3,
                        "value_min": 0
                    },
                    {
                        "access": 2,
                        "description": "Calibrates the illuminance value (percentual offset), takes into effect on next report of device.",
                        "name": "illuminance_calibration",
                        "property": "illuminance_calibration",
                        "type": "numeric"
                    },
                    {
                        "access": 2,
                        "description": "Number of digits after decimal point for illuminance_lux, takes into effect on next report of device.",
                        "name": "illuminance_lux_precision",
                        "property": "illuminance_lux_precision",
                        "type": "numeric",
                        "value_max": 3,
                        "value_min": 0
                    },
                    {
                        "access": 2,
                        "description": "Calibrates the illuminance_lux value (percentual offset), takes into effect on next report of device.",
                        "name": "illuminance_lux_calibration",
                        "property": "illuminance_lux_calibration",
                        "type": "numeric"
                    },
                    {
                        "access": 2,
                        "description": "Number of digits after decimal point for soil_moisture, takes into effect on next report of device.",
                        "name": "soil_moisture_precision",
                        "property": "soil_moisture_precision",
                        "type": "numeric",
                        "value_max": 3,
                        "value_min": 0
                    },
                    {
                        "access": 2,
                        "description": "Calibrates the soil_moisture value (absolute offset), takes into effect on next report of device.",
                        "name": "soil_moisture_calibration",
                        "property": "soil_moisture_calibration",
                        "type": "numeric"
                    },
                    {
                        "access": 2,
                        "description": "Number of digits after decimal point for pressure, takes into effect on next report of device.",
                        "name": "pressure_precision",
                        "property": "pressure_precision",
                        "type": "numeric",
                        "value_max": 3,
                        "value_min": 0
                    },
                    {
                        "access": 2,
                        "description": "Calibrates the pressure value (absolute offset), takes into effect on next report of device.",
                        "name": "pressure_calibration",
                        "property": "pressure_calibration",
                        "type": "numeric"
                    }
                ],
                "supports_ota": false,
                "vendor": "DIYRuZ"
            },
            "endpoints": {
                "1": {
                    "bindings": [
                        {
                            "cluster": "genPowerCfg",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        },
                        {
                            "cluster": "msTemperatureMeasurement",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        },
                        {
                            "cluster": "msRelativeHumidity",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        },
                        {
                            "cluster": "msPressureMeasurement",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        },
                        {
                            "cluster": "msIlluminanceMeasurement",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        },
                        {
                            "cluster": "msSoilMoisture",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        }
                    ],
                    "clusters": {
                        "input": [
                            "genBasic"
                        ],
                        "output": [
                            "genPowerCfg",
                            "msIlluminanceMeasurement",
                            "msTemperatureMeasurement",
                            "msPressureMeasurement",
                            "msRelativeHumidity",
                            "msSoilMoisture"
                        ]
                    },
                    "configured_reportings": [
                        {
                            "attribute": "batteryVoltage",
                            "cluster": "genPowerCfg",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        },
                        {
                            "attribute": "batteryPercentageRemaining",
                            "cluster": "genPowerCfg",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        },
                        {
                            "attribute": "measuredValue",
                            "cluster": "msTemperatureMeasurement",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        },
                        {
                            "attribute": "measuredValue",
                            "cluster": "msRelativeHumidity",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        },
                        {
                            "attribute": "scaledValue",
                            "cluster": "msPressureMeasurement",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        },
                        {
                            "attribute": "measuredValue",
                            "cluster": "msIlluminanceMeasurement",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        },
                        {
                            "attribute": "measuredValue",
                            "cluster": "msSoilMoisture",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        }
                    ],
                    "scenes": []
                },
                "2": {
                    "bindings": [
                        {
                            "cluster": "msTemperatureMeasurement",
                            "target": {
                                "endpoint": 1,
                                "ieee_address": "0x00212effff08b5e4",
                                "type": "endpoint"
                            }
                        }
                    ],
                    "clusters": {
                        "input": [],
                        "output": [
                            "msTemperatureMeasurement"
                        ]
                    },
                    "configured_reportings": [
                        {
                            "attribute": "measuredValue",
                            "cluster": "msTemperatureMeasurement",
                            "maximum_report_interval": 3600,
                            "minimum_report_interval": 0,
                            "reportable_change": 0
                        }
                    ],
                    "scenes": []
                }
            },
            "friendly_name": "Pomiar Gleby",
            "ieee_address": "0x00124b002721aed7",
            "interview_completed": true,
            "interviewing": false,
            "manufacturer": "modkam.ru",
            "model_id": "DIYRuZ_Flower",
            "network_address": 36155,
            "power_source": "Battery",
            "software_build_id": "22/04/2021 11:13",
            "supported": true,
            "type": "EndDevice"
        }
    },

Are you willing to contribute to this feature? Yes / No, because...

WojtekWro commented 2 years ago

I have an idea. What if I replace "soil_moisture" in configuration with "humidity" ? What consequences of this change may happen to me? NOW { "access": 1, "description": "Measured soil moisture value", "name": "soil_moisture", "property": "soil_moisture", "type": "numeric", "unit": "%" }, AFTER CHANGE { "access": 1, "description": "Measured soil moisture value", "name": "soil_moisture", "property": "humidity", "type": "numeric", "unit": "%" },

itavero commented 2 years ago

Worked on an implementation, but ran into some issues while testing it (not yet sure if its the cache from Home.app messing with me or not).

WojtekWro commented 2 years ago

Hi @itavero I hope you are doing well. I know you are busy, but maybe I can help you with this somehow. Do you need some data or some tests? I really appreciate your work :) Thanks, Wojtek

stale[bot] commented 2 years ago

It appears that this issue did not have an update in quite some time. Please check if you can provide any additional information to help resolve this issue. If there isn't any activity in the next two weeks, this issue will be closed automatically. Thank you for your contributions!