Giter Site home page Giter Site logo

leosperry / ha-kafka-net Goto Github PK

View Code? Open in Web Editor NEW
95.0 2.0 0.0 2.55 MB

Integration that uses Home Assistant Kafka integration for creating home automations in .NET and C#

License: Other

C# 91.83% HTML 0.36% TypeScript 7.78% CSS 0.04%
dotnet home-assistant kafka csharp c-sharp home-assistant-integration home-automation homeassistant

ha-kafka-net's People

Contributors

leosperry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ha-kafka-net's Issues

Create Trace Data Object

We need an object for tracking trace data. It should include:

  • Timestamp
  • Link to automation
  • Action that was taken (e.g. trigger or delayed execution)
  • Log data
  • Data that was passed to automation

New Automation Specific UI

Create a new view in the UI for rendering information about a specific automation

Data to list

  • Information about the automation itself
    • Key
    • Name
    • Description
    • Trigger IDs
    • Additional IDs
  • Last run data

To be added in a later story

  • Logs
  • Trace Data

Prebuilt Durable auto on/off events not triggering

At restart, the Old and New values of a state change can be the same if the event being handled is the same as last cached.

In the case of DurableAutoOff, this means that TurnedOn() will return false because it is trying to check old versus new, and at this point in time, the actual Old is gone. Both states could be saying "on". So, the code is not saying that it turned or changed from off to on.

Options:

  • Don't have DurableAutoOff check Old. Instead only check if it is currently on.
  • Future version possibility: have the cache also cache the previous for this case.

Fix coming today.

Handle Power Failure

After a power outage, if HA comes back online before the kafka instance, HA will not load the integration.

Unfortunately, HA does not expose state of inetgrations via API.

We might be able to check the logs, but they are not clear. Example HA log:

2024-02-06 07:54:05.161 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/apache_kafka/__init__.py", line 152, in write
    await self._producer.send_and_wait(self._topic, payload)
  File "/usr/local/lib/python3.11/site-packages/aiokafka/producer/producer.py", line 461, in send_and_wait
    future = await self.send(
             ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiokafka/producer/producer.py", line 444, in send
    key_bytes, value_bytes = self._serialize(topic, key, value)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiokafka/producer/producer.py", line 349, in _serialize
    self._producer_magic)
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AIOKafkaProducer' object has no attribute '_producer_magic'

Expected Behavior:
If we can confirm kafka integration is down or no events are streaming to kafka for configurable amount of time, restart home assistant which can be done with a service call.

Add key field

Currently, the UI uses a GUID that is randomly generated and changes every time the application loads. This is not usable for persisting any kind of state.

Acceptance Criteria:

  • Add a human readable key field that is procedurally generated if not provided by the user.

React UI improvements

Currently there is a single react component which handles a nested data structure.
It would be nice to have smaller react components.

Null DateTime? State properties

When a state is converted to any HaEntityState<DateTime?, T>, the State is converting correctly.

Workaround:
Parse the date before converting from string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.