pihome-shc / pihome

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

Add-On #247

Closed dvdcut closed 3 years ago

dvdcut commented 4 years ago

Discuss how we can implement Add-on in pihome, How these Add-on can co-exist with other heating zone in pihome, we have schedule system that we can leverage in our favor i.e we can split schedules for add-ons and for heating with very minimum effort in exiting code. also if you can share your list of add-on you want to implement here. Kitchen Exhaust Fan with speed control Garden Light Night Lights inside house

Previous implementation of Electrical Immersion Control #221 is here and i think more add-on are easy to implement. but what you all think?

pihome-shc commented 4 years ago

I don’t know how you can control speed of kitchen exhaust fan, maybe you have one that come with variable speed.I would be happy if i had control over on/off, I prefer to turn it on just before the morning heating start. My garden light have sensor so they are not on all the time :)

On 6 Jun 2020, at 12:18, dvdcut notifications@github.com wrote:

Discuss how we can implement Add-on in pihome, How these Add-on can co-exist with other heating zone in pihome, we have schedule system that we can leverage in our favor i.e we can split schedules for add-ons and for heating with very minimum effort in exiting code. also if you can share your list of add-on you want to implement here. Kitchen Exhaust Fan with speed control Garden Light Night Lights inside house

Previous implementation of Electrical Immersion Control #221 is here and i think more add-on are easy to implement. but what you all think?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

twa127 commented 4 years ago

Hi,

Been playing with the lamp switch, it is simply a mains powered relay, so could just as easily be used to control an extractor fan.

lamp4

The switch has been added as a zone without any sensors and no boiler, it can be toggled from the home screen and scheduled in the usual way. I'm processing the schedule within boiler.php so that Away and Holidays are processed as normal. I still need to tidy-up zone.php to suppress input fields based on the zone type.

I'm thinking that perhaps we could have 2 types of add-on, the first with no temperature sensor eg lamp switch or extractor fan and then a second type with a temperature sensor eg Immersion Heater

twa127 commented 4 years ago

Example boiler.php output

lamp5

dvdcut commented 4 years ago

@twa127 very impressive work, not only zone.php need some modification but schedule related code as well so we dont get temperature bar but only on/off did you modify your zone table structure as well?

twa127 commented 4 years ago

No I left the zone table as it was and processed the records in boiler.php based on the zone type, true about the schedule.php

twa127 commented 4 years ago

Anybody got any thoughts on zone types, so far we have Heating, Water, Immersion and Lamp. Do we want to keep adding to the list or come up with some grouping for the add-ons eg 'Add-On' (lamp, fan, Immersion, Switch) and 'Add-On with Sensor' (electric heater, Immersion with temp cut off) ?

dvdcut commented 4 years ago

are we going to give icon based on type?

twa127 commented 4 years ago

if we did then type could not be a group, ie it would have to be Lamp, Immersion etc. If type is a group then icon could be based on the zone name

twa127 commented 4 years ago

Perhaps best to carry on using type as we already have Immersion, I could add Lamp, Fan and Switch as a start

pihome-shc commented 4 years ago

@twa127 User can have name based on room name or so on, i suggest have type as icon representation, how many icons homekit have? or any other home automation? light, fan, blinds, switch etc or may be we can have icon column in zone ? https://www.reddit.com/r/HomeKit/comments/7k1oxg/does_anyone_have_a_screenshot_of_switch_icon_on/ https://www.reddit.com/r/HomeKit/comments/9l4m6t/complete_list_of_home_app_icons/

pihome-shc commented 4 years ago

@twa127 yes, agree, i think we better carry on using type and if needed this can be amended,

dvdcut commented 4 years ago

i think its best to carry on using type. did you made that pcb yourself?

twa127 commented 4 years ago

No the pcb is not my work https://www.openhardware.io/view/77/AC-DC-double-solid-state-relay-module

I'll give the icons some thought :-)

Immersion Heater is a bit of a different type of add-on as it is very like the other zones and I would have thought the tile should look the same as the others and display the temperature as normal. In my current implantation of homelist.php, the binary add-ons can have an icon based on zone type and their colour set to indicate status

twa127 commented 4 years ago

I've added a new table 'zone_type' which contains zone types, added a new option in the Node and Zone Configuration menu, to add or delete zone types. In zone.php the Zone Type drop down list is now populated from the new table. This way new add-on zone types can be added without having to keep changing zone.php

pihome-shc commented 4 years ago

