Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with home assistant and legrand cover shutter celiane netatmo #2812

Closed
plum59 opened this issue May 25, 2020 · 107 comments
Closed

Issue with home assistant and legrand cover shutter celiane netatmo #2812

plum59 opened this issue May 25, 2020 · 107 comments

Comments

@plum59
Copy link

plum59 commented May 25, 2020

Hello
I need support on integration deconz in HA.
In facte all seems good except for Legrand celiane netatmo cover shutter switch.
The switch is present in deconz and in home assistant too but in HA it remains in closed state continuously

The stop command works, the open command works
but the home assistant closing command does not work, it activates the opening, not closing.

If i use deconz api rest i can open and closed the cover normaly

http://1*******:40850/api/********/lights/3/state
{ "open": false }

http://1*******:40850/api/********/lights/3/state
{ "open": true }

it looks like the entity "cover" in home assistant is badly configured for closing

@SwoopX
Copy link
Collaborator

SwoopX commented May 25, 2020

So it sounds to me it's a HA issue then. You described the REST API works correctly, right?

@plum59
Copy link
Author

plum59 commented May 25, 2020

Hello , i don't no because when i had discover my switch in deconz (with HA deconz integration) this entity is automaticaly create in HA .

@Smanar
Copy link
Collaborator

Smanar commented May 25, 2020

Heu ? the command in the api for the shutter is not state/open but state/on or state/bri.
I have never tried the "open" command, perhaps it's from the last modification for shutter, I need to take a look ....

Have you the JSON of the device pls ?

@Smanar
Copy link
Collaborator

Smanar commented May 25, 2020

Ok so there is some change since the last @ebaauw modification.
Now theses devices support "open", but "open" is the opposite at "on", and I don't remember for this device if "on" is "open" or "close"
"open" > targetOpen = map[param].toBool();
"on" > targetOpen = !(map[param].toBool());

@ebaauw
Copy link
Collaborator

ebaauw commented May 25, 2020

See #2475 (comment)

@Smanar
Copy link
Collaborator

Smanar commented May 25, 2020

Ok So I have found archive ^^

On previous version State/on = true > Close the shutter, so it's good with last modification

$ ph put -v /lights/327/state '{"on": true}'
{
  "open": false
}

So I realy think the problem is from HA, ca you see the command used by HA ?

@plum59
Copy link
Author

plum59 commented May 25, 2020

Hello,

like mentionned on discord the problem is when i use cover.closed it seems post on deconnz this intsruction

2020-05-25 18:19:19 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254}" to "172.30.33.8 /lights/3/state"
2020-05-25 18:19:19 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/3/state/lift': 100}}]

or if i use api rest with lift: 100 my cover is opening non closing

@Smanar
Copy link
Collaborator

Smanar commented May 25, 2020

2020-05-25 18:19:19 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254}" to "172.30.33.8 /lights/3/state"

And using directly the api, this command is working ?

If not, try with only "on" or only "bri"

Edit:
Going to take a look on discord ^^.

@Smanar
Copy link
Collaborator

Smanar commented May 26, 2020

Ok, so I realy don't see why the code is not working ?
It's a new device ?
Can you check if the model id is still exaclty "Shutter switch with neutral" ?
It have already worked ?

I know how to repair it, but I don't want to break the installation on others users.

And As you have Hass, I think you can't test code modification ?

I will make an ask on legrand issue > #883 (comment)

@plum59
Copy link
Author

plum59 commented May 26, 2020

Good evening.
I'm sad , bad news :(

No it is no new device but before i use homekit integration in HA with legrand control hub and it's work fine , but my hub is broken and i try to use deconz intead off.

the model id is still exaclty "Shutter switch with neutral"

In VNC :
image

In Deconz:
image

With deconz it is my primary test never test before but with homekit or with the physical button is ok

I have hassio and i don't know how i can try it because it is just a container in docker but , i don't now how i can build the image specific for hassio

image

To resume , to be sure you have all the good information
When i use service close.cover in hassio
the cover try to opening with this log
2020-05-26 18:14:09 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': True, 'bri': 254}" to "172.30.33.1 /lights/3/state"
2020-05-26 18:14:09 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/3/state/lift': 100}}]

