pihome-shc / pihome

PiHome - Smart Heating, Ventilation and Air Conditioning (HVAC)
http://www.pihome.eu
Other
52 stars 25 forks source link

Zone with more than 1 controller #368

Open twa127 opened 3 years ago

twa127 commented 3 years ago

Hi,

What do you think about the option to link more than 1 controller to a single zone. Thinking about switching on a number of lamps all using the same schedule, for example lounge lamps to switch on/off 3 individual lamps with the same voice command or schedule?

twa127 commented 3 years ago

When I initially did the migration of the database to separate out the zone_sensors table, the field max_operating_time was moved from the zone table to the new zone_sensors table, I've since moved it back to the zone table as it made more sense to leave it there. I updated migrate_db.php, but unless you restored to the pre-updated database and re-ran migrate_db,php you would have max_operation_time still in the zone_sensors table and this would cause the failure of the view update in migrate_controller.php. The failure of the data migration was caused by a typo in migrate_controller.php, the new version fixes both problems and should work with max_operating_time in either the zone table or the zone_sensors table and the result will be that zone, zone_sensors and zone_controllers tables are updated to the latest configuration.

twa127 commented 3 years ago

I've now updated my live system, so I'll let you know how it goes

twa127 commented 3 years ago

Setup a Lamp zone with 1 MySensor and 2 Tasmota controllers attached, all seams okay at the moment I can schedule, start from the GUI or voice command them as group. I'll keep you updated

zone4

pihome-shc commented 3 years ago

@twa127 That looks very good. How about backend?

twa127 commented 3 years ago

I now have a working boiler.php, will convert it back from BB to RPi and post a copy

twa127 commented 3 years ago

okay RPi boiler.php attached, if you execute with a parameter (anything will do) it runs with debug messages eg php boiler.php debug

boiler.zip

pihome-shc commented 3 years ago

i think i have problem with migrate_controller.php it says all ok but zone controller table is empty,

pihome-shc commented 3 years ago

spoke to soon, i just replicated my live database to dev and did update. and then migrate controller and all worked and boiler.php is working as well.

twa127 commented 3 years ago

please let me know if you find any problems

scottagecheeseandcrackers commented 3 years ago

@twa127 / @pihome-shc - I understand the great work you have set out above was primarily aimed at simultaneous control of multiple sonoff lights. Is there a way that this process could also be used for heating zones? Ie. if you have multiple zones simply measuring temperature in different rooms but these are all grouped under one zone valve (eg. ground floor) - that any one of the individual rooms could be a controller for the group?

twa127 commented 3 years ago

thinking out loud -

  1. Yes could work
  2. Would need to identify the active controller some how, perhaps in the nodes table, but that might be difficult for GPIO controllers, or f we used the zone_controllers table, we would need to identify the active controller in the add/edit zone screen
  3. Would need some sort of simple way to swap the active controller without having to edit the zone
twa127 commented 3 years ago

Perhaps we should not have all these dummy zones which are really only used to display room temperatures. We could display the dummy zones as controllers perhaps to the right of the boiler tile and be able to swap the active zone controller for the 'real' zones (which we can do anyway from the zones GUI).

pihome-shc commented 3 years ago

@twa127 are you finished with testing multi controller?

twa127 commented 3 years ago

I've been using on my live system for a couple of weeks and all appears okay. Not yet done anything with the dummy zones, apart from thinking that it sounds like a good idea :-)

tested the data migration with @scottagecheeseandcrackers last database post and all worked okay. It might be a good idea if I commit without the database changes initially, this way the database will not get changed before running the data migration and avoid screwing up the existing database. What do you think ?

pihome-shc commented 3 years ago

yes, leaving database for next round is good idea, do you need me to test anything or you can do pull request for this.

twa127 commented 3 years ago

I've been running this version live for over a week so think it is good to go, I'll commit the the update later today

pihome-shc commented 3 years ago

@twa127 anything else left to work on this issue?

pihome-shc commented 3 years ago

have small issue, i created zone and then deleted it, it got purge 1 but zone is still there, i think cron/piconnect.php need some modifications to delete zone.

twa127 commented 3 years ago

I'll investigate

pihome-shc commented 3 years ago

received email from one PiHome user.

Hi In general, after the reinstalling all works, however there are some issues 1) In zone setup, there are 2 records of every zone sensor; it was only one at the beginning but when I corrected the names of every zone because of incorrect LV characters, double record has been created image

Probably related issue – there are double zone names also in charts

image

2) When I press on ‘hot water’ button, nothing opens; despite when hit on other buttons, the schedule opens image