@twa127 i think we need to add some default types in setup.php and setup_db.php so far Heating, Water, Immersion as users wouldn't know what to type here.

pihome-shc commented 4 years ago

i take my comments back, i didn't read the title of your pull request, :(

pihome-shc commented 4 years ago

@twa127 if i remove Heating, Water, Immersion from zone_type i dont get option for them while creating creating zone. i think my ^^ comment is valid and requires default types added or alternately zone.php need modification

twa127 commented 4 years ago

Hi,

The idea was that you create the zone type before you add the zone. I was trying to get to a situation where add-ons can be created without the need to change the code each time. I agree that perhaps defaults should be created for Heating and Water, not sure about Immersion as this is an optional add-on.

I'm thinking about the idea of grouping zone types again so that the logic of boiler.php is not dependent on the wording of the zone type and again add-ons can be created without the need to modify the code of boiler.php, zone.php and scheduling.php. These Categories could be selected from a drop down list in the add zone type GUI, then the logic of boiler.php would be dependent on the zone type category, eg -

Category 0 - base type which uses a temp sensor and controls the boiler (eg Heating and Water) Category 1 - add-on type 1 - uses a temp sensor but does Not control the boiler (eg Immersion) Category 2 - add-on type 2 - no temp sensor and no boiler control (eg Lamp) Category 3 etc - if we need some other process flow

twa127 commented 4 years ago

I've now updated to process boiler.php based on zone type categories 0, 1 or 2, so should work for Immersion Heater and binary device (lamp, fan, switch etc)

pihome-shc commented 4 years ago

@twa127 after #253, i added heating and water and Fan but when i try to create zone for Fan it still ask for temperature sensor and all heating related inputs.

twa127 commented 4 years ago

Still working on that and the scheduling :-)

twa127 commented 4 years ago

Committed the change to suppress temperature sliders for Category 2 zone types in scheduling. Will work on zone.php tomorrow

pihome-shc commented 4 years ago

@twa127 great work, noticed one thing, if i create schedule only for lamp it shows temperature

dvdcut commented 4 years ago

may i suggest idea on schedule? what if we display schedules in two categories ? same we have used for graph and settings. Backend can be same but divide frontend for better experience.

twa127 commented 4 years ago

@pihome-shc did you update the views?

pihome-shc commented 4 years ago

I think i did this with updatedb.php but didn’t check it, let me check this

On 11 Jun 2020, at 22:03, twa127 notifications@github.com wrote:

@pihome-shc did you update the views?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

twa127 commented 4 years ago

@dvdcut might get a bit messy as now Scheduling selected from the header toolbar, also I think Immersion is very like the other schedules, only difference is no boiler trigger, The binary add-on are different, so perhaps should be separated out. Once I've got zone.php I'll deploy on my live system with a Lamp add-on and see how it all hangs together :-)

pihome-shc commented 4 years ago

@twa127, i was referring to temperature in circle in schedule list.

image

pihome-shc commented 4 years ago

@dvdcut, having icon on header for non heating isn't good option (i think). may be under schedules we can have pills to aggregate heating and binary switch schedule. but again lets wait for final results of @twa127 work.

twa127 commented 4 years ago

@pihome-shc ah I know what you mean about the temperature indication for non-sensor zones, its on my list of things to fix :-)

twa127 commented 4 years ago

How about this lamp6

pihome-shc commented 4 years ago

@twa127 that looks good,

twa127 commented 4 years ago

Yes a bug it displaying the water temp, I'll work on it

twa127 commented 4 years ago

Hi,

I'm a bit confused, in my screen shot all the schedules except Lamp include the Hot Water zone and the temp in the left hand circle is the max temp for the schedule which is the water temp. Reverted the view back to the old version and still gives the same result

pihome-shc commented 4 years ago

@twa127 update my dev version and all looks ok, it does show highest temperate, only is in that schedule it shows blank which we are expecting.

twa127 commented 4 years ago

work in progress, fields hidden depending on zone category, still working on table updates

zone.zip

pihome-shc commented 4 years ago

@twa127 after #257 i have this error missing space in after where

