Gå til innhold
  • Bli medlem
Støtt hjemmeautomasjon.no!

Homely integration


kolaf

Anbefalte innlegg

Sorry for writing in English, I'm using speech recognition to avoid having to type out long Norwegian sentences because of tendinitis.

 

image.png.82e21a0c279bc61ec9096571f9c52e13.png

 

I have just started developing an integration for Homely integration for Home Assistant. My initial pull request is currently in review, and once this is accepted we should be able to poll the Homely API for various sensor data. I currently only support the following devices:

  • Door sensor
  • Smoke alarm
  • Motion sensor mini

image.thumb.png.cfa01d9547542881d130e445de39c384.png

These are the only devices I have, and the documentation is not very extensive. The keypad and siren does not seem to appear in the API. If you have additional devices, please consider downloading the helper package homelypy, run it, and provide me with the dump as described in the readme file. It should provide me with the necessary information to add support for any included device. Or better yet, create a pull request with the additional devices :-).

 

Note that the API is currently only read-only, so we can only receive telemetry data from the devices, not control them. It is therefore not possible to e.g. arm the alarm or sound the siren. I do not know if or when they are planning to improve this, but hopefully soon 🤞

 

The method for getting things into Home Assistant is a bit slow, so I am only allowed to include a single platform in the first round. I have chosen sensors, so we get temperature, battery level, and signal strength for each device. The binary sensors have already been created (alarm state and battery low state), but I have to wait until the initial pull request is approved. On my list is also to create a separate device that represents the home alarm system to show the various states of arming and alarming. Depending on how slow things go I might get everything approved before the next release, maybe.

 

Unfortunately I have not gotten the web socket interface to work correctly, yet, I have a support request waiting with the guys at Homely. Until I figure this out the integration only supports polling and is set up to do this every five minutes to avoid any throttling issues. 

 

My ongoing development branch is here: https://github.com/kolaf/core/tree/homely/homeassistant/components/homely

And the associated pull request is here: https://github.com/home-assistant/core/pull/84951

 

If you have any comments, suggestions, or want to chip in, just let me know. And, of course, feel free to reply in Norwegian.

 

Kolaf

 

Endret av kolaf
  • Like 3
  • Thanks 1
Lenke til kommentar
Del på andre sider

Jeg lagde selv en liten integrasjon mot mitt OpenHAB-hus i fjor høst, og ser ut til å ha kommet like langt som deg. Ingen websocket som fungerte, selv etter kontakt med kundeservice og mye testing i Postman. Savner status på dørlås via API, den fikk jeg aldri, men hadde kanskje fått tak i den hvis jeg fikk websocket til å fungere. 

 

Min lille bit med kildekode ligger på https://github.com/berland/pyrotun/blob/master/pyrotun/connections/homely.py, denne har tuslet og gått i det minste siden oktober.

 

Lenke til kommentar
Del på andre sider

If anyone wants to check it out you can download version 0.0.2 from this location: https://drive.google.com/drive/folders/1D-obD-u7v_-Q1A0Ik1d_gXdq4WpDZwy0?usp=share_link

 

It should be as simple as creating a folder "custom_components" inside your HA configuration folder, create a folder "homely" beneath this and unpacking the files into the homely folder. After restarting HA you should be able to add the integration through the integration page.

 

It supports basic states and binary sensors for the devices I know about. If your device is missing I need a dump to know the model names. I have also added a basic alarm control panel entity. This is very restricted since we do not have write access to the API, but at least it should show the arming state of the alarm system. The system still relies on polling every five minutes, so do not expect to see every door and window opening and it can take up to 5 minutes before an alarm state is updated.

 

I'm still waiting for my initial pull request with the sensor entities to go through, it is taking a while longer than expected since the response from their site has been very slow. In the meantime we can play around with this. If anyone has any experience with the homeassistant alarm entitis I would be glad to learn since this version with non-functioning buttons will probably not be accepted.

On 17/01/2023 at 07:01, berland said:

Jeg lagde selv en liten integrasjon mot mitt OpenHAB-hus i fjor høst, og ser ut til å ha kommet like langt som deg. Ingen websocket som fungerte, selv etter kontakt med kundeservice og mye testing i Postman. Savner status på dørlås via API, den fikk jeg aldri, men hadde kanskje fått tak i den hvis jeg fikk websocket til å fungere. 

 

Min lille bit med kildekode ligger på https://github.com/berland/pyrotun/blob/master/pyrotun/connections/homely.py, denne har tuslet og gått i det minste siden oktober.

 