When i use open.cover
the cover opening too with this log
2020-05-26 18:16:14 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'on': False}" to "172.30.33.1 /lights/3/state"
2020-05-26 18:16:14 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/3/state/open': True}}]

When i use stop action
the cover stop with log
2020-05-26 18:17:01 DEBUG (MainThread) [pydeconz.gateway] Sending "put" "{'bri_inc': 0}" to "172.30.33.1 /lights/3/state"
2020-05-26 18:17:01 DEBUG (MainThread) [pydeconz.gateway] HTTP request response: [{'success': {'/lights/3/state/lift': 'stop'}}]

When i use api rest
{ "open": false } >> closing
{ "open": true } >> opening
{ "on": true } >> closing
{ "on": false } >> opening
{ "lift": 0} >> closing
{ "lift": 100} >> opening
{"bri": 0} >> closing
{"bri": 254} >> opening
{ "on": true, "bri": 254 } >> opening (like i use cover.close see log before)

If i check on cluster info:
When cover is open
Current lift percentage : 0

When cover is close
Current lift percentage : 100

Thx for help

@Smanar
Copy link
Collaborator

Smanar commented May 26, 2020

Yep, It's clear.
I just need to reverse the "bri" command. the command don't work in HA because you are using on and bri in the same command, and ATM at least for your device, this command is reversed.

I have just 2/3 lines to remove, but I realy think the difference is from your device, perhaps a recent firmware update.