2020-06-13 11:26:30 - Importing SQL Table View File to Database, This could take few minuts.
MySQL Database Error with Query CREATE VIEW zone_view AS
select zone.status, zone.sync, zone.id, zone.index_id, zone.name, zone.type, ztype.category, zone.graph_it, zone.max_                                              c, zone.max_operation_time, zone.hysteresis_time,
zone.sp_deadband, sid.node_id as sensors_id, zone.sensor_child_id,
ctype.`type` AS controller_type, cid.node_id as controler_id, zone.controler_child_id,
IFNULL(lasts.last_seen, lasts_2.last_seen) as last_seen, IFNULL(msv.ms_version, msv_2.ms_version) as ms_version, IFNU                                              LL(skv.sketch_version, skv_2.sketch_version) as sketch_version
from zone
join zone_type ztype on zone.type = ztype.type
LEFT join nodes sid on zone.sensor_id = sid.id
join nodes ctype on zone.controler_id = ctype.id
join nodes cid on zone.controler_id = cid.id
LEFT join nodes lasts on zone.sensor_id = lasts.id
LEFT join nodes lasts_2 on zone.controler_id = lasts_2.id
LEFT join nodes msv on zone.sensor_id = msv.id
LEFT join nodes msv_2 on zone.controler_id = msv_2.id
LEFT join nodes skv on zone.sensor_id = skv.id
LEFT join nodes skv_2 on zone.controler_id = skv_2.idwhere zone.`purge` = '0';
:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right                                               syntax to use near 'zone.`purge` = '0'' at line 16
pihome-shc commented 4 years ago

@twa127 this looks good, i think some cleanup work needed. but actual gui does what is suppose to do, tested with lamp, immersion, heating, water and fan.

Fan/Lamp errors: Zone Record Addition Failed: Field 'sync' doesn't have a default value Field 'sync' doesn't have a default value

Heating: Zone Record Addition Failed: Field 'sync' doesn't have a default value Field 'sync' doesn't have a default value Zone Boost Record Addition Failed. Field 'sync' doesn't have a default value Zone Override Record Addition Failed. Field 'sync' doesn't have a default value Zone Night Climate Record Addition Failed. Field 'sync' doesn't have a default value

work in progress, fields hidden depending on zone category, still working on table updates

zone.zip

twa127 commented 4 years ago

fixed the sql missing carriage return :-(

twa127 commented 4 years ago

zone.php - for cat1 zones (sensor/no boiler) plan to add to tables as for cat0 but no boiler records for cat2 plan to add boost, holidays, away, no sensors, no night climate, no boiler related records. The new version of zone_view will work where the sensor_id is NULL

pihome-shc commented 4 years ago

i think my last test failed because Field 'sync' doesn't have a default value

twa127 commented 4 years ago

Question - for Immersion type would we want -

Maximum Temperature Maximum Operation Time Hysteresis Time Temperature Setpoint Deadband

pihome-shc commented 4 years ago

@twa127 yes, if possible.

On 13 Jun 2020, at 14:46, twa127 notifications@github.com wrote:

Question - for Immersion type would we want -

Maximum Temperature Maximum Operation Time Hysteresis Time Temperature Setpoint Deadband

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

twa127 commented 4 years ago

update zone.php attached, needs sp_deadband database change

zone.zip

twa127 commented 4 years ago

Now able to schedule lamp on/off dependent on away and holidays, also got it working with voice control, so can switch on or off without getting out of the chair :-)

pihome-shc commented 4 years ago

@twa127 from zone table we can drop boiler column as it has no function and not in use, is it possible to set value 0 instead of null for other column?

pihome-shc commented 4 years ago

after creating test zone for lamp i still get 0.0 temperature

twa127 commented 4 years ago

the reason for the 0.0 temperature is that I've not committed the update to homelist.php

I'll check if I can make sp_deadband 0

twa127 commented 4 years ago

I had initially thought of using BOOST to trigger these devices, but after getting the lamp operational with voice control, I found it was irritating to have to wait for up to a minute for boiler.php to cycle and switch it on. So now decided to write directly to messages_out and zone tables, this is much better BUT then worried as there is no fail-safe to turn off after some period. I'm thinking of using Maximum Operating Time field in zone settings but this means that I need to have some form of logging. I think zone_logs will be okay to use but don't think it would be a good idea to use boiler_logs, so suggest a new table add_on_logs .

Any thoughts?

pihome-shc commented 4 years ago

i agree, we better leave boost function for heating related zone. all other zone should update send message_out but at the same time we have to set active switch in zone for boiler.php to process every minut as well just in case if first communication is missed so it trigger in second attempt and same goes for off state so you dont have worry about max operation time. for logging i agree another table is required for non heating zone, all heating zones logs are boiler log dependent.