Thanks. It is a shame that you did not get anywhere with the websocket since this is required to make an alarm system truly useful. How often do you poll for state updates? I chose five minutes as a compromise, but more often would be better :-). I have not installed my door lock yet (it's lying on a shelf), but I am considering joining this directly in homeassistant instead of through homely.

Endret av kolaf
  • Like 1
Lenke til kommentar
Del på andre sider

I have now uploaded version 0.1.0 to Google Drive.  It is updated to use my newly pushed homelypy 0.1.0 where I have finally gotten the websocket to work. This is thanks to very useful help from this implementation: https://github.com/hansrune/homely-tools. The trick is to use socketio instead of the python websocket-client library.

 

The latest version of integration should support streaming updates of entities, so that door sensors, alarms, et cetera are updated in real time. I have not had a chance to run this for a longer period yet, so I am not sure what the stability of the connection looks like. It might well be that I will have to improve the reconnection functionality.

 

Let me know how this works for you.

Lenke til kommentar
Del på andre sider

Glad you found https://github.com/hansrune/homely-tools useful. Took me quite some effort to figure out. Websocket IO response is very good, so I use that to trigger scenes like going to bed when the alarm is set to armed night and similar…

… I still poll status every 2 minutes by default. This is highly recommended because it has happened that the websocket service has been unavailable for quite some time. 

Lenke til kommentar
Del på andre sider

I just updated the existing version 0.1.0 to correctly handle alarm states for the house.

 

I have left the code that polls every five minutes, so this should still work as a fallback if the socket disappears.

Endret av kolaf
Lenke til kommentar
Del på andre sider

kolaf skrev (På 21.1.2023 den 21.57):

How often do you poll for state updates? I chose five minutes as a compromise, but more often would be better :-).

Every tenth second here 😎

 

 

But I will try out hansrunes websocket code, an then maybe that often is not that relevant 

Lenke til kommentar
Del på andre sider

hansrune skrev (På 25.1.2023 den 17.32):

Glad you found https://github.com/hansrune/homely-tools useful. Took me quite some effort to figure out. Websocket IO response is very good, so I use that to trigger scenes like going to bed when the alarm is set to armed night and similar…

… I still poll status every 2 minutes by default. This is highly recommended because it has happened that the websocket service has been unavailable for quite some time. 

Thanks a lot, your websocket code worked straight away for me. I will merge your GPL3 code into mine GPL code 👌

  • Like 1
Lenke til kommentar
Del på andre sider

11 hours ago, hjemmedude said:

Takk - tester 0.1.2 her og den fant alle mine enheter minus yale doorman. 🙂

 

Ny feil følger. Versjon 0.1.3 er lastet opp. 

 

Om du følger readme til https://github.com/kolaf/homelypy og sender meg json filen så får jeg sikkert laget støtte for dørlåsen etterhvert.

Endret av kolaf
  • Like 1
Lenke til kommentar
Del på andre sider

Helt grønn på python. Har lastet ned og ekstraktet homelypy. python3 er installert. Kjører

python3 -m homelypy.homely [email protected] og får feil 
....AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe: Error while finding module specification for 'homelypy.homely' (ModuleNotFoundError: No module named 'homelypy')

 

edit: isntallerte med python3 -m pip install homelypy og da gikk det bedre. 🙂

Sender deg .json .

Endret av hjemmedude
Lenke til kommentar
Del på andre sider

We are slowly getting there. New version 0.1.4 has been uploaded. The last version 0.1.3 has been quite stable for the past 24 hours, so I believe I have resolved the issue with the websocket disconnecting from time to time. This version solves an issue where the instability of the Homely API endpoint causes the sensors to be "unknown" if it fails during a poll. They will be marked as unknown until the next poll five minutes later. I have tried to rectify this by allowing it to fail two times before throwing an error. Since we still probably are connected to the web socket the user should not notice this at all. This also means that if everything fails can take 15 minutes before the system shows as unavailable/unknown.

 

0.1.4 also adds support for "Heat Alarm" and "Motion Sensor 2 Alarm" model names.

 

Also, to follow-up the yale doorman issue above, it seems that this device is not included in the data feed from Homely, unfortunately.

Endret av kolaf
Lenke til kommentar
Del på andre sider

Ny versjon 0.1.5 er lastet opp.  Ikke mye nytt, men tror jeg omsider har fått has på stabiliteten.  Homely sitt API er ganske ustabilt, men jeg tror jeg nå endelig håndterer det på en god måte.

Lenke til kommentar
Del på andre sider

  • 4 uker senere...
  • 2 uker senere...

Kjører også 0.1.5 og det ser ut til å fungere bra. Har fått tilsendt v2 av flere av Homelys komponenter. Integrasjonen finner ikke disse, men jeg kan få sendt over output fra homelypy om ikke lenge.

 

Tusen takk for innsatsen, Kolaf!!!

Lenke til kommentar
Del på andre sider

  • 2 uker senere...

Hei,

 

Ser på å bytte fra Verisure til Homely selv så dette ser jo helt super ut - takk for innsatsen 🙂

 

lite spm - er det fortsatt bare mulig med «read only» via api’et eller kan man skru av/på alarmen? 
 

mvh, Tor

Lenke til kommentar
Del på andre sider

Bli med i samtalen

Du kan publisere innhold nå og registrere deg senere. Hvis du har en konto, logg inn nå for å poste med kontoen din.

Gjest
Skriv svar til emnet...

×   Du har limt inn tekst med formatering.   Lim inn uten formatering i stedet

  Du kan kun bruke opp til 75 smilefjes.

×   Lenken din har blitt bygget inn på siden automatisk.   Vis som en ordinær lenke i stedet

×   Tidligere tekst har blitt gjenopprettet.   Tøm tekstverktøy

×   Du kan ikke lime inn bilder direkte. Last opp eller legg inn bilder fra URL.

×
×
  • Opprett ny...

Viktig informasjon

Vi har plassert informasjonskapsler/cookies på din enhet for å gjøre denne siden bedre. Du kan justere dine innstillinger for informasjonskapsler, ellers vil vi anta at dette er ok for deg.