I think I will need to check something (perhaps a firmware version, to know if I need to reverse the command or not.

Or If realy I don't found clean solution I will disable the "bri" parameter for legrand. Like that, no more problem, and always compatible.

ATM, I m waiting return for someone else with the same hardware, to know if you are the only one and why.

@plum59
Copy link
Author

plum59 commented May 27, 2020

Ok thx
I await your news

@plum59
Copy link
Author

plum59 commented May 27, 2020

Hello ,
can you give me the modification you think should be do and where (name file) ?
i will try to make a new version in my own side and create a personnal integration with this in hassio.
I will test an if it is ok i will told you

i think is probably around this :
rest_lights.cpp

else if (taskRef.lightNode->modelId() == QLatin1String("Shutter switch with neutral"))
{
// Legrand invert bri and don't support other value than 0
targetLiftZigBee = targetLift == 0 ? 100 : 0;
}

but i don't know what exactly i should modify

thx a lot

@Smanar
Copy link
Collaborator

Smanar commented May 27, 2020

Just remove the line ^^.
Or you can use targetLiftZigBee = targetLift == 0 ? 0 : 100; (Better to have only 2 value)

Or you can too just disable the "bri" command or ignore it according to the device id.

Or you can too use "open" and "close "in HA.

There so much method possible, but I didn't choose one yet.

@plum59
Copy link
Author

plum59 commented May 27, 2020

Ok, i will try one of your solution, but i need more help, i will clone repo off github make the modification but how i can make *.deb after when modification will be done ?

@Smanar
Copy link
Collaborator

Smanar commented May 27, 2020

Are you using HA or Hass.io ?

@plum59
Copy link
Author

plum59 commented May 27, 2020

Hass.io

@plum59
Copy link
Author

plum59 commented May 27, 2020

but i think is not a probleme
i have create my own deconz integration i just need deb file with correction to include in docker file
actually docker file is 👍

ARG DECONZ_VERSION
RUN if [ "${BUILD_ARCH}" = "armhf" ];
then
curl -q -L -o /deconz.deb http://deconz.dresden-elektronik.de/raspbian/beta/deconz-${DECONZ_VERSION}-qt5.deb;
elif [ "${BUILD_ARCH}" = "aarch64" ];
then
curl -q -L -o /deconz.deb http://deconz.dresden-elektronik.de/raspbian/alpha/deconz_${DECONZ_VERSION}-debian-stretch-beta_arm64.deb;
else
curl -q -L -o /deconz.deb http://deconz.dresden-elektronik.de/ubuntu/beta/deconz-${DECONZ_VERSION}-qt5.deb;
fi
&& dpkg -i /deconz.deb
&& rm -f /deconz.deb
&& chown root:root /usr/bin/deCONZ*
&& sed -i 's//root//data/' /etc/passwd

COPY data/ika-otau-dl.sh /bin/
COPY data/ledvance-otau-dl.sh /bin/
COPY data/nginx.conf /etc/nginx/nginx.conf
COPY data/run.sh data/discovery.sh /

@Smanar
Copy link
Collaborator

Smanar commented May 27, 2020

Ok, so sorry, I have already tried to help someone with Hass.io, I can nothing for you

There is window, unix, mac and Hass.io.

But you can use the normal deb, and change only the api file > libde_rest_plugin.so

@plum59
Copy link
Author

plum59 commented May 27, 2020

:( it is C language , i m not be sure i will be able to do that :D

@plum59
Copy link
Author

plum59 commented May 27, 2020

and i m not sure i have right to do that , it seem to be hacking :)

@plum59
Copy link
Author

plum59 commented May 27, 2020

thank you anyway, i will wait for you to get feedback from other users to maybe update

@Smanar
Copy link
Collaborator

Smanar commented May 27, 2020

On your version you can do all you want, you can freely edit the code.
But act on system on Docker system is just hell for me.

ATM, I think you can act on HA directly ? waiting for patch ? you can't edit the command send by the addon ?

@plum59
Copy link
Author

plum59 commented May 28, 2020

I'm sorry for insisting like that. but if I can't find a solution I will have to buy a new hub and it is expensive for me.

I think that in home assistant I cannot modify anything the code of the cover service is integrated.

the only solution for me is to modify the sources of the deconz application. I tried to see but I do not know anything in assembly and therefore I can not modify what I want and redo a deb file.
And i don't know how modify >> libde_rest_plugin.so

By cons I know docker and I have no problem with it

I do not understand when you made your changes in the master branch of git, which compiles the source code? Isn't it your team?

but it does not matter. I can see that you are trying to help me. and thank you for that

@plum59
Copy link
Author

plum59 commented May 28, 2020

oh , my bad it is explain here
https://github.com/dresden-elektronik/deconz-rest-plugin

@Smanar
Copy link
Collaborator

Smanar commented May 28, 2020

Ha yep, the compiling procedure ?

But in HA, you can to use "virtual device" with command line, remember deconz works with simple REST command, it's easy to use.

@plum59
Copy link
Author

plum59 commented May 29, 2020

Hello,

thx a lot i discover the power of rest_command
https://www.home-assistant.io/integrations/rest_command/

I would have preferred an integrated solution, but it works perfectly well

thanks for spending time for me

have a nice week

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 6, 2020

It seems this issue is resolved or otherwise inactive. If it is not, please re-open!

@Mimiix Mimiix closed this as completed Jun 6, 2020
@Smanar
Copy link
Collaborator

Smanar commented Jun 6, 2020

Not yet ^^
But for the moment there is only one person with this problem, so I m waiting.

@Smanar
Copy link
Collaborator

Smanar commented Nov 3, 2020

I m Smanar too on it.

But now I remember, the firwmare "out of the box" is buggy, I m using an hack in the code, so Legrand have probably corrected the bug on a future firmware and it can explain this result.

I will make the code tommorow, I will contact you for test, from my memory you are able to compile the code ?

just to be sure, on your capture the attribute lift position is reversed 0x0008, but the command are reversed too ? To check just use deconz , cluster 0102, and try "up" and "down", to check if the 2 command react same, or are reversed too.

@samsam-rolon
Copy link

I m Smanar too on it.

But now I remember, the firwmare "out of the box" is buggy, I m using an hack in the code, so Legrand have probably corrected the bug on a future firmware and it can explain this result.

I will make the code tommorow, I will contact you for test, from my memory you are able to compile the code ?

just to be sure, on your capture the attribute lift position is reversed 0x0008, but the command are reversed too ? To check just use deconz , cluster 0102, and try "up" and "down", to check if the 2 command react same, or are reversed too.

Okay, nice to know !
I'll confirm : those buton are working as expected for both switchs !
image

@samsam-rolon
Copy link

samsam-rolon commented Nov 5, 2020

Hello there !

After a lot of test and exchanges with @Smanar, We've got

  • how switch rollershutter works
  • differences between FW
  • why this buggy on HA

@pipiche38 : I'm prety sure you'll be intrested in !

Careful : it's long to explain !

First, you have to know how works exactly the rollershutter with the switch:

  1. You are pressing a UP/DOWN Command on the switch or via API (no matter there)
  2. The switch rollershutter is moving a relay inside to switch the electricity to move up or down the rollershutter.
  3. Inside of the motor, there is some "mechanical stops" to stop the shutter at the end of movement.

Notes : At this moment, the rollershutter have finished to moove and the motor is not more supplied by electricity thanks to mechanical stops but the switch is still sending power supply to the rollershutter

  1. After few time, the switch is "resetting" the relay to off position in order to not send power anymore to the rollershutter

Notes : You will ear a click like a turnlight after 1-2min
Bonus : I suspect it's a pure "timer" but it maybe also a timer after an undetected power consumption in the switch ?

Point 3 and 4 are very important !

How firmware 26 works (0x001a in hexa) (i.e. Firmware "out-of-the-box")

  1. You are pressing a UP/DOWN Command on the switch or via API (no matter there)
  2. The switch rollershutter is moving a relay inside to switch the electricity to move up or down the rollershutter.

At this moment, the rollershutter is mooving and the state of the rollershutter is not UP or DOWN.
in deCONZ API or in zigbee attribute deCONZ GUI even if I force a refresh of attribute

it's "bri":"127"or "lift":"50"

  1. Inside of the motor, there is some "mechanical stops" to stop the shutter at the end of movement.

REMINDER : At this moment, the roller have finished to moove but the switch is still sending power suppy to the rollershutter

At this moment the state of the rollershutter is UP or DOWN for you and the motor BUT NOT for the switch beacause it's waiting the "return of off position of the relay"

in deCONZ API or in zigbee attribute deCONZ GUI even if I force a refresh of attribute

it's "bri":"127"or "lift":"50"

  1. After few time, the switch is "resetting" the relay to off position in order to not send power anymore to the rollershutter

REMINDER : You will ear a click like a turnlight after 1-2min

or in deCONZ API or in zigbee attribute deCONZ GUI even if I force a refresh of attribute

it's "bri":"255"or "lift":"100" if OPEN
it's "bri":"0"or "lift":"0" if CLOSE

How firmware 33 works (0x0021 in hexa) (i.e. call "Firmware updated")

Physical switch action case :

  1. You are pressing a UP/DOWN Command on the switch
  2. The switch rollershutter is moving a relay inside to switch the electricity to move up or down the rollershutter.

At this moment, the rollershutter is mooving and the API state of the rollershutter is immediadtly UP or DOWN.
in zigbee attribute deCONZ GUI or in deCONZ API

it's "bri":"255"or "lift":"100" if CLOSE
it's "bri":"0"or "lift":"0" if OPEN

NOTE : Attribute is "bri":"127"or "lift":"50" if you are using STOP command (API or physical) before the end of the mouvement

  1. Inside of the motor, there is some "mechanical stops" to stop the shutter at the end of movement.

REMINDER : At this moment, the roller have finished to moove but the switch is still sending power suppy to the rollershutter

At this moment the state of the rollershutter is UP or DOWN for you and the motor BUT NOT for the switch beacause it's waiting the "return of off position of the relay"

Nothing change in deCONZ API or in zigbee attribute deCONZ GUI

  1. After few time, the switch is "resetting" the relay to off position in order to not send power anymore to the rollershutter

REMINDER : You will ear a click like a turnlight after 1-2min

Nothing change in deCONZ API or in zigbee attribute deCONZ GUI

API action case :

  1. You are asking a UP/DOWN Command on the API (with "open":"true/false" ou "lift":"0/100"
  2. The switch rollershutter is moving a relay inside to switch the electricity to move up or down the rollershutter.

At this moment, the rollershutter is mooving but the state of the rollershutter is still the old one. Neither updated throught websocket

NOTE : API is immediatly updated if you're force refresh the attribute in deCONZ GUI

NOTE : Attribute is "bri":"127"or "lift":"50" if you are using STOP command (API or physical)before the end of the mouvement

  1. Inside of the motor, there is some "mechanical stops" to stop the shutter at the end of movement.

REMINDER : At this moment, the roller have finished to moove but the switch is still sending power suppy to the rollershutter

At this moment the state of the rollershutter is UP or DOWN for you and the motor BUT NOT for the switch beacause it's waiting the "return of off position of the relay"

NOTE : Nothing change in deCONZ API or in zigbee attribute deCONZ GUI

  1. After few time, the switch is "resetting" the relay to off position in order to not send power anymore to the rollershutter

REMINDER : You will ear a click like a turnlight after 1-2min

NOTE : After few time, the network refresh the device attribute and the deCONZ API or in zigbee attribute deCONZ GUI is updated. The information is received by websocket

Conclusion

With latest FW, any API command need to force a refresh of attribute just after in order to get HA not buggy
That why the HA UP/DOWN button are unusable sometime, because return state is buggy ... and mouvement may be inversed ....

@lambu76
Copy link

lambu76 commented Nov 5, 2020

thx for the clear explanation of the problem, but now the question for you is crystal clear....is there any way to fix in HA or in deConz in order to have properly working ?

thx

One more question....how can I understand which is my firmware installed ? I was looking for one of the two strings referred by you inside deConz cluster info panel and I didn't find it.
I checked on Phoscon app and I can see only that my "Shutter SW with level control" has version 00b

@samsam-rolon
Copy link

samsam-rolon commented Nov 5, 2020

thx for the clear explanation of the problem, but now the question for you is crystal clear....is there any way to fix in HA or in deConz in order to have properly working ?

Yes ! @Smanar is going to pull a MR to correct that

thx

One more question....how can I understand which is my firmware installed ? I was looking for one of the two strings referred by you inside deConz cluster info panel and I didn't find it.
I checked on Phoscon app and I can see only that my "Shutter SW with level control" has version 00b

Hum, very strange.
I made an API Call like this :
http://172.16.0.65:8080/api/TOKEN_API/lights/17

{
  "etag": "e23005c63baee54ae855d83d17ab50c9",
  "hascolor": false,
  "lastannounced": "2020-10-17T21:54:09Z",
  "lastseen": "2020-11-05T14:35Z",
  "manufacturername": "Legrand",
  "modelid": "Shutter switch with neutral",
  "name": "Volet roulant Salon",
  "state": {
    "bri": 254,
    "lift": 100,
    "on": true,
    "open": false,
    "reachable": true
  },
  "swversion": "0021",
  "type": "Window covering device",
  "uniqueid": "00:04:74:00:00:99:c9:bf-01"
}

image

@samsam-rolon
Copy link

@lambu76
Is your device was previously connected to Official Gateway ? If yes, When ?
What's the device legrand model number ?

@lambu76
Copy link

lambu76 commented Nov 5, 2020

I don't have at all the Gateway.

I executed the API call and this is a fragment of the response.

{"etag":"fdb515f4e8280d1e1a978696fcd36b10","hascolor":false,"lastannounced":"2020-11-04T09:27:40Z","lastseen":"2020-11-04T18:19Z","manufacturername":"Legrand","modelid":"Shutter SW with level control","name":"Tapparella","state":{"bri":127,"lift":50,"on":true,"open":true,"reachable":true},"swversion":"00b","type":"Window covering device","uniqueid":"00:04:74:00:00:b1:dc:0a-01"}

aligned with the Phoscon App.

image

I just bought 10 days ago on Amazon for some tests.

@samsam-rolon
Copy link

Hum very strange .... maybe a very old firmware so ...
Can you confirm the reference product ID ?
On my side it's Ref. 0 648 96 like : https://www.legrand.fr/pro/catalogue/42566-version-celiane-with-netatmo/interrupteur-filaire-connecte-celiane-with-netatmo-pour-volet-roulant-graphite

@lambu76
Copy link

lambu76 commented Nov 5, 2020

Not that one.

Mine is BTicino, italian brand .

https://catalogo.bticino.it/BTI-L4027C-IT

@samsam-rolon
Copy link

Oh .... very different !

@lambu76
Copy link

lambu76 commented Nov 5, 2020

I think it0's only different in term of cover but not in term of functionalities....btw it generates the same problem.

It works perfectly from deConz, but not from HA

@Smanar
Copy link
Collaborator

Smanar commented Nov 5, 2020

@lambu76 I have already answered (and on several issue), your device is not yet in deconz, if you want to make try with it, you need to compile the code or wait for future version.

@lambu76
Copy link

lambu76 commented Nov 5, 2020

let's wait.... :-((

@Smanar
Copy link
Collaborator

Smanar commented Nov 5, 2020

Ok so for the little story, we have found 2 methods to try

  • Force the device state just after the command (set the device to "open" even it s not open in reality after an "open" order).
  • Force the device state at unknow position just after the command ( 0 = closed, 100 = open, 50= stopped or working).

All have advantages and disadvantages. For exemple if you use the "stop" command. if you use script or monitoring, or the delay to have the return.

@samsam-rolon is testing the 2d method ATM.

@pipiche38
Copy link

pipiche38 commented Nov 8, 2020

Problem is the same with firmware 0x23 :-(

@lambu76
Copy link

lambu76 commented Nov 15, 2020

I tried last firmware 2.05.88 and there is no changes in the wrong behavior with Legrand Bticino Living Light L4027C used with Hass.IO ....let's hope in the very new version 2.06.00 just released today.

@Smanar
Copy link
Collaborator

Smanar commented Nov 16, 2020

Yep, the patch was not in the version 88, but in the 2.6.0
https://github.com/dresden-elektronik/deconz-rest-plugin/releases/tag/v2.6.0-beta

@lambu76
Copy link

lambu76 commented Nov 16, 2020

ok thx.

I have to wait the auto update for Deconz add-on into Hass.IO.

thx

@blendesign
Copy link

blendesign commented Nov 17, 2020

yes, i have exactly the same problem ! but as i'm a noob with Deconz and HA, not sure to understand everything.....
i never had the chance to down the shutter !
It works perfectly from deConz interface, when i use the buttons there.

@Smanar
Copy link
Collaborator

Smanar commented Nov 17, 2020

There is a patch (probably) for this bug in the deconz version 2.6.0 (beta version)

@blendesign
Copy link

ok.... is it difficult to install it on HA ?

@Smanar
Copy link
Collaborator

Smanar commented Nov 17, 2020

Yes ^^, and more if you are using container.
If you don't have deconz on another machine/VM, I think it s better for you waiting for they use it.

@blendesign
Copy link

i installed Deconz also on my computer ( Windows10 ).... is it possible to update it there, and then put the Conbee2 on my Pi4 ?

@Smanar
Copy link
Collaborator

Smanar commented Nov 17, 2020

ha yes to try you can install deconz on the PC I have just see the beta version available for windows too (but the conbee need to be on the PC)
And you can configure HA to use the deconz installed on the PC, but I can't explain the procedure for HA.

It s deconz you need to update, not the conbee.

@blendesign
Copy link

after some thought about that, i think the windows version of Deconz is not the same than the Pi4 version under HA....
i think i mix the Conbee2 firmware ( same for both: Pi4 and windows) and the Deconz Software ( different) !

@lambu76
Copy link

lambu76 commented Nov 25, 2020

does someone know when version 2.6.0 will be deployed also on Deconz add-on version for Hass.IO ?

thx

@Smanar
Copy link
Collaborator

Smanar commented Dec 19, 2020

@lambu76 do the device is working for you ATM ?
I need some return for bticino #3876 (comment)

@lambu76
Copy link

lambu76 commented Dec 19, 2020

yes it works with HASSIO with deconz installed as official add on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants