Closed pihome-shc closed 4 years ago
Sounds okay to me, you would need to populate the user table via code otherwise you could not get in to the application at all
in my experience with update_db.php is strange i thought its something to do with my setup even though i m using img file from pihome website. but it keep asking me to update default values.
I'd also not display the the Boiler icon on the home screen until there was an entry in the boiler table
dvdcut - had a similar problem in the past was due to using an older version of MySQL/MariaDB, so this change would fix that problem.
I'll post an update for the boiler model to enable creation of the initial boiler record
Getting quite close to a solution for this, a couple of points:
These could be populate using a couple of INSERT queries in setup_db.php The initial setup of the system could then be performed from the WEB interface -
@twa127 yes you are right, basic database we have at the moment with some basic entries would be the default ones, i.e user and system related information and i think no need to insert them during setup_db.php.
or you are thinking to making web based installer without any information in database file? but in either case lots of code needs to be changed to remove default values, for example right now nodes related info fully populated from gateway script. and same for holiday schedule left null.
I think the latest commit will allow us to use a completely empty database file, with version and build numbers in the config.ini file, setupdb.php will be used to populate user and system tables.
Please give the attached a try
@twa127 looks good, i think having blank database will help updating database easy and clean, also future pull request can only update db_config.ini with build number and this will limit messing up database file.
Still need to add create default away and holidays tables to zones.php when the first zone is created, I'll add that to the next commit
Do you want me to commit this update
@twa127, did you already commit this update?
No, I’ll do it in the morning if your happy with it
Sent from my iPhone
On 16 Mar 2020, at 21:32, PiHomeHVAC notifications@github.com wrote:
@twa127, did you already commit this update?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Second Part of this updated was to eliminate any default values from database, for instance boiler table have some default values,
CREATE TABLE boiler
(
id
INT(11) NOT NULL AUTO_INCREMENT,
sync
TINYINT(4) NOT NULL DEFAULT '0',
purge
TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Mark For Deletion',
status
TINYINT(4) NULL DEFAULT '0',
fired_status
TINYINT(4) NULL DEFAULT '0',
name
CHAR(50) NULL DEFAULT 'Gas Boiler' COLLATE 'utf16_bin',
node_id
INT(11) NULL DEFAULT NULL,
node_child_id
INT(11) NULL DEFAULT '1',
hysteresis_time
TINYINT(4) NULL DEFAULT '3',
max_operation_time
TINYINT(4) NULL DEFAULT '60',
datetime
TIMESTAMP NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (id
) USING BTREE,
INDEX FK_boiler_zone
(node_id
) USING BTREE,
CONSTRAINT FK_boiler_zone
FOREIGN KEY (node_id
) REFERENCES pihome
.nodes
(id
) ON UPDATE RESTRICT ON DELETE RESTRICT
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2
;
removing these values will help me to further work on #24 PiConnect Improvements and #57 Process to update PiHome and Database.
okay I will work on that before I commit the empty database, I think the date related defaults will be the biggest problem as some of the UPDATE queries rely on the default.
Do you want to remove all the default values from every table
Sent from my iPhone
On 16 Mar 2020, at 23:18, PiHomeHVAC notifications@github.com wrote:
Second Part of this updated was to eliminate any default values from database, for instance boiler table have some default values,
CREATE TABLE boiler ( id INT(11) NOT NULL AUTO_INCREMENT, sync TINYINT(4) NOT NULL DEFAULT '0', purge TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Mark For Deletion', status TINYINT(4) NULL DEFAULT '0', fired_status TINYINT(4) NULL DEFAULT '0', name CHAR(50) NULL DEFAULT 'Gas Boiler' COLLATE 'utf16_bin', node_id INT(11) NULL DEFAULT NULL, node_child_id INT(11) NULL DEFAULT '1', hysteresis_time TINYINT(4) NULL DEFAULT '3', max_operation_time TINYINT(4) NULL DEFAULT '60', datetime TIMESTAMP NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (id) USING BTREE, INDEX FK_boiler_zone (node_id) USING BTREE, CONSTRAINT FK_boiler_zone FOREIGN KEY (node_id) REFERENCES pihome.nodes (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ;
removing these values will help me to further work on #24 PiConnect Improvements and #57 Process to update PiHome and Database.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Yes where possible. I can work with you if you wand to devide work with me.
On 17 Mar 2020, at 19:36, twa127 notifications@github.com wrote:
Do you want to remove all the default values from every table
Sent from my iPhone
On 16 Mar 2020, at 23:18, PiHomeHVAC notifications@github.com wrote:
Second Part of this updated was to eliminate any default values from database, for instance boiler table have some default values,
CREATE TABLE boiler ( id INT(11) NOT NULL AUTO_INCREMENT, sync TINYINT(4) NOT NULL DEFAULT '0', purge TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Mark For Deletion', status TINYINT(4) NULL DEFAULT '0', fired_status TINYINT(4) NULL DEFAULT '0', name CHAR(50) NULL DEFAULT 'Gas Boiler' COLLATE 'utf16_bin', node_id INT(11) NULL DEFAULT NULL, node_child_id INT(11) NULL DEFAULT '1', hysteresis_time TINYINT(4) NULL DEFAULT '3', max_operation_time TINYINT(4) NULL DEFAULT '60', datetime TIMESTAMP NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (id) USING BTREE, INDEX FK_boiler_zone (node_id) USING BTREE, CONSTRAINT FK_boiler_zone FOREIGN KEY (node_id) REFERENCES pihome.nodes (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ;
removing these values will help me to further work on #24 PiConnect Improvements and #57 Process to update PiHome and Database.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I’ll plod on for now, away, boiler, holidays and gateway are done
Sent from my iPhone
On 17 Mar 2020, at 19:38, PiHomeHVAC notifications@github.com wrote:
Yes where possible. I can work with you if you wand to devide work with me.
On 17 Mar 2020, at 19:36, twa127 notifications@github.com wrote:
Do you want to remove all the default values from every table
Sent from my iPhone
On 16 Mar 2020, at 23:18, PiHomeHVAC notifications@github.com wrote:
Second Part of this updated was to eliminate any default values from database, for instance boiler table have some default values,
CREATE TABLE boiler ( id INT(11) NOT NULL AUTO_INCREMENT, sync TINYINT(4) NOT NULL DEFAULT '0', purge TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Mark For Deletion', status TINYINT(4) NULL DEFAULT '0', fired_status TINYINT(4) NULL DEFAULT '0', name CHAR(50) NULL DEFAULT 'Gas Boiler' COLLATE 'utf16_bin', node_id INT(11) NULL DEFAULT NULL, node_child_id INT(11) NULL DEFAULT '1', hysteresis_time TINYINT(4) NULL DEFAULT '3', max_operation_time TINYINT(4) NULL DEFAULT '60', datetime TIMESTAMP NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (id) USING BTREE, INDEX FK_boiler_zone (node_id) USING BTREE, CONSTRAINT FK_boiler_zone FOREIGN KEY (node_id) REFERENCES pihome.nodes (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ;
removing these values will help me to further work on #24 PiConnect Improvements and #57 Process to update PiHome and Database.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Also boost, email and frost_protection are done, working on the message queues
Sent from my iPhone
On 17 Mar 2020, at 19:38, PiHomeHVAC notifications@github.com wrote:
Yes where possible. I can work with you if you wand to devide work with me.
On 17 Mar 2020, at 19:36, twa127 notifications@github.com wrote:
Do you want to remove all the default values from every table
Sent from my iPhone
On 16 Mar 2020, at 23:18, PiHomeHVAC notifications@github.com wrote:
Second Part of this updated was to eliminate any default values from database, for instance boiler table have some default values,
CREATE TABLE boiler ( id INT(11) NOT NULL AUTO_INCREMENT, sync TINYINT(4) NOT NULL DEFAULT '0', purge TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Mark For Deletion', status TINYINT(4) NULL DEFAULT '0', fired_status TINYINT(4) NULL DEFAULT '0', name CHAR(50) NULL DEFAULT 'Gas Boiler' COLLATE 'utf16_bin', node_id INT(11) NULL DEFAULT NULL, node_child_id INT(11) NULL DEFAULT '1', hysteresis_time TINYINT(4) NULL DEFAULT '3', max_operation_time TINYINT(4) NULL DEFAULT '60', datetime TIMESTAMP NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (id) USING BTREE, INDEX FK_boiler_zone (node_id) USING BTREE, CONSTRAINT FK_boiler_zone FOREIGN KEY (node_id) REFERENCES pihome.nodes (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=2 ;
removing these values will help me to further work on #24 PiConnect Improvements and #57 Process to update PiHome and Database.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Thank you.
I think that I've now changed all the INSERT INTO queries. I've setup my test system successfully from an empty database which has no default clauses.
Please give the attached a try
@twa127 Great work, couple of things
Boiler: Enable Boiler checkbox is disabled but after i add boiler records it set that to enable Schedule: schedulelist.php have two extra
Hi
Can you please explain what you mean:
Schedule: schedulelist.php have two extra at line 139 and 140
Sent from my iPhone
On 20 Mar 2020, at 00:27, PiHomeHVAC notifications@github.com wrote:
Schedule: schedulelist.php have two extra at line 139 and 140
@twa127
Schedule: schedulelist.php have two extra div at line 139 and 140
Holidays holidaylist.php have extra div on line 156
I see and agree that they are both wrong, but they have not been changed in this latest batch of updates, so the errors are historical.
I use grep -o '<div' schedulelist.php | wc -l to count the number of opening div and then grep -o '</div' schedulelist.php | wc -l to count the number of closing div, the numbers should obviously match.
I will investigate and fix both files if you want?
@twa127 that is great way of calculating. with those extra div panel footer isnt in its correct place. can you push these changes please.
okay will do
when adding schedule it leaves holidays_id column as null, may be add 0 instead of null value -
will be NULL to indicate that it is a normal schedule or the holidays table ID if it is a holidays schedule and will never be 0
Boost: (sb-admin-2.css) .chat li.left .chat-body padding-top: 10px; 987 canceling out 233
You committed this change on 14 Dec 2019, I'm not sure which one is correct
@twa127, i m working on PiConnect script and null values are problematic thats why it has to be 0 if schedule isnt belongs to holiday.
okay, I'll give the problem some thought :-)
Okay, now changed
Sent from my iPhone
On 20 Mar 2020, at 17:18, PiHomeHVAC notifications@github.com wrote:
@twa127, i m working on PiConnect script and null values are problematic thats why it has to be 0 if schedule isnt belongs to holiday.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@twa127 my gateway is keep failing with error in log file
### 2020-03-26 14:38:50,570 - ERROR ###
Traceback (most recent call last):
File "/var/www/cron/gateway.py", line 245, in <module>
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
NameError: name 'datetime' is not defined
### 2020-03-26 14:42:37,333 - ERROR ###
Traceback (most recent call last):
File "/var/www/cron/gateway.py", line 258, in <module>
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
NameError: name 'datetime' is not defined
### 2020-03-26 14:43:18,794 - ERROR ###
Traceback (most recent call last):
File "/var/www/cron/gateway.py", line 258, in <module>
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
NameError: name 'datetime' is not defined
### 2020-03-26 14:44:31,136 - ERROR ###
Traceback (most recent call last):
File "/var/www/cron/gateway.py", line 258, in <module>
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
NameError: name 'datetime' is not defined
@twa127 sorry if i missed anything but i still see database have all the values, i.e its not blank.
Not committed the empty one yet as I was not sure you were happy with it, just let me know and I’ll do it
Sent from my iPhone
On 29 Mar 2020, at 22:03, PiHomeHVAC notifications@github.com wrote:
@twa127 sorry if i missed anything but i still see database have all the values, i.e its not blank.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@twa127 let me test this one last time and after this you can do pull request, i'll be using reference to this attachment. https://github.com/pihome-shc/pihome/issues/166#issuecomment-601154249
Okay
Sent from my iPhone
On 30 Mar 2020, at 13:19, PiHomeHVAC notifications@github.com wrote:
@twa127 let me test this one last time and after this you can do pull request, i'll be using reference to this attachment.
166 (comment)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@twa127 Setting->Gateway Language missing, some extra fields are showing but when gateway type is select then right fields are displayed. toggle isn't working as it suppose to work. everything works as it should.
you can do pull request for database.
Hi
Is this problem fixed now?
@twa127 yes, language issue is fixed i think you can do pull request for database. i'll change documentation to include extra steps.
Okay will do
Sent from my iPhone
On 31 Mar 2020, at 12:31, PiHomeHVAC notifications@github.com wrote:
@twa127 yes, language issue is fixed i think you can do pull request for database. i'll change documentation to include extra steps.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
can i suggest here something: can we keep some defaults data in database, like boiler and two zone, one heating second hotwater.
@dvdcut is there any reason you want to have two zone and boiler record in database?
when i was installing my dev system from github i had some issues, may be adding boiler and one zone will make few things out of the box work and make it more plug and play type
@twa127 did great job on clean-up work on database, i know it is confusing as documentation is missing for fresh install, specially if some one is trying to install from scratch.
adding boiler record wouldn't hurt but it has to added from setup.php and setup_db.php files.
Remove all default values from database and add those values in code so system do not rely on default values where information isnt added via code. fixing this issue will help #57 Process to update PiHome and Database and streamline the code for updates and it will remove MySQL/MariaDB version dependency.