Add ConnectorManager component which allows for Connectors to listen to triggers and do actions on them. Also add HomeAssistantConfig which stores the configuration for the HomeAssistantConnector

This commit is contained in:
Mikhail Epifanov
2024-01-11 22:05:34 +01:00
parent d493ba72a1
commit e5f0c19cdc
18 changed files with 566 additions and 70 deletions

View File

@@ -0,0 +1,30 @@
# Generated by Django 4.2.7 on 2024-01-10 21:28
import cookbook.models
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0205_alter_food_fdc_id_alter_propertytype_fdc_id'),
]
operations = [
migrations.CreateModel(
name='HomeAssistantConfig',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)])),
('url', models.URLField(blank=True, help_text='Something like http://homeassistant:8123/api')),
('token', models.CharField(blank=True, max_length=512)),
('todo_entity', models.CharField(default='todo.shopping_list', max_length=128)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
],
bases=(models.Model, cookbook.models.PermissionModelMixin),
),
]

View File

@@ -0,0 +1,33 @@
# Generated by Django 4.2.7 on 2024-01-11 19:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0206_alter_storage_path_homeassistantconfig'),
]
operations = [
migrations.AddField(
model_name='homeassistantconfig',
name='on_shopping_list_entry_created_enabled',
field=models.BooleanField(default=False, help_text='Enable syncing ShoppingListEntry to Homeassistant Todo List'),
),
migrations.AddField(
model_name='homeassistantconfig',
name='on_shopping_list_entry_deleted_enabled',
field=models.BooleanField(default=False, help_text='Enable syncing ShoppingListEntry deletion to Homeassistant Todo List'),
),
migrations.AddField(
model_name='homeassistantconfig',
name='on_shopping_list_entry_updated_enabled',
field=models.BooleanField(default=False, help_text='PLACEHOLDER'),
),
migrations.AlterField(
model_name='homeassistantconfig',
name='url',
field=models.URLField(blank=True),
),
]