Extend hass entity (cover)

Hello,
I’m developing an integration of Selve (https://www.selve.de) iveo devices.
They are mainly covers with up / down / stop without feedback about the position. I already have them working this way.
However this decives provide two more controls “go to intermediate position 1” and “go to intermediate position 2” and I would like to allow the user to directly bein able to use them on the hassio ui.
So I was thinking about extending the Cover entity to something like “Anwing Entity” or “Blind Entity” and add those two accesors. But I’m not sure how to do it. I reviewing the dev documentation and it is a bit confusing to me.
It is enough to add just two “set” methods to the entity and then they are accesible? or should I have to add more wiring?

Thanks for helping

2 Likes

Hey, just wondering how you went with this?

Im actually looking at developing an almost identical component for a blinds controller here in Australia but im pretty new to programming. I was wondering if you could share your work to assist me in re configuring it to work with the component im wanting to develop? Does yours use http requests?

Hello,
At this moment as home assistant suggest, I have a “hardware gateway” pypi module:


to link with the hardware.
And I alseo create the home assistant custom component:

At this moment I didn’t create the new services for the “intermediate positions” as I’m implementing other components that would help me understand how to add the behaviours to HA so I will go back to the blidns when I learn how to do it properly.

Of course I will share anything usable.

My components doesn’t use http requests as the hardware logic is abstracted on the first library. I suggest you to start developing the hardware library first that would work without HA (create some cli program so you can play with it). This library has to abstract the intercomunication with the hardware.
And then you can create the HA component that will use your library (after uploading it to pypi)

Thats great, thanks for your feedback. Like you, at this stage i just want to get the basics up, down and stop to work and then i’ll look into the intermediate positions.

Just to clarify, i’ve been mucking around with a python script using tkinter (python GUI). Is this what you mean by developing the hardware library first and then upload to PyPI so it’s useable by HA? And then when i create my custom component i can refer to my PyPI package?

Hello,
Take a look to my python-selve library (it lacks more documentation and clarifications, but I hope it is easy to follow). It would give you some ideas on how to implement the hardware abstraction part.

The first question is: how do you interface with your blinds?

Hi,

I just found this and it looks like great work to implement the Selve USB gateway.
However, since I am really just starting with this, could you probably help me with some basics to get it going?

I am running Home Assistant on a raspberry pi 4. I understand that I need both linked sources, i.e. the “hardware gateway” and the home assistant custom component.

For the latter one, I copied the files into a folder called “selve” under “custom_components”. Please let me know if this is correct. The major question though is how to run the “hardware gateway”. Where do I save the files and how do I launch them within the Home Assistant UI?

Thanks!

Hello,
First of all the python-selve is the library that can control the selve devices if you already own a selve-usb-rtf gateway stick.
Also although the gateway is capable of controling iveo and homeo devices, I have just implemented the iveo part as are the devices that I own, however to extend the library to use the homeo is straighforward
For configuring, testing and to make sure that the hardware works I recommend to use the official selve program to taught the devices (blinds motors for example) into the gateway to do so, just plug the usb on a pc, run the selve software and configure them.
(anyhow, the python-selve also provides a cli that can be used to register devices).
So once you have the devices taught onto the gateway you can use the python-selve cli to try to move up, down etc.
Once this works, I just plug the gateway on the same raspi where the HA is running, look for its usb port and them use the custom component, the steps that you have made are the right ones, copy the homeassistant-selve component as a custom component, then you only need to configure it on the ha configuration file adding:

selve:
  port: /dev/ttyUSB0

(change the usb interface for the right one)
Let me know if this is enough information.

Hello Gabriel,

first of all, thanks a lot for the quick reply.
I do have the selve-usb-rtf gateway stick and it is configured and running under windows already, using the Selve software provided.

I am having difficulties with this part:

I am not sure where to store the python-selve files on the pi. I assume I create a folder under /config/python_scripts/ correct? Do I have to name the folder “python-selve”?
How do I register the script in the configuration.yaml file, if required?
Can I use the terminal in Home Assistant to run it?

Sorry, I know it’s pretty basic stuff I am asking.

Following your configuration guide, for the moment with the custom component I get the error notification that
"the following integrations and platforms could not be set up:

  • selve
    Please check your config."

I guess this is because the python-selve part is missing for the moment.

Hello Gabriel,

please disregard my last message. It works like a charm! Thanks for the effort you put into this.

I am not sure where I went wrong before, but for anyone who requires more detailed instructions how to use it:

  • download the “python-selve” module from Github into a folder “python-selve-1.2.1”
  • copy the folder via Samba to \[Home Assistant IP]\config\python_scripts\
  • if the folder python_scripts does not exist, you have to create it first
  • download the “homeassistant-selve” module from Github into a folder “selve”
  • copy the folder via Samba to \[Home Assistant IP]\config\custom_components\
  • if the folder custom_components does not exist, you have to create it first
  • in the file init.py in custom_components\selve\ I changed the version in following line to 1.2.1
    REQUIREMENTS = ['python-selve==1.2.1']
  • in your configuration.yaml file add following entries:
python_script:

selve:
    port: /dev/ttyUSB0
  • to find the port information, go to Supervisor, System and Hardware and you will find the plugged USB devices.

There might be easier ways to configure this, but for me worked, so I hope this helps.

Hello @Murdocdeluxe
I’m glad that it worked for you.
Thanks for pointing me out that the homeassistant-selve custom component was outdated.
I’ve just added the missing manifest and also update to 1.2.1.
With that changes you should not need to download manually the python-selve it should be ha the one that will do it for you.
Please notice that I’m using the tilt positions as “shortcuts” for the “going to intermediate point 1 and going to intermediate point 2” of the blinds (the double click on the remotes).
My original idea was to extend the blind component to be able to expose proper dedicated buttons but I don’t have time at this moment to learn lovelace and implement them. Please feel free to work on it and I will accept pr on the component (or the library, both are FOSS)

Just in case anyone was reading the thread, the python-selve library has an small python cli that you can use to play with the blinds, this way the library can be integrated on any control software, not just HA. To make it work you just need to execute the library cli on a pc with python 3 and capable to reach the usb stick through a serial port.

hey, can some one help me to get my selve work in Ha ? I’m stuck after the step " * in your configuration.yaml file add following entries:" I have installed the integration and the library. but how can I control / discover etc… my devices ? I have 26 in my house and all of them are configured with windows 10 and the gateway usb

Thx from Germany

Hello @KevLaCross,
You only need to add the custom_component and the library will be downloaded by HomeAssistant for you as it is on pip.
-Are your selve blinds configured to use Iveo? (at this moment the llibrary only works with iveo commands, if i have time I will try to extend it to use commeo also).
-Do you have the usb gateway connected to the same pc / device that is running the HA?
-Then you only need to add the usb port config where to the usb gateway is plugged in.

Hi, thx for your quick reply. I have configured all of the devices in the gateway, connected it to the raspberry, I´ll post you some screenshots. but I see no new devices