pihome-shc / pihome

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

Node ID naming convention #157

Open MindGas opened 4 years ago

MindGas commented 4 years ago

Every home is different so that is heating system setup. I was thinking to use defined Node ID naming convention to make PIHome more flexible. Currently my setup has boiler relay and hot water temperature nodes as single node and that breaks few things on website as things are displayed by sketch name. Would this fit to future of PIHome?

Example: Node ID naming convention (x represents node number 0-9) this gives more flexibility in variety of different setup and future expansion/improvements, e.g. other type of sensors combined to single node.

So to display only temperature nodes you check if middle number is 2. For Hot Water temperature node you check if middle number is 3. For boiler if first number 2 and so on. SELECT * FROM nodes WHERE node_id LIKE '_2_'

pihome-shc commented 4 years ago

@MindaugasMeskauskas agree every house is different so the heating setup. your suggestion about node id have problems, first mysensors only offer 0 to 256 node id. second middle number will give you only 9 nodes for each type, sketch name only matters while creating zone first time. but i suggest alternate, if unknown node is discovered which does not follow PiHome sketch name then it get presented as unknown and user gets the chance to assign name to this node and rest stay the same.

MindGas commented 4 years ago

you right this is bad idea, but how we solve issue when node could have multiple functions e.g. Zone controller + water temp or boiler controller + water temp? Currently this code uses node name to fetch info from db

add another name in where (my current solution) e.g.: WHERE name = 'Boiler Relay & Temp Sensor' WHERE name = 'Zone Controller & Temp Sensor'

pihome-shc commented 4 years ago

i think that would be good to amend exiting query to accommodate node with multi functions. on same note its time to define zone and boiler controller names

Boiler Controller

where name = 'Boiler Relay' OR name = 'Boiler Controller' OR name = 'GPIO Controller' OR name = 'I2C Controlle OR name = 'Zone Controller & Temp Sensor'

Zone Controller where name = 'Zone Controller Relay' OR name = 'Zone Controller' OR name = 'GPIO Controller' OR name = 'I2C Controller' OR name = 'Zone Controller & Temp Sensor'

twa127 commented 4 years ago

Just a thought and going back to the original idea - why not use 3 or 4 HEX digits to identify the node, the first digits would identify the controller mix by setting bits eg

then combinations would be -

If that does not give us enough options we could use 2 HEX digits for 16 controller types, and even expand by using more digits

So to display only temperature nodes you check if bit 0 set For Hot Water temperature node you check if bit 1 set For boiler you check if bit 3 set and so on.

The last 2 HEX digits would be the node number 0 - 255

Conversion to real world names would be a config file or table

pihome-shc commented 4 years ago

@twa127, I have read your reply but didn’t understand, My brain isn’t functioning properly these days, i think i nees some holidays, i will go through your reply over weekend and think it through

twa127 commented 4 years ago

😁 you and me both

Sent from my iPhone

On 3 Mar 2020, at 12:02, PiHomeHVAC notifications@github.com wrote:

 @twa127, I have read your reply but didn’t understand, My brain isn’t functioning properly these days, i think i nees some holidays, i will go through your reply over weekend and think it through

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

aszumski commented 4 years ago

Would it be better to use like for filtering rather than equal to for example: where name LIKE '%Boiler Relay%'

This would cover all mix use nodes like "Boiler Relay & Temp Sensor" if your naming is OK

pihome-shc commented 4 years ago

@aszumski % supported by all versions of MySQL/MariaDB? until node id sequence is decided this could be a alternant solution.

aszumski commented 4 years ago

@pihome-shc Honestly not sure if it's supported in all versions but I would expect it is, LIKE filtering is used very often and basic implementation is same for all SQL databases, escape characters might be different for different SQL databases. I think it should work OK.

dvdcut commented 4 years ago

i agree with @aszumski with using %Zone% and %Boiler% options.