Closed vlebourl closed 2 years ago
Hi @vlebourl ,
Sure, I think it will be a great addition to the library to have the homeplusautomation
. I personally only have had access to the plugs, wall switches and remotes.
I'll do my best to include this module based on what you indicate above or let me know if you make any progress on this yourself :-)
For HA integration, I understand that we would then have to include this as a cover entity. Let's get to it! 👍
I'll have a better look as soon as I get my credentials! How long did it take for you to get an answer from Legrand?
Hi @vlebourl ,
I'm starting to look into the automation module. Would you be able to provide a sample of the JSON returned by the "Get all plant's modules status" that includes the automations?
Thanks
I've tried to look at your code, but got a bit lost 😅 I'll get you those json tomorrow i think! And I'd be happy to assist in writing and testing the code! Cheers
hey, sorry for the delay... here you go
{
"modules": {
"lights": [],
"plugs": [],
"automations": [{
"reachable": true,
"level": 0,
"step": 100,
"fw": 16,
"sender": {
"plant": {
"module": {
"id": "000070ee503ed5d462756200xxxxxxxx"
}
}
}
}, {
"reachable": true,
"level": 100,
"step": 100,
"fw": 16,
"sender": {
"plant": {
"module": {
"id": "000070ee503ed5d462756200xxxxxxxx"
}
}
}
}, {
"reachable": true,
"level": 0,
"step": 100,
"fw": 16,
"sender": {
"plant": {
"module": {
"id": "000070ee503ed5d462756200xxxxxxxx"
}
}
}
}, {
"reachable": true,
"level": 0,
"step": 100,
"fw": 16,
"sender": {
"plant": {
"module": {
"id": "000070ee503ed5d462756200xxxxxxxx"
}
}
}
}, {
"reachable": true,
"level": 0,
"step": 100,
"fw": 21,
"sender": {
"plant": {
"module": {
"id": "000070ee503ed5d462756200xxxxxxxx"
}
}
}
}],
"energymeters": [],
"remotes": [],
"heaters": []
}
}
Thanks @vlebourl!
I have made some progress with the implementation of the automations in the library.
You mentioned earlier that you cannot set a particular level for these and that you can only indicate fully opened or fully close, is that right?
With the wall switch, are you able to stop the movement of the cover while it is opening or closing? I would like to know if the API can maybe return a level value that is different from 0 or 100 (even if the level itself cannot be set via the API).
Thanks again.
The wall switch has two buttons, up and down, and hitting any of them while the cover is moving makes it stop. The app has a stop button that has the same effect. I haven't sniffed the app traffic to be sure what command is sent for each button... I wouldn't be surprised I missed something from the API!
looking into this as well, (I have legrand with netatmo shutters + remote) and I use home assistant.
This is what I get when I pull all my plant details from Legrand 'test" api page.
From what I found / tested, it's indeed 0 or 100 to close / open. You can get the state (0 or 100) but you can't tell to stop at 50, it will go all the way. Sending 70 doesnt matter, if it's more than 0, boom, it will close.
But sending -1
apparently stops the shutter in whatever state it is, allowing some kind of half open state, if timed properly.
{
"plant": {
"id": "000000005f8b675297f941213c60d26c",
"ambients": [{
"id": "5f8b675297f941213c60d26c48cc23d4",
"name": "Salon",
"type": "livingroom",
"modules": [{
"id": "000000047424154a0004740000ab5fb0",
"name": "Commande sans fil 2",
"hw_type": "NLT",
"device": "remote"
}, {
"id": "000000047424154a00047400008c588f",
"name": "droit",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a00047400008c5887",
"name": "gauche",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a0004740000a9ae51",
"name": "Commande sans fil 8",
"hw_type": "NLT",
"device": "remote"
}]
}, {
"id": "5f8b675297f941213c60d26c7fd8335b",
"name": "bedroom1",
"type": "bedroom",
"modules": [{
"id": "000000047424154a00047400008c5880",
"name": "Volet roulant 1",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a00047400008c587a",
"name": "Volet roulant 3",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a0004740000ab5fa9",
"name": "Commande sans fil 4",
"hw_type": "NLT",
"device": "remote"
}, {
"id": "000000047424154a0004740000ac7d48",
"name": "Commande sans fil 5",
"hw_type": "NLT",
"device": "remote"
}]
}, {
"id": "5f8b675297f941213c60d26cd07fddfd",
"name": "bedroom2",
"type": "bedroom",
"modules": [{
"id": "000000047424154a00047400008c5879",
"name": "Volet roulant 2",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a0004740000ab5fac",
"name": "Commande sans fil 7",
"hw_type": "NLT",
"device": "remote"
}]
}, {
"id": "5f8b675297f941213c60d26c1af71316",
"name": "bedroom3",
"type": "bedroom",
"modules": [{
"id": "000000047424154a00047400008c5881",
"name": "Volet roulant 7",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a0004740000ac7d45",
"name": "Commande sans fil 6",
"hw_type": "NLT",
"device": "remote"
}]
}, {
"id": "5f8b675297f941213c60d26c5b438bf5",
"name": "Bureau",
"type": "home_office",
"modules": [{
"id": "000000047424154a00047400008c5888",
"name": "Volet roulant 5",
"hw_type": "NLV",
"device": "automation"
}, {
"id": "000000047424154a0004740000ac7d4a",
"name": "Commande sans fil 3",
"hw_type": "NLT",
"device": "remote"
}]
}, {
"id": "5f8b675297f941213c60d26c9cab87c2",
"name": "entrance",
"type": "lobby",
"modules": [{
"id": "000000047424154a00047400000ca46b",
"name": "Prise 1",
"hw_type": "NLP",
"type": "other",
"device": "plug"
}, {
"id": "000000047424154a0004740000ad5f45",
"name": "Commande sans fil 1",
"hw_type": "NLT",
"device": "remote"
}]
}],
"modules": []
}
}
Good catch on the -1! I'll test that
Hi @schusss , @vlebourl ,
Thanks for the information. In the develop
branch there is already an initial version that should support the "automation" module. It currently sets the level parameter to 0 or 100, or it can issue the "stop" command by setting level -1. I had seen in the Legrand Developer forums that this was in fact supported by the API.
One question that I would still have is, what level does the "get automation's status" method return when you stop the shutter before it is fully shut or fully open? Does the API "behave" properly and so returns say a mid-range value between 0 and 100? Or does it still return only fixed values or "incorrect" values in the sense that it will return 0/100 even if that is not it's current status?
The current implementation assumes that the API will return the actual level value, and so there is a call to the "get automation status" method if you send the stop command to the shutter.
Thanks!
{
"automations": [{
"reachable": true,
"level": 50,
"step": 100,
"fw": 39,
"sender": {
"plant": {
"module": {
"id": "000000047424154a00047400008c5888"
}
}
}
}]
}
This is what I got when the shutter is half open. it seems to always send 50 as a value, if it's not fully closed /open. Even if the shutter is 30% closed or 80% closed, it will send 50. So I guess there is only 3 states, 0, 50, 100. it's not accurate in it's "half open" state. I'll do more testing during the day and give more details if I find anything useful
Hey, I'm trying to have a look at this, but so far, I can't get a correct authorization following your usage example
. I get the token, but the following line returns an "unauthorized" error... any idea?
Hey, I'm trying to have a look at this, but so far, I can't get a correct authorization following your
usage example
. I get the token, but the following line returns an "unauthorized" error... any idea?
this is fixed by #7
Hey, I have a PR ready to submit to Home Assistant Core to support iDiamant covers, but I need PRs #7 and #8 to be merged, and dev branch to be published... Any idea when you might have some time for that?
Hi @vlebourl ,
Thanks for your help and sorry for the delay - haven't had a chance to work much on this project for a while :-(
I just merged your changes and have released version 0.0.6 of the library to PyPi, so you should be able to use that in the HA PR.
Thanks!
Thanks ! Although I'm so sorry, but PR #7 needs to be reverted 😞
I don't know why I needed it to run the example code, but it actually brake the HA integration...
OK, that's unfortunate. I removed the code change of PR #7 and generated release 0.0.61 of the library. Please let me know if this works now with Home Assistant.
Hey, I see you've been active this morning! cheers :) I have a PR ready for core that should be working with the new version 0.1. I'll do some further testing and I can publish it later today or tomorrow if that's ok with you!
Hi @vlebourl ... yes, apologies because I now have limited time to dedicate to this :-S
Just note that I messed up the release numbering and decided to just bump up to 0.1.
Thanks for all your contributions to this!
no problem, I can relate! I have a working version installable through HACS here: https://github.com/vlebourl/custom_homepluscontrol
feel free to try and comment! once tested enough I'll publish a PR to core. nice job, cheers
I submitted a PR to core. https://github.com/home-assistant/core/pull/59494 We can close this! Thanks
Hi, sorry if this is already included. I'm still waiting for my Client ID and Secret so I haven't been able to check on my own... I own an iDiamant module to control Bubendorff covers. I believe from your doc that it isn't included yet. Here's a sample json from the get plant topology endpoint:
Using the dev website, I've been able to get the covers state using Get automation's status:
And control it with Set automation's status body:
(level is limited to 0 for closed and 100 for open for my covers as they don't have state return for mid closing...).
Any chance that could be added to the API and the HA module? I've forked and started looking at your code, but without my ID and Secret, I can't do muck yet... Let me know if I can help in any way!
Cheers (and great job and creating this!)