Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node ID naming convention #157

Open
MindGas opened this issue Feb 26, 2020 · 10 comments
Open

Node ID naming convention #157

MindGas opened this issue Feb 26, 2020 · 10 comments

Comments

@MindGas
Copy link
Contributor

MindGas commented Feb 26, 2020

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.

  • 12x - Room/Zone temperature node
  • 13x - Hot Water temperature node
  • 14x - Button console
  • 20x - Boiler relay
  • 23x - Boiler + Hot Water
  • 30x - Zone Controller relay

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
Copy link
Owner

@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
Copy link
Contributor Author

MindGas commented Feb 27, 2020

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

  • cron/notice.php
    WHERE name = 'Temperature Sensor'
    WHERE name = 'Boiler Relay'
  • zone.php
    where name = 'Temperature Sensor'
    where name = 'Zone Controller Relay' OR name = 'Zone Controller' OR name = 'GPIO Controller' OR name = 'I2C Controller'
  • model.php
    where name = 'Boiler Relay' OR name = 'Boiler Controller' OR name = 'GPIO Controller' OR name = 'I2C Controller'

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

@pihome-shc
Copy link
Owner

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
Copy link
Contributor

twa127 commented Mar 2, 2020

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

  • 00000001 - Room/Zone temperature node
  • 00000010 - Hot Water temperature node
  • 00000100 - Button console
  • 00001000 - Boiler relay
  • 00100000 - Zone Controller relay
  • 01000000 - Lamp controller relay
  • 10000000 - Power switch relay

then combinations would be -

  • 00010010 - Boiler + Hot Water
  • 00100001 - Zone Controller + temperature node
  • 10100001 - Power switch + Zone Controller + temperature node

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
Copy link
Owner

@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
Copy link
Contributor

twa127 commented Mar 3, 2020 via email

@aszumski
Copy link
Contributor

aszumski commented Mar 3, 2020

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
Copy link
Owner

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

@aszumski
Copy link
Contributor

aszumski commented Mar 4, 2020

@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
Copy link
Contributor

dvdcut commented Mar 4, 2020

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

pihome-shc pushed a commit that referenced this issue Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants