gome-assistant icon indicating copy to clipboard operation
gome-assistant copied to clipboard

Add REST client

Open metalmatze opened this issue 11 months ago • 8 comments

Hey, I'm wondering if you would consider adding a REST client too. I believe some things can only be done through the REST API.

There's a good Go implementation in another project already. https://github.com/joshuar/go-hass-agent/blob/main/internal/hass/api/rest.go

We could join the efforts and make one great client to be used in go-hass-agent too. I have already started using this client for one of my other projects. 😌

What do you think, @saml-dev & @joshuar?

metalmatze avatar Jan 16 '25 17:01 metalmatze

Hey, gome-assistant already uses the REST API internally to retrieve entity states. What is it that you're trying to do with gome-assistant that you can't?

saml-dev avatar Jan 16 '25 20:01 saml-dev

Personally, I want to register entities.

metalmatze avatar Jan 16 '25 21:01 metalmatze

My use case is that I'd like to list all entities so that I don't need to hard code the names and make them more discoverable. I'm happy to add list endpoint to the API myself

zimnyjakub avatar Jan 20 '25 22:01 zimnyjakub

@zimnyjakub thanks for the PR, I'll take a look but at first glance it looks good to me. How do you plan to utilize it to avoid hard coding entity names? If you're up for it, #9 has been open for a while which would use code generation to create some kind of constants file. I've never set up code generation in Go myself so I'm not sure what it entails

saml-dev avatar Jan 21 '25 01:01 saml-dev

I want to use this library to create a discord bot to manage HA, a pet project - one of the features I want to implement is to add lights to a room from a channel; so for example i'd like to list entities first to find which one i can add to a room(channel)

Its just a pet project 🙃

zimnyjakub avatar Jan 22 '25 07:01 zimnyjakub

Personally, I want to register entities.

@metalmatze I think this is something we could expose in gome-assistant rather than just directly exposing the HTTP client itself. PRs welcome if you want to tackle it 😁

saml-dev avatar Feb 07 '25 12:02 saml-dev

Hi, I apologize for the long silence. In the end, I realized what I really wanted was a custom integration to talk to from within HASS. I now have a small Python app that I load, which then communicates with my server, although not in Go, but in Rust for learning purposes. Could have been Go, though.

metalmatze avatar Apr 22 '25 17:04 metalmatze

Cool! Is it open source? If so drop a link 😁

saml-dev avatar Apr 23 '25 02:04 saml-dev