dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 499 forks source link

DIYRuZ_Flower #4893

Closed habitoti closed 2 years ago

habitoti commented 3 years ago

Please include this very useful soil moisture sensor: https://zigbee.blakadder.com/DIYRuZ_Flower.html

It's supported via ZIGBEE2MQTT and also ioBroker Zigbee. It shows up in Deconz, but is currently not recognised by Phoscon. It has been requested before by @ingo01978 , but was automatically closed after a month w/o any comment. It's very sad to be locked in like that with Deconz and not be able to extend it through community :-(

Device

Product name: DIYRuZ_FlowerV2 Manufacturer: modkam.ru Model identifier: DIYRuZ_Flower Device type : Sensor , Other (Soil moisture)

Screenshots

Basic

https://modkam.ru/?p=1700 https://github.com/diyruz/flower

Identify

Alarms

Device Temperature

Groups

Scenes

On/Off

Level Control

Color Control

Simple Metering

Diagnostics

Other clusters that are not mentioned above

habitoti commented 3 years ago

Is this the right way to ask for additional integrations? Pretty silent here...

Smanar commented 3 years ago

Yes, it s the good place ^^. But I think there is no one with free time for this device.

And As cluster are not the good one, need some hacks in the code too.

habitoti commented 3 years ago

Hm. Seems to be the only outdoor Zigbee humidity sensor that I could find, and I am seeing lots of people switching to ZIGBEE2MQTT just for the support of this. Can't you provide kind of an "open integration" type of proxy where 3rd parties (or nice hobbyists) can hook in with generic additional interfaces to their hardware? Whenever new devices pop up it feels we're locked-in with Deconz until it officially delivers support through an update, while it's not possible to just dynamically add something simply at runtime. This would relief that waiting cycle and would also allow prof. and hobby devs to work on preliminary or "casual" integrations until an official one can be delivered (if that happens at all).

Smanar commented 3 years ago

The code is open, some modifications just need 4 lines to edit, and to compile people just need to copy paste 5 lines from the homepage. For exemple https://github.com/dresden-elektronik/deconz-rest-plugin/pull/4895/files

People are afraid by c++, even it s no more complicated to edit a c++ code than a javascript one. But yes, the API "will be improved soon", to make new device addition easier by users, but it s not for tomorrow unfortunately.

And your device will not be "basic" to include, as we need to manage "output" cluster as "input" cluster.

guny74 commented 3 years ago

I also use the conbee II and deconz, because a lot of people suggest to do it the right way. But now I have 4 of this sensors (flower moisture sensors) and I have to switch to an other cc2552 controller and zigbee2mqtt to support this. At the moment I have both running, but this is not my preferred solution.

So I also would be very happy if the conbee II / deconz can work with this device....

Thank you

github-actions[bot] commented 3 years ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

TPertenava commented 3 years ago

Hi, just wanted to add my 5 cents here. I’ve been using DeCONZ for quite a while now, thanks for making it! But now had to switch to zigbee2mqtt which is not that user friendly, just to get support of my 15 brand-new soil mosture sensors. It would be really nice to have an option to either add them to DeCONZ natively or configure them as a “generic” device. Thanks in advance!

guny74 commented 3 years ago

Hello,

Any idea if / when this device will be supported ? I am at the decision to switch to another stick & zigbee2mqtt incl. to leave conbee+deconz or - my preferred way - conbee/deconz support also such flower moisture stick.

Thank you

Regards

Smanar commented 3 years ago

It's just my opinion, but this device is not zigbee compliant, so need hacks to make it working and ATM one priority in deconz is removing all hacks, so I don't think this device will be a priority for the moment.

TPertenava commented 3 years ago

@Smanar IMO it is totally valid point, it is better to stay within standards to avoid hacks. I would like to give it a try and communicate with the DIYRuZ_Flower FW developer if it may be tuned to match the standards. Would you be able to describe what exactly is wrong with that device in a nutshell, so it would be obvious to the FW author?

Smanar commented 3 years ago

Ha yes, if you can make something to correct it, I will make the device integration myself ^^. So my problem is simple, clusters are output cluster, instead of input, on the screenshoot they are grey instead of blue, and it s for that you have (0) as attributes available (except for luminance, but here the bug is from deconz I think.)

guny74 commented 3 years ago

Hello,

Maybe the link to the github Page will be helfen. https://github.com/diyruz/flower

I am not an expert, but in the lower Part these are Screenshots from other Software zigbee2mqtt where input and output Cluster seams ok...or I am wrong?

I have also some running at zigbee2mqtt and could deliver Info.... or I could also try to connect it to the deconz/conbee on windows (so far not successfull)

Smanar commented 3 years ago

He nope look at this one https://raw.githubusercontent.com/diyruz/flower/master/images/DIYRuZ_Flower_14.png, all usefull cluster are in output But i s an old version, you realy don't have same.

guny74 commented 3 years ago

image Here at zigbee2mqtt webui it looks like this....

Smanar commented 3 years ago

And for thoses one, it s the same than your first capture, only 1 clusters as input, the "Basic" one.

guny74 commented 3 years ago

Ok, so only change of the device firmware would solve this, right !? "sh..."

(I do not know about the meaning of cluster, so I could only deliver screenshots)

Smanar commented 3 years ago

Yep ^^ You can look all devices with temperature or humidity, for exemple https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4801 Clusters are always blue.

guny74 commented 3 years ago

So I think the problem is, that we are / I am no experts describing the problem to the firmware project, and if there would be a change to the firmware, the other project (zigbee2mqtt, iobroker) which supports it now in this version, it would not work anymore ( I fear).

Any other ideas than to use second controller+zigbee2mqtt ?

Remark: and it is not so easyJet to update the Firmware of the sensor.

TPertenava commented 3 years ago

Ha yes, if you can make something to correct it, I will make the device integration myself ^^. So my problem is simple, clusters are output cluster, instead of input, on the screenshoot they are grey instead of blue, and it s for that you have (0) as attributes available (except for luminance, but here the bug is from deconz I think.)

Hi Smanar, with some very valuable help from the original FW developer, it seems I've got FW tuned, so all the EPs are blue now. I am able to read all the values besides the main "unsupported" one (cluster 01, endpoint 0408, attrid 0x0002) which stands for soil humidity. Please let me know what would be next steps to get this sensor supported by DeCONZ. Thanks a lot for your willingness to help!

Screenshot 2021-07-21 221455

Smanar commented 3 years ago

Gz ^^, this device seem to have a good support.

Have started the code, you will have it tommorow, just some questions. I will use defaut attribute for cluster 0x0400 0x0402 0x0403 0x405 The cluster 0x408 is new on deconz, I will add it. Just need the attribute table on cluster 0x001 to be sure on wich one attribute you have voltage. And I have a question, why 2 endpoint with 2 temperature cluster ? both are usefull ?

Edit: The beta test

You have the procedure here https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing So for you, after having installed deconz :

sudo apt install deconz-dev
git clone --branch flower https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

Battery is by defaut You will have 5 sensors on first endpoint and 1 on the second.

If you want the new cluster on the GUI too (instead of "unknown") you need to replace the general.xml file too, but the API don't need it.

TPertenava commented 3 years ago

Gz ^^, this device seem to have a good support.

Indeed!

Have started the code, you will have it tommorow, just some questions. I will use defaut attribute for cluster 0x0400 0x0402 0x0403 0x405 The cluster 0x408 is new on deconz, I will add it.

Great, thanks!

Just need the attribute table on cluster 0x001 to be sure on wich one attribute you have voltage.

Power_configuration 0x0020 is for battery voltage (should multiply by 100 to get voltage in mV) 0x0021 is for battery percentage (in percents)

And I have a question, why 2 endpoint with 2 temperature cluster ? both are usefull ?

Jep, both are useful. The first one is for air temperature and the second one is for soil temperature.

habitoti commented 3 years ago

Question not directly related to deconz, but a prerequisite then: how would I update the firmware of the sensor once fixed? So far I did that via deconz, which would be a hen&egg problem now... 😉

Mimiix commented 3 years ago

@habitoti That's a different question. Please ask that in the forums (forum.phoscon.de) or read the documentation of deCONZ :)

Smanar commented 3 years ago

Ok so I have choosed the battery level. Code is updated

You can try the code and tell me what is working or not.

I don't understand your problem for firmware ? If you already do it with deconz, you can continue with it, just need the firmware file, and BTW if you can share it too I think others users will be interested too.

habitoti commented 3 years ago

While the sensor shows up in the deconz map, it's not in the OTAU plugin list, so how would I push a firmware then?

Smanar commented 3 years ago

While the sensor shows up in the deconz map, it's not in the OTAU plugin list, so how would I push a firmware then?

But the device is visible on the deconz map with the bad firmware , just the cluster are not on good side, no ?

The procedure to test the code is here https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4893#issuecomment-884441056 I don't remember if you are using classic OS or dockers ?

TPertenava commented 3 years ago

While the sensor shows up in the deconz map, it's not in the OTAU plugin list, so how would I push a firmware then?

Hi, am I getting it right you are trying to update the SW on the sensor itself? I am not 100% sure it supports OTA updates at all. I think the easiest way would be to just reprogram it from scratch. The updated FW is now found in releases section of Flower sensor depository https://github.com/diyruz/flower/releases

TPertenava commented 3 years ago

Ok so I have choosed the battery level. Code is updated

You can try the code and tell me what is working or not.

Thank you, @Smanar, really overwhelmed with your support. I will try to figure out the testing procedure as per your instructions and get back here as soon as I get it checked!

habitoti commented 3 years ago

Hi, am I getting it right you are trying to update the SW on the sensor itself? I am not 100% sure it supports OTA updates at all. I think the easiest way would be to just reprogram it from scratch. The updated FW is now found in releases section of Flower sensor depository https://github.com/diyruz/flower/releases

Doesn‘t seem to support OTA. As said it‘s not showing up in OTA plugin. Maybe it‘s just me, but I have no clue how to get the firmware uploaded to the device. The device or firmware site don‘t mention anything in this regard. Any supporting hint welcome 😬

TPertenava commented 3 years ago

Maybe it‘s just me, but I have no clue how to get the firmware uploaded to the device. The device or firmware site don‘t mention anything in this regard. Any supporting hint welcome 😬

I used this tutorial together with Arduino board I had laying around. https://www.zigbee2mqtt.io/information/alternative_flashing_methods.html#via-arduino-unoesp8266-with-ccloader-3min Just give it a try, if no luck when I think the most appropriate would be to ask help in Flower rep. You can tag me there if you want. Pinout: Vcc - 3.3V from Arduino RST - pin 4 P2.2 - pin 5 P2.1 - pin 6 GND - GND from Arduino

Smanar commented 3 years ago

I am not 100% sure it supports OTA updates at all.

Right, the device have not the OTAU cluster.

guny74 commented 3 years ago

I flashed the sensor with the newest firmware.

I the device code in the "latest" Version right now ? I user the docker version

TPertenava commented 3 years ago

I flashed the sensor with the newest firmware.

I the device code in the "latest" Version right now ? I user the docker version

Hi, I guess it is not in the main branch as for today. It is on me to build deconz-restapi from @Smanar ’s repository and test the functionality. Unfortunately I’ve been struggling to make my lab setup working at all when building it from development branch. Hope to get this done by Monday and give feedback to Smanar. Meanwhile you can do the same as instructed by Smanar here

Mimiix commented 3 years ago

@TPertenava are you the developer of the firmware?

TPertenava commented 3 years ago

@TPertenava are you the developer of the firmware?

No, I am not. But I've consulted with the developer and made a pull request to fix the in/out cluster issue which was accepted into the main branch of the sensor FW.

habitoti commented 3 years ago

So I flashed the device now successfully with the latest release firmware, however in deconz I am still seeing all those old values (and e.g. nothing under Power Configuration, like shown above). Should I expect it to show correct data now in the cluster infos?

Smanar commented 3 years ago

So I flashed the device now successfully with the latest release firmware, however in deconz I am still seeing all those old values (and e.g. nothing under Power Configuration, like shown above). Should I expect it to show correct data now in the cluster infos?

You mean same color for blue an gray cluster ? At opposite to this one https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4893#issuecomment-884433478

Try to delete and re-include the device.

habitoti commented 3 years ago

Removing and adding back did the trick, thx. I am seeing now properties for most clusters:

2021-08-01_14-01-51

However all report 0/empty values only. Is that expected at this stage w/o according deconz update, or should I see any meaningful values for the properties already?

2021-08-01_14-04-56

2021-08-01_14-05-49

The only two properties from all listed are manufacturer and model id:

2021-08-01_14-06-36

Smanar commented 3 years ago

Have you used the "read" button ?

And this device is a sensor, so you probably need to awake it to have values. BUT what is your machine ? Can you try to compile the deconz code too, to test the device inside the API ?

habitoti commented 3 years ago

Read doesn't work (sensor shows red bullet then). When would the sensor push values? On change only or regularly? How would I awake it explicitly?

I am running Deconz on Homeassistant (with Conbee II attached to a PI 4). Not sure it's so easy (for me 😬) to update the docker sandbox it's running in...

Smanar commented 3 years ago

Read doesn't work (sensor shows red bullet then). When would the sensor push values? On change only or regularly? How would I awake it explicitly?

I think it s exactly the problem ^^ The GUI don't use queue list, if the device is sleeping you will have the red error, on some device, a short press on the reset button make the trick. Or just wait for natural reporting, but not sure the GUI update them in real time.

And no, docker are not easy, there is a procedure https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing , but I realy can't help you for it.

habitoti commented 3 years ago

When pushing reset, I can exec a „read“ and the bullet in deconz VNC flashes green shortly. But all values stay 0, especially the „measured value“ for temp. and humidity.

Smanar commented 3 years ago

You don't have same result than here https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4893#issuecomment-884433478

You need to have too some attributes disabled. and the color need to be the blue, not the green.

habitoti commented 3 years ago

Yeah, seems like it has a very short "awake" time to read the data. So playing a bit with the timing, I get e.g. the power config.:

2021-08-01_15-42-42

For humidity it's still 0, though the others get disabled then. The sensor is standing in a glas of water right now, so I suppose the reading should be different from 0 then:

2021-08-01_15-44-01

Same for temperature:

2021-08-01_15-45-36

Smanar commented 3 years ago

Ha yes it s stange here .... But it have worked for the other user, can come from the firmware, perhaps it need some hours of working mode before sending an average ...

habitoti commented 3 years ago

Yeah, I'll wait another 24h, let's see whether it's "grooving in"...

TPertenava commented 3 years ago

Hi everyone, I've finally managed to test it under beta setup with @Smanar 's branch of the rest plugin applied. Beta version obviously has some strange bug which prevents any sensor to pair with the coordinator (deCONZ just NOT entering into pairing mode, this is totally unrelated to this topic), but finally it just worked somehow, so I can confirm it works and I was able to read all the correct values via deCONZ GUI. Please let me know what has to be tested/verified before this sensor may be included into the main repo?

@habitoti there is literally no lag with values readout, so no reason to wait 24h. Every time you push physical button on the sensor it reads current Soil humidity (or any other) value and sends it out to coordinator. Note you should also press READ button in the cluster info, it does not request values from the sensor, but it will keep updating numbers in the table for some time. Screenshot from 2021-08-01 23-27-04

habitoti commented 3 years ago

Hm…what could be the reason for cluster 408 to show up as „unknown“ with no properties on my sensor after flashing the new firmware, while yours seems to correctly report „soil moisture“ here? All other clusters are the same. Do you have any property readings <> 0 for any of the other clusters?

TPertenava commented 3 years ago

Hm…what could be the reason for cluster 408 to show up as „unknown“ with no properties on my sensor after flashing the new firmware, while yours seems to correctly report „soil moisture“ here? All other clusters are the same. Do you have any property readings <> 0 for any of the other clusters?

The reason for 408’s name not showing up properly is that it is non-standard cluster for deCONZ and you need to use modified rest plugin and xml file to fix that. Yes, I have got correct readings in deCONZ GUI for all sensors (2xtemperatures, illumination, pressure, RH%, soil moisture).

Smanar commented 3 years ago

Ha yes the xml file is /usr/share/deCONZ/zcl/general.xml on Raspberry And the new file is here https://github.com/Smanar/deconz-rest-plugin/blob/flower/general.xml

Please let me know what has to be tested/verified before this sensor may be included into the main repo?

Just the working mode in the API, it need to be visible in third app (except the ZHAMoisture, this one will be visible only in the API, can use http://phoscon.de/pwabeta in help / api Information)