Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

Commit

Permalink
bugfix(hvac): Fix syntax and add migrations
Browse files Browse the repository at this point in the history
Refs: #16
  • Loading branch information
jokajak committed Aug 30, 2020
1 parent 0413aaa commit 015db29
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
- id: black
exclude: >
(?x)^(
hvac/migrations/.*
.+/migrations/.*
)
- repo: https://gitlab.com/pycqa/flake8
Expand Down
42 changes: 42 additions & 0 deletions hvac/migrations/0002_auto_20200830_1421.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 3.1 on 2020-08-30 19:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('hvac', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Zone',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('zone_id', models.PositiveIntegerField()),
('name', models.CharField(max_length=250)),
('enabled', models.BooleanField()),
('current_activity', models.IntegerField(choices=[(1, 'Home'), (2, 'Sleep'), (3, 'Away'), (4, 'Awake'), (5, 'Manual')])),
('current_temp', models.DecimalField(decimal_places=2, default=0.0, max_digits=5)),
('current_humidity', models.PositiveIntegerField()),
('fan', models.IntegerField(choices=[(1, 'Low')])),
('heat_set_point', models.DecimalField(decimal_places=2, default=0.0, max_digits=5)),
('cool_set_point', models.DecimalField(decimal_places=2, default=0.0, max_digits=5)),
('hold', models.CharField(max_length=100)),
('otmr', models.CharField(max_length=100)),
('zone_conditioning', models.IntegerField(choices=[(1, 'Low')])),
('damper_position', models.PositiveIntegerField()),
],
),
migrations.AddField(
model_name='hvac',
name='cool_set_point',
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=5),
),
migrations.AddField(
model_name='hvac',
name='heat_set_point',
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=5),
),
]
24 changes: 12 additions & 12 deletions hvac/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class HVAC(models.Model):
"""HVAC Model."""

serial = models.CharField(max_length=100)
heat_set_point = models.DecimalField(max_digits=5, decimal_places=2)
cool_set_point = models.DecimalField(max_digits=5, decimal_places=2)
heat_set_point = models.DecimalField(max_digits=5, decimal_places=2, default=0.0)
cool_set_point = models.DecimalField(max_digits=5, decimal_places=2, default=0.0)
# activity = models.IntegerChoices(choices=HVACActivities.choices)
# activity = models.Choices(

Expand Down Expand Up @@ -63,16 +63,16 @@ class Zone(models.Model):
</zone>
"""

id = models.PositiveIntegerField()
name = models.CharField()
zone_id = models.PositiveIntegerField()
name = models.CharField(max_length=250)
enabled = models.BooleanField()
current_activity = models.IntegerChoices(choices=ActivityChoices)
current_temp = models.DecimalField(max_digits=5, decimal_places=2)
current_activity = models.IntegerField(choices=ActivityChoices.choices)
current_temp = models.DecimalField(max_digits=5, decimal_places=2, default=0.0)
current_humidity = models.PositiveIntegerField()
fan = models.IntegerChoices(choice=FanChoices)
heat_set_point = models.DecimalField(max_digits=5, decimal_places=2)
cool_set_point = models.DecimalField(max_digits=5, decimal_places=2)
hold = models.CharField()
otmr = models.CharField()
zone_conditioning = models.IntegerChoices(choices=ZoneConditioningChoices)
fan = models.IntegerField(choices=FanChoices.choices)
heat_set_point = models.DecimalField(max_digits=5, decimal_places=2, default=0.0)
cool_set_point = models.DecimalField(max_digits=5, decimal_places=2, default=0.0)
hold = models.CharField(max_length=100)
otmr = models.CharField(max_length=100)
zone_conditioning = models.IntegerField(choices=ZoneConditioningChoices.choices)
damper_position = models.PositiveIntegerField()
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.1 on 2020-08-30 19:21

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('sites', '0003_set_site_domain_and_name'),
]

operations = [
migrations.AlterModelOptions(
name='site',
options={'ordering': ['domain'], 'verbose_name': 'site', 'verbose_name_plural': 'sites'},
),
]
18 changes: 18 additions & 0 deletions infinity_tracker/users/migrations/0002_auto_20200830_1421.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1 on 2020-08-30 19:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='user',
name='first_name',
field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
),
]

0 comments on commit 015db29

Please sign in to comment.