Skip to main content

Home Assistant Simple Websocket client

Project description

Home Assistant WebSocket wrapper

The purpose of this module is to allow to execute synchronous calls to Home Assistant WebSocket API.

It is based on Home Assistant WebSocket API.

It uses synchronouse calls and short-lived connections. Which means each call will open a new connection, execute the call and close the connection. this is way simple and fast in development, but not very efficient in terms of performance. However, it is good enough for most of the cases especially scripting the HomeAssistant.

Usage

You can either use it with AppDaemon or without.

With AppDaemon the token and server information will be configured automatically:

from HassWS import HassWS


class appdaemon_app(hass.Hass):
    hws: HassWS

    def initialize(self):
        self.hws = HassWS(hass_instance=self)
        self.log(self.hws.send('config/entity_registry/list'))

Or without AppDaemon:

from HassWS import HassWS

hws = HassWS(server_url='wss://my.hass.url:8123',token='token goes here')
print(hws.send('config/entity_registry/list'))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

HassWS-0.0.3.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

HassWS-0.0.3-py3-none-any.whl (1.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page