3) When I’m trying to adjust the hot water temperature of existing schedule, before touching the temperature slidebar, it shows 50 degrees and slidebar is on maximum right position, but when I’m trying to increase/decrease the temperature, the maximum value that can be set is 30 degrees image

image

Do you have any idea about how to prevent those behaviors?

Thank you!

twa127 commented 3 years ago

I'm guessing that something has gone wrong with the migration process, can you post a copy of the database please

pihome-shc commented 3 years ago

Migration worked ok but this issue is after editing zone

twa127 commented 3 years ago

Okay so all looked okay after migration, then a zone was edited and we ended up with errors.

How was the zone edited, ie what was changed ?

pihome-shc commented 3 years ago

user only changed the name of zone.
1) In zone setup, there are 2 records of every zone sensor; it was only one at the beginning but when I corrected the names of every zone because of incorrect LV characters, double record has been created

twa127 commented 3 years ago

okay, I'll have to backout my latest developments to investigate

twa127 commented 3 years ago

Managed to reproduce the error, I'll investigate

twa127 commented 3 years ago

Committed a fix, please let me know if this resolves the issue

uldjan commented 3 years ago

I have upgraded the PiHome by using commands cd /var/www/ git pull origin However all 3 of the reported issues still persists. Here is a backup: pihome_mysql_2020-09-22_22-12-25.zip

twa127 commented 3 years ago

Can you please post a copy of your database from before the update

twa127 commented 3 years ago

The zone_sensors table is causing some of your problems sensor15

As you can see there are duplicate entries for zone_id 33,34 and 35, please try deleting id 33, 34 and 35 or 38, 39 and 40 depending which ones have the correct value for sp_deadband

uldjan commented 3 years ago

Hi @twa127 I have deleted the id's 38, 39 and 40. Issues 1 and 2 then resolved. Thank you very much for your advice! However, the issue 3 still persists.

twa127 commented 3 years ago

Hi,

The problem is in table zone_type, where id=3 type value should be Water and not Hot Water sensor16

uldjan commented 3 years ago

Hi @twa127, Zone type change resolved the issue. Thank you very much!

uldjan commented 3 years ago

@twa127 I'm not sure if this is the right place for this issue... when I look on the temperature graphs of last 24 hours, the time zone on x axis is not the same with time for the drawn chart. Can you suggest where to set the time zone for the x axis? Thanks! Ekrānuzņēmums 2020-09-24 224453

pihome-shc commented 3 years ago

@uldjan Shaun Jepson commented on following post while back, can you try this, file name is changed to chart_load.php

http://www.pihome.eu/2020/05/24/pihome-version-1-75/

Comment: Hello Kevin,

I note that the time axis of all the charts shows up in UTC time. This is not a big issue for you based near Dublin as for six months of the year you are on UTC and the other 6 months just one hour difference. Here in France we are two hours different and it is noticeable.

I have made the following changes to correct this and show the time axis in local time.

update chartfooter.php line 109 from xaxis: { mode: "time", timeformat: "%H:%M"}, to xaxis: { mode: "time", timezone: "browser", timeformat: "%H:%M"},

update chartfooter.php line 218 from xaxis: { mode: "time", timeformat: "%H:%M"}, to xaxis: { mode: "time", timezone: "browser", timeformat: "%H:%M"},

update chartfooter.php line 184 from xaxis: { mode: "time", timeformat: "%H:%M"}, to
xaxis: { mode: "time", timezone: "browser", timeformat: "%H:%M"},

Hope this helps with some of the other users in Latvia and Romania who have an even bigger time difference.

Thank You Shaun Jepson

twa127 commented 3 years ago

Hi,

The line numbers to change in chart_load.php are 135, 148 and 159

uldjan commented 3 years ago

Hi @pihome-shc , @twa127 The issue with time zone of x-axis resolved! Thank you very much!

uldjan commented 3 years ago

Hi @pihome-shc On current lv.php was missing 52 records compared to en.php. I have added and translated them. Please include it in new installations, otherwise selecting the Latvian language will lose the dashboard and get the notice "This page isn’t working".

lv.zip

pihome-shc commented 3 years ago

@uldjan thank you,

pihome-shc commented 3 years ago

@twa127 your recent change added extra } i m getting error on migrate controller

root@pihome:/var/www/MySQL_Database# php migrate_controller.php
PHP Parse error:  syntax error, unexpected '}', expecting end of file in /var/www/MySQL_Database/migrate_controller.php on line 182
root@pihome:/var/www/MySQL_Database# php migrate_controller.php