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

Scrub the semantic tags and add missing tags #4619

Open
rkoshak opened this issue Feb 24, 2025 · 48 comments
Open

Scrub the semantic tags and add missing tags #4619

rkoshak opened this issue Feb 24, 2025 · 48 comments
Labels
enhancement An enhancement or new feature of the Core

Comments

@rkoshak
Copy link

rkoshak commented Feb 24, 2025

The default list of semantic tags are incomplete and inconsistent. Having a way to add custom tags helps some but the default list is the end user's first exposure to the model and it should help them get up to speed on how it works and support the most common use cases with the default list.

At a minimum we should have many more properties, a few more points, and more equipment.

But there are also a bunch of tags that don't make much sense. For example, we probably only need two or three Door tags instead of seven.

I think it makes a lot of sense to come up with some sort of rules for what makes a good tag or not, remove those that don't meet those rules and add any missing ones all in one go rather than fielding a bunch of separate issues to add two tags here and three tags there without any guiding principles.

To deal with removed tags and backwards compatibility, the upgradeTool can search the tags and add any removed ones a user happens to have used as a custom tag.

Your Environment

  • Version used: (e.g., openHAB and add-on versions)
  • Environment name and version (e.g. Chrome 111, Java 17, Node.js 18.15, ...):
  • Operating System and version (desktop or mobile, Windows 11, Raspbian Bullseye, ...):
@rkoshak rkoshak added the enhancement An enhancement or new feature of the Core label Feb 24, 2025
@jimtng
Copy link
Contributor

jimtng commented Feb 25, 2025

My thinking was that we go through the current needs from all the existing bindings, and see what tags are missing/needed, then perhaps we'll have a list of tags to consider. It would then be much easier to see / organise them. I've started this from the linked PR, and that's just from two bindings so far.

Then additionally we get input from users about what other tags they need / would suggest. Add them all to the pile and work from there. Posting this request on the forum would probably get us the most feedback.

@rkoshak
Copy link
Author

rkoshak commented Feb 25, 2025

Looking at the bindings is a good approach.

I can open a forum thread, but I'm not super optimistic how useful that will be in the long run.

I think what I am hoping for is some sort of rules that we can establish and document which describes what makes a good tag compared to a bad tag. For example, is it meaningful to have "Patio", "Porch" and "Terrace" or does it make more sense to have just one of those and use synonyms and the Item label to distinguish between these outdoor areas. Or does it make sense to add "Lenai"?

Do we need "Front Door", "Back Door" and "Side Door" or does it make more sense to have "Exterior Door" and use synonyms and Item label to distinguish between the three?

That's the sort of thing I'm hoping will come out of this issue. Of course, I have my opinions but even if my wishes are not met, I'll be overjoyed if we can have some rules in place to help maintainers decide what makes a good tag and what does not.

I'm worried that if we don't come up with those rules first, a post to the forum will just gather a ton of tags with lots of overlap. Maybe seeing what's missing based on the bindings will help inform that discussion. Maybe no one else thinks this is a big deal like I do.

@jimtng
Copy link
Contributor

jimtng commented Feb 25, 2025

I'm worried that if we don't come up with those rules first, a post to the forum will just gather a ton of tags with lots of overlap.

This is a good point.

How about, in addition to looking at what the existing bindings may need, we could also look at what Google/Alexa/Homekit currently have and draw inspiration from them?

Perhaps once we're staring at a list of possible tags, a rule / guideline may emerge?

@lolodomo wrote some sort of a rule here: openhab/openhab-addons#12262
That could be a place to start, and if anyone knows other written guides / rules let's collate them here.

@rkoshak
Copy link
Author

rkoshak commented Feb 25, 2025

That's a good idea. Though we have to be a little cautious there since their models do not exactly match ours, so the mapping may not be completely straight forward. But it certainly should show us if we have some gaps.

I'll see if I can put them into a table for comparison and post that here to make the comparison easier.

I like the rules that @lolodomo posted but those are more about how the tags are used. I'm hop[ing to come up with some rules to apply when deciding whether or not to add a new tag to the default list which is coming at it from a different angle.

@andrewfg
Copy link
Contributor

andrewfg commented Feb 25, 2025

I was looking that the Hue binding. It has two types of things. These can be "devices" (e.g. push buttons, lamps, dials, motion sensors, temperature sensors, illuminance sensors, security contacts, etc.) and "groups" (whole house, rooms, and zones). I think the current point / property tags would cover "devices" (maybe with some minor additions e.g. for the dial control). But the "groups" things are a bit different -- they do associate to "locations" (e.g. Kitchen) that would not be in the remit of the developers, but at a higher level they also associate to "group meta-type" i.e. is it a group of all lights in a room (aka "room"), or a sub group of lights either within a room or across several rooms (aka "zone"). I think such "group meta-type" would be candidates to add to the list of "equipment" semantic tags.

PS in #4617 I am working to add "equipment" semantic tags to things. And I am using the Hue binding as my test case. Since while the "point" and "property" semantic tags can be hard coded in the ChannelType xml, the "equipment" semantic tags on things will have to be set at run time in the discovery process depending on which things are found "devices" or "groups" and what device type, resp. "group meta-type" is actually found.

@rkoshak
Copy link
Author

rkoshak commented Feb 25, 2025

For viewing you can see my attempt at mapping at https://docs.google.com/spreadsheets/d/1hKb-sLqHuM_FAUtHCWCjVCjjb1mhVUT5jKfUFggERm4/edit?usp=sharing

CSV versions are below. I don't know of a tool to convert it to an MD table but you should be able to copy and import into your spreadsheet of choice.

I tried to show the tag hierarchy using spacing. I ordered the tags alphabetically for OH but then I tried to make the GA, Alexa, and Homekit tags appear on the same lines as the OH equivalent, or inserted them alphabetically.

Hopefully it makes sense but if not let me know.

Locations

Note that I took the GA locations from the Home app. If Homekit or Alexa use Locations I don't know how to find them out.

openHAB,Googel Assistant,Alexa,Homekit
Location,,,
    Indoor,,,
        Apartment,,,
        Building,,,
            Garage,Garage,,
            House,,,
            Shed,Shed,,
            SummerHouse,,,
        Corridor,Hallway,,
        Floor,,,
            Attic,Attic,,
            Basement,,,
            FirstFloor,,,
            GroundFloor																									,,,
            SecondFloor,,,
            ThirdFloor,,,
        Room																									,,,
,Back door,,
            Bathroom,Bathroom,,
            Bedroom,Bedroom,,
            BoilerRoom,,,
            Cellar,,,
,Den,,
            DiningRoom,Dining Room,,
            Entry,Entryway,,
            FamilyRoom,Family Room,,
,Front Door,,
            GuestRoom,,,
            Kitchen,Kitchen,,
            LaundryRoom,,,
            LivingRoom,,,
,Master Bedroom,,
            Office,Office,,
,Side Door,,
            Veranda,,,
    Outdoor,,,
,Backyard,,
        Carport,,,
        Driveway,,,
,Front Yard,,
        Garden,,,
        Patio,,,
        Porch,,,
        Terrace																									,,,

Equipment

I did my best to map but I'm not perfect.

openHAB,Googel Assistant,Alexa,Homekit
,,,AccessoryGroup
,,AirFreshener,
,Awning,Awning,
Equipment,,Other,
    AlarmSystem,,,
    Battery,,,Battery
    Blinds,,,
    Boiler,,,
    Camera,Camera,Camera,
    Car,,Automobile,
,,AutomobileAccessory,
,,ChristmasTree,
,Charger,,
    CleaningRobot,Vacuum,VacuumCleaner,
,Coffee_Maker,CoffeeMaker,
,,Computer,
    Door,Door,Door,Door
        BackDoor,,,
        CellarDoor,,,
        FrontDoor,,,
        GarageDoor,Garage,GarageDoor,
        Gate,Gate,,
        InnerDoor,,,
        SideDoor,,,
    Doorbell,,Doorbell,
    Fan,Fan,Fan,Fan
,,,BasicFan
        CeilingFan,,,
        KitchenHood,Hood,,
,,,Faucet
,AirPurifier,AirPurifier,Filter
,,GameConsole,
,,,GarageDoorOpener
,,Headphones,
,,Hub,
,Fireplace,,
    HVAC,,,HeaterCooler
,,AirConditioner,
    Inverter,,,
,Sprinkler,,IrrigationSystem
,,Laptop,
    LawnMower,,,
    LighttBulb,Light,Light,Lighting
        LightStripe,,,
,SpecialColorLight,,
    Lock,Lock,Lock,Lock
,,,Microphone
    NetworkAppliance,,NetworkHardware,
,,Router,
,Pergola,,
    PowerOutlet,Outlet,Outlet,Outlet
,,Printer,
    Projector,,,
    Pump,,,
    RadiatorControl,Thermostat,Thermostat,Thermostat
    Receiver,,MusicSystem,
    RemoteControl,,Remote,
    Screen,,Screen,
        Television,TV,Television,Television
,,SecurityPanel,
,SecuritySystem,SecuritySystem,SecuritySystem
,,StreamingDevice,
,Scene,,
    Sensor,Sensor,,
,,AirQualityMonitor,AirQualitySensor
,ClimateSensor,,
,HumiditySensor,,
,TemperatureSensor,,
        MotionDetector,,MotionSensor,MotionSensor
,,,OccupancySensor
        SmokeDetector,,,
    Service,,,
    Siren,,,
,,SlowCooker,
    Smartphone,,MobilePhone,
,,Phone,
    Speaker,Speaker,Speaker,Speaker
,,BluetoothSpeaker,
,,,SmartSpeaker
,,,TelevisionSpeaker
,,,StatelessProgrammableSwitch
,,Tablet,
,Switch,,
    Valve,,,Valve
    VoiceAssistant,,,
    WallSwitch,,,
    WebService,,,
        WeatherService,,,
    WhiteGood,,,
        Dishwasher,,Dishwasher,
        Dryer,,Dryer,
        Freezer,,,
,,Microwave,
        Oven,,Oven,
        Refrigerator,,,
        WashingMachine,,Washer,
,,WaterHeater,
,,Wearable,
    Window,,,Window
,Blinds,Blind,WindowCovering
,Curtain,Curtain,
,,Shade,
,Shutter,Shutter,

Points and Properties

Only GA appears to have something that seems to correspond with Points and Properties.

openHAB Points,openHAB Properties
Point,Property
    Alarm,    CO
    BatteryProperty,    CO2
    Control,    ColorTemperature
        Switch,    Current
    Measurement,    Duration
    Setpoint,    Energy
    Status,    Frequency
        LowBattery,    Gas
        OpenLevel,    Humidity
        OpenState,    Level
        Tampered,    Light
        Tilt,    Noise
,    Oil
,    Opening
,    Power
,    Presence
,    Pressure
,    Rain
,    Smoke
,    SoundVolume
,    Temperature
,    Timestamp
,    Ultraviolet
,    Vibration
,    Voltage
,    Water
,    Wind
Attribute,OH Point/Property Mapping
chargerCapacityRemaining,BatteryProperty/Level
chargerCapaciotyUntilFull,BatteryProperty/Level
chargerCharging,Status
chargerPluggedIn,Status
humidityAmbient,Measurement/Humidity
lightBrightness,Control/Light
lightColor,Control/Light
lightColorTemperature,Control/Light
securitySystemArmed,Status
securitySystemArmLevel,Status
securitySystemTrouble,Status
securitySystemTroubleCode,Status
securitySystemZone,
temperatureAmbient,Measurement/Temperature
thermostatTermperatureAmbient,Measurement/Temperature
thermostatTemperatureSetpoint,Setpoint/Temperature
thermostatTemperatureSetpointHigh,Setpoint/Temperature
thermostatTemperatureSetpointLow,Setpoint/Temperature
tvApplication,
tvChannel,
tvInput,
tvMute,Control/Noise
tvPower,Switch/Power
tvTransport,
tvVolume,Control/Noise

@andrewfg
Copy link
Contributor

andrewfg commented Feb 26, 2025

Sorry to be slightly off topic. I am doing some more work on the topic of addons providing semantic tags dynamically for ThingTypes, ChannelTypes and discovery results. And it seems to me that it would be useful if addons could access the predefined tags in the form of public static final string constants in OH core. (Rather than having the addon developer define such strings in the addon code; since that could be a source of errors). => Does anyone have any idea if this is possible?

To give an example, below is my hypothetical discovery code for the Hue thing discovery to define semantic equipment tags dynamically based on the discovered equipment. See the big switch statement in the middle of the method..

    private synchronized void discoverThings() {
        if (thingHandler.getThing().getStatus() == ThingStatus.ONLINE) {
            try {
                ThingUID bridgeUID = thingHandler.getThing().getUID();
                for (Entry<ResourceType, ThingTypeUID> entry : DISCOVERY_TYPES.entrySet()) {
                    for (Resource resource : thingHandler.getResources(new ResourceReference().setType(entry.getKey()))
                            .getResources()) {

                        MetaData metaData = resource.getMetaData();
                        if (Objects.nonNull(metaData) && (metaData.getArchetype() == Archetype.BRIDGE_V2)) {
                            // the bridge device is handled by a bridge thing handler
                            continue;
                        }

                        String resourceId = resource.getId();
                        String idv1 = resource.getIdV1();
                        String resourceType = resource.getType().toString();
                        String resourceName = resource.getName();
                        String thingId = resourceId;
                        String thingLabel = resourceName;
                        String legacyThingUID = null;

                        String semanticEquipmentTag = null;
                        switch (resource.getType()) {
                            case ADD:
                                break;
                            case AUTH_V1:
                                break;
                            case BEHAVIOR_INSTANCE:
                                break;
                            case BEHAVIOR_SCRIPT:
                                break;
                            case BRIDGE:
                                break;
                            case BRIDGE_HOME:
                                break;
                            case BUTTON:
                                break;
                            case CAMERA_MOTION:
                                break;
                            case CONTACT:
                                break;
                            case DELETE:
                                break;
                            case DEVICE:
                                semanticEquipmentTag = "Lightbulb";
                                break;
                            case DEVICE_POWER:
                                break;
                            case ENTERTAINMENT:
                                break;
                            case ENTERTAINMENT_CONFIGURATION:
                                break;
                            case ERROR:
                                break;
                            case GEOFENCE:
                                break;
                            case GEOFENCE_CLIENT:
                                break;
                            case GEOLOCATION:
                                break;
                            case GROUPED_LIGHT:
                                break;
                            case GROUPED_MOTION:
                                break;
                            case HOMEKIT:
                                break;
                            case LIGHT:
                                break;
                            case LIGHT_LEVEL:
                                break;
                            case MOTION:
                                break;
                            case PUBLIC_IMAGE:
                                break;
                            case RELATIVE_ROTARY:
                                break;
                            case ROOM:
                                semanticEquipmentTag = "Room";
                                break;
                            case SCENE:
                                break;
                            case SMART_SCENE:
                                break;
                            case TAMPER:
                                break;
                            case TEMPERATURE:
                                break;
                            case UPDATE:
                                break;
                            case ZGP_CONNECTIVITY:
                                break;
                            case ZIGBEE_CONNECTIVITY:
                                break;
                            case ZONE:
                                semanticEquipmentTag = "Zone";
                                break;
                            default:
                                break;

                        }

                        // special zone 'all lights'
                        if (resource.getType() == ResourceType.BRIDGE_HOME) {
                            thingLabel = thingHandler.getLocalizedText(ALL_LIGHTS_KEY);
                        }

                        Optional<Thing> legacyThingOptional = thingHandler.getLegacyThing(idv1);
                        if (legacyThingOptional.isPresent()) {
                            Thing legacyThing = legacyThingOptional.get();
                            legacyThingUID = legacyThing.getUID().getAsString();
                            String legacyLabel = legacyThing.getLabel();
                            thingLabel = Objects.nonNull(legacyLabel) ? legacyLabel : thingLabel;
                        }

                        DiscoveryResultBuilder builder = DiscoveryResultBuilder
                                .create(new ThingUID(entry.getValue(), bridgeUID, thingId)) //
                                .withBridge(bridgeUID) //
                                .withLabel(thingLabel) //
                                .withProperty(PROPERTY_RESOURCE_ID, resourceId)
                                .withProperty(PROPERTY_RESOURCE_TYPE, resourceType)
                                .withProperty(PROPERTY_RESOURCE_NAME, resourceName)
                                .withRepresentationProperty(PROPERTY_RESOURCE_ID);

                        if (Objects.nonNull(legacyThingUID)) {
                            builder = builder.withProperty(PROPERTY_LEGACY_THING_UID, legacyThingUID);
                        }
                        if (Objects.nonNull(semanticEquipmentTag)) {
                            builder.withSemanticEquipmentTag(semanticEquipmentTag);
                        }
                        thingDiscovered(builder.build());
                    }
                }
            } catch (ApiException | AssetNotLoadedException e) {
                logger.debug("discoverThings() bridge is offline or in a bad state");
            } catch (InterruptedException e) {
            }
        }
        stopScan();
    }

@jimtng
Copy link
Contributor

jimtng commented Feb 26, 2025

Great work, @rkoshak!

First, we need to decide the upper casing. Is it FrontYard, Frontyard? Backyard or BackYard? Bedroom is not BedRoom but LivingRoom is not Livingroom, so this thing is a bit inconsistent it seems.

@jimtng
Copy link
Contributor

jimtng commented Feb 26, 2025

And it seems to me that it would be useful if addons could access the predefined tags in the form of public static final string constants in OH core. (Rather than having the addon developer define such strings in the addon code; since that could be a source of errors)

@andrewfg Is it not possible to define the tag in the thing-type.xml?

@jimtng
Copy link
Contributor

jimtng commented Feb 26, 2025

See #4622, maybe that can come in handy?

@rkoshak
Copy link
Author

rkoshak commented Feb 26, 2025

First, we need to decide the upper casing.

The existing OH tags are pretty consistent with starting with a capital letter and using camel case thereafter. I think it would be best to stick with the convention that's already there.

And it seems to me that it would be useful if addons could access the predefined tags in the form of public static final string constants in OH core. (Rather than having the addon developer define such strings in the addon code; since that could be a source of errors). => Does anyone have any idea if this is possible?

Wouldn't it make sense to pull the tags from the API that already exists backing the REST API tags endpoint? I worry if we have these tags defined in at least three different places it will become unmaintainable.

I found a converter to make the table above easier to read here. Unfortunately the hierarchy doesn't get rendered. but hopefully you can look at the csv above and figure it out. It's pretty straight forward and as one would expect.

openHAB Googel Assistant Alexa Homekit
Location
Indoor
Apartment
Building
Garage Garage
House
Shed Shed
SummerHouse
Corridor Hallway
Floor
Attic Attic
Basement
FirstFloor
GroundFloor
SecondFloor
ThirdFloor
Room
Back door
Bathroom Bathroom
Bedroom Bedroom
BoilerRoom
Cellar
Den
DiningRoom Dining Room
Entry Entryway
FamilyRoom Family Room
Front Door
GuestRoom
Kitchen Kitchen
LaundryRoom
LivingRoom
Master Bedroom
Office Office
Side Door
Veranda
Outdoor
Backyard
Carport
Driveway
Front Yard
Garden
Patio
Porch
Terrace
openHAB Googel Assistant Alexa Homekit
AccessoryGroup
AirFreshener
Awning Awning
Equipment Other
AlarmSystem
Battery Battery
Blinds
Boiler
Camera Camera Camera
Car Automobile
AutomobileAccessory
ChristmasTree
Charger
CleaningRobot Vacuum VacuumCleaner
Coffee_Maker CoffeeMaker
Computer
Door Door Door Door
BackDoor
CellarDoor
FrontDoor
GarageDoor Garage GarageDoor
Gate Gate
InnerDoor
SideDoor
Doorbell Doorbell
Fan Fan Fan Fan
BasicFan
CeilingFan
KitchenHood Hood
Faucet
AirPurifier AirPurifier Filter
GameConsole
GarageDoorOpener
Headphones
Hub
Fireplace
HVAC HeaterCooler
AirConditioner
Inverter
Sprinkler IrrigationSystem
Laptop
LawnMower
LighttBulb Light Light Lighting
LightStripe
SpecialColorLight
Lock Lock Lock Lock
Microphone
NetworkAppliance NetworkHardware
Router
Pergola
PowerOutlet Outlet Outlet Outlet
Printer
Projector
Pump
RadiatorControl Thermostat Thermostat Thermostat
Receiver MusicSystem
RemoteControl Remote
Screen Screen
Television TV Television Television
SecurityPanel
SecuritySystem SecuritySystem SecuritySystem
StreamingDevice
Scene
Sensor Sensor
AirQualityMonitor AirQualitySensor
ClimateSensor
HumiditySensor
TemperatureSensor
MotionDetector MotionSensor MotionSensor
OccupancySensor
SmokeDetector
Service
Siren
SlowCooker
Smartphone MobilePhone
Phone
Speaker Speaker Speaker Speaker
BluetoothSpeaker
SmartSpeaker
TelevisionSpeaker
StatelessProgrammableSwitch
Tablet
Switch
Valve Valve
VoiceAssistant
WallSwitch
WebService
WeatherService
WhiteGood
Dishwasher Dishwasher
Dryer Dryer
Freezer
Microwave
Oven Oven
Refrigerator
WashingMachine Washer
WaterHeater
Wearable
Window Window
Blinds Blind WindowCovering
Curtain Curtain
Shade
Shutter Shutter
openHAB Points openHAB Properties
Point Property
Alarm CO
BatteryProperty CO2
Control ColorTemperature
Switch Current
Measurement Duration
Setpoint Energy
Status Frequency
LowBattery Gas
OpenLevel Humidity
OpenState Level
Tampered Light
Tilt Noise
Oil
Opening
Power
Presence
Pressure
Rain
Smoke
SoundVolume
Temperature
Timestamp
Ultraviolet
Vibration
Voltage
Water
Wind
Attribute OH Point/Property Mapping
chargerCapacityRemaining BatteryProperty/Level
chargerCapaciotyUntilFull BatteryProperty/Level
chargerCharging Status
chargerPluggedIn Status
humidityAmbient Measurement/Humidity
lightBrightness Control/Light
lightColor Control/Light
lightColorTemperature Control/Light
securitySystemArmed Status
securitySystemArmLevel Status
securitySystemTrouble Status
securitySystemTroubleCode Status
securitySystemZone
temperatureAmbient Measurement/Temperature
thermostatTermperatureAmbient Measurement/Temperature
thermostatTemperatureSetpoint Setpoint/Temperature
thermostatTemperatureSetpointHigh Setpoint/Temperature
thermostatTemperatureSetpointLow Setpoint/Temperature
tvApplication
tvChannel
tvInput
tvMute Control/Noise
tvPower Switch/Power
tvTransport
tvVolume Control/Noise

@andrewfg
Copy link
Contributor

Is it not possible to define the tag in the thing-type.xml?

In some cases yes it can be hard coded in the xml. But for example in the Hue binding the discovery process finds generic "device" things. Then the binding queries the "device" via API calls to establish its exact device type .. so in such cases I would return the semantic equipment tags dynamically during the discovery process rather than hard coded in the thing type xml.

@jimtng
Copy link
Contributor

jimtng commented Feb 27, 2025

Thanks for the awesome work, @rkoshak

Proposed Semantic Tag Additions

Any you'd like to remove from here?

Locations

  • Location_Outdoor_FrontYard
  • Location_Outdoor_Backyard
  • Location_Outdoor_BackPorch
  • Location_Pool (could be indoor or outdoor, determined by the semantic group membership?)
  • Location_Indoor_Room_Study
  • Location_Indoor_Room_Studio
  • Location_Indoor_Room_Theater (synonyms: Theatre / HomeTheater / HomeTheatre)
  • Location_Indoor_Closet
  • Location_Indoor_Cupboard
  • Location_Indoor_Kitchen_Pantry

Equipment

  • Equipment_Curtain
  • Equipment_WaterHeater
  • Equipment_Pump_PoolPump
  • Equipment_CoffeeMaker
  • Equipment_AirPurifier
  • Equipment_IrrigationSystem
  • Equipment_Thermostat - (retain RadiatorControl as synonym or add Equipment_Thermostat separately)
  • I think we can improve on Equipment_Lightbulb. Light Strips aren't exactly "light bulbs"
  • What is a "Light Stripe" ? Light with stripes?

For Television/Receiver/Radio

  • Property_Application
  • Property_Channel
  • Property_Mute
  • Property_Input
  • Property_PlayState

For Air conditioners, alarm system

  • Property_Mode
  • Property_Zone

For Lights

  • Property_Color
  • Property_Brightness - I've been using Level but would love to use Brightness instead

@andrewfg
Copy link
Contributor

I am wondering about Equipment_Group for things that "wrap" a group of several other equipment things. For example in Hue a group of lights, or in a security system a group of motion detectors. These are kind of virtual equipment things. Where one may typically arm or command a channel on the group thing rather than individually on the things therein.

There is also perhaps a Scene thing which is also a kind of virtual "wrapper" thing.

=>WDYT?

@jimtng
Copy link
Contributor

jimtng commented Feb 27, 2025

I am wondering about Equipment_Group for things that "wrap" a group of several other equipment things.

This is supported by the current Semantic Model. An Equipment can contain other equipments.

Or do you mean that an equipment with no other purpose but only to contain other equipments? Does this "Group" need to be in the semantic model too?

@andrewfg
Copy link
Contributor

Umm. I am not sure. I guess a group of lights is also Equipment_Light and a group of motion detectors is an Equipment_MotionDetector. If nested equipment is allowed that would also work.

@jimtng
Copy link
Contributor

jimtng commented Feb 27, 2025

Are the last part of the names supposed to be unique?

In other words, is it allowed to have Equipment_Foo and Point_Foo?

@rkoshak
Copy link
Author

rkoshak commented Feb 27, 2025

If nested equipment is allowed that would also work.

Nested Equipment is definitely allowed. I'm not sure there will be a way to handle something like that from the binding though. At least not with out more significant changes that have been proposed thus far. The binding would need to recommend not just a tag to apply to the Equipment Group but a whole hierarchy of Groups and tags to apply.

Proposed Semantic Tag Additions

This kind of helps illustrate why I think we need some rules for what makes an acceptable tag.

Do we really need both FrontYard and BackYard or would it be better to have Yard and let the name and label of the Item distinguish between front and back?

Coming up with a heuristic to evaluate what makes a good tag is what I hoped to come out of this issue. We can come up with a list here, but that isn't necessarily my main focus.

Looking at this list of potential new tags I have some questions the answer to which might lead us to some rules.

Locations

  • Is there a semantically meaningful difference between "FrontYard" and "BackYard"? What about "SideYard"? I would think it would make sense to just have "Yard". Whether it's front, back, or side is indicated by the Item name and label. I don't think we need separate tags for each iteration of "Yard". Or maybe create Location_Outdoor_Yard and put FrontYard and BackYard under that. But I would say that these last two serve illustrative purposes instead of really needing to be there.

  • Is there really a semantically meaningful difference between a "Cupboard" and a "Kitchen_Pantry"? What about "Closet", "Tool chest", "Cabinet" and other names for a "location where stuff gets stored"? Should locations be limited to actual rooms or can a piece of furniture count as a Location?

  • Is there a semantically meaning full difference between "Office", "Studio", "Study", "Workshop" and rooms like that or does it make more sense to treat this like I described Yard above? If these are the same, does "Office" (the currently existing tag) still make sense as the name for the category or should it be something more generic?

Equipment

  • This category is pretty flat. Does it make sense to add some more depth to the hierarchy? For example, Equipment_ClimateControl, Equipment_ClimateControl_HVAC, Equipment_ClimateControl_Radiator, Equipment_ClimateControl_Thermostat, etc.

  • Does it make sense to list a bunch of single point sensors as an Equipment? Or should those be Point/Properties? This is referring to tags like MotionSensor, HumiditySensor, TemperatureSensor, etc.

Points

  • What makes a good point tag? The Point is one of the main thing that controls the default widget chosen in MainUI so that needs to be one of the things that drives what makes a good Point. The current list is clearly incomplete but some of the stuff in there are questionable I think.

Properties

  • These should all be nouns. I think this category has the least need for rules. We just need to make sure that everything is a noun and it's something that would typically be something measured or controlled in a home automation context.

Proposed Rules

Given how I would answer these questions I'd recommend the following rules:

  • A Location tag should identify a category; we don't need a separate tag for every different name or variation of that Location. Kitchen can serve for both Kitchen and Kitchenette for example. Bathroom can serve for Bathroom, MasterBathroom, WaterCloset, HalfBath, etc. The name and label of the Item serves to distinguish between all of these. A proposed new tag should not be just another name for an already existing tag.

  • It is OK to add some sub-tags to a category if it serves to help inform the end user what the category tag represents and it's a commonly used name for a location/equipment/point/property. But we need to resist the urge to try to be comprehensive.

  • When the name of a tag is ambiguous in whether it can be an Equipment or a Point or Property, add what it is to the tag. For example, BatteryEquipment might represent an UPS and BatteryPoint with the Property Level might represent how much charge a battery may have. LightingEquipment would be used for lamps, light bulbs and other lighting fixtures and LightProperty would be used with Point tags like Control, Switch, and Measurement.

  • A Point tag should be what you do to or how you get the state of the Item. LowBattery, BatteryProperty (I think this might be one of my custom tags I didn't filter out), OpenState, OpenLevel, Tampered, and Tilt are poor Point tags or at least poorly named.

  • Use the hierarchy. For example, for Point tags Switch and Setpoint should be children of Control since they all represent a form of controlling something.

  • Properties should always be a noun and represent something commonly controlled or sensed in a home automation context.**

These are just my ideas and I don't want to get too long of a list of rules. But I do think we need to constrain tags some. Given these rules, the following do not make good tags:

  • Location_Outdoor_FrontYard
  • Location_Outdoor_Backyard
  • Location_Outdoor_BackPorch
  • Location_Indoor_Room_Study and Location_Indoor_Room_Studioshould be grouped with office somehow
  • Location_Indoor_Closet, Location_Indoor_Cupboard, and Location_Indoor_Kitchen_Pantry should get just a Location_Indoor_Storage tag or all fall under this more generic tag
  • Equipment_Thermostat should be grouped together with Radiator and HVAC
  • Property_Brightness is a special case of Property_Light so should go under that as Property_Light_Brightness

For the existing tags:

  • SummerHouse should be under House or removed as redundant
  • In the US at least, Basement and Cellar are regional synonyms, I'm not sure Cellar adds anything
  • A GuestRoom is a Bedroom, we don't need a separate tag for that
  • Patio, Porch, and Terrace are all essentially "outdoor rooms" and should be grouped as such
  • At most we should have ExteriorDoor, InteriorDoor and GarageDoor

New Tags I would propose (in addition to what's been already proposed):

  • Location_Indoor_Entertainment which could include under it Location_Indoor_Theater, Location_Indoor_Den, and Location_Indoor_GameRoom
  • Location_Indoor_MudRoom under Location_Indoor_Entry
  • Location_Indoor_UtilityRoom which Location_Indoor_LaundryRoom and Location_Indoor_BoilerRoom would fall
  • Equipment_NetworkDevice_Computer and Equipment_NetworkDevice_ComputerService
  • Equipment_MediaPlayer under which Equipment_Receiver, Equipment_Television, and perhaps Equipment_Speakers should go.
  • Property_VOC
  • Property_Radon
  • Property_AirQuality
  • Property_Cost
  • Property_Time
  • Property_Image
  • Property_Video

These are just off the top of my head.

Are the last part of the names supposed to be unique?

Yes, they must be unique because the last part becomes the tag that's actually applied to the Item.

@andrewfg
Copy link
Contributor

I'm not sure there will be a way to handle something like that from the binding though.

Agreed.

@andrewfg
Copy link
Contributor

andrewfg commented Feb 27, 2025

Probably you need to add Equipment.HUB or Equipment.BRIDGE or Equipment.GATEWAY.

@rkoshak
Copy link
Author

rkoshak commented Feb 27, 2025

Probably you need to add Equipment_Hub or Equipment_Bridge or Equipment_Gateway.

Would these be a child of Equipment_NetworkDevice or are you thinking something else?

@andrewfg
Copy link
Contributor

I am thinking of actual OH bridges declaring themselves as such.

@jimtng
Copy link
Contributor

jimtng commented Feb 27, 2025

I am thinking of actual OH bridges declaring themselves as such.

OH (thing) bridges would never need to be in the semantic model though, I think?

This is different to the equipment group you mentioned earlier right?

@andrewfg
Copy link
Contributor

andrewfg commented Feb 27, 2025

OH (thing) bridges would never need to be in the semantic model though, I think?

Why do you say that? Many Bridges have channels that are linked to items, so it is perfectly sensible to see them in a semantic context.

This is different to the equipment group you mentioned earlier right?

Yes.

@jimtng
Copy link
Contributor

jimtng commented Feb 27, 2025

OH (thing) bridges would never need to be in the semantic model though, I think?

Why do you say that? Many Bridges have channels that are linked to items, so it is perfectly sensible to see them in a semantic context.

I didn't know about this. Could you give me an example?

@andrewfg
Copy link
Contributor

Could you give me an example?

Sure. Following are just a couple..

  1. Hunter Douglas Powerview: the bridge has channels for setting scenes and activating automations.
  2. Philips Hue: the bridge has channels for enabling automations.

@jimtng
Copy link
Contributor

jimtng commented Feb 28, 2025

This kind of helps illustrate why I think we need some rules for what makes an acceptable tag.

Coming up with a heuristic to evaluate what makes a good tag is what I hoped to come out of this issue. We can come up with a list here, but that isn't necessarily my main focus.

Indeed, this was the idea from the start! By looking at actual examples, we could then derive some sort of generalisation / rules. Without this exercise, it'll be a bit more abstract.

But this can also serve as a source for the eventual expansion / revision of the semantic model. So multi-purpose. @andrewfg has identified a few other points towards this as well. All in all a great idea.

Do we really need both FrontYard and BackYard or would it be better to have Yard and let the name and label of the Item distinguish between front and back?

  • A Location tag should identify a category; we don't need a separate tag for every different name or variation of that Location. Kitchen can serve for both Kitchen and Kitchenette for example. Bathroom can serve for Bathroom, MasterBathroom, WaterCloset, HalfBath, etc. The name and label of the Item serves to distinguish between all of these. A proposed new tag should not be just another name for an already existing tag.

We also don't want to go too generic, like you could say a Bathroom is just another type of Room, for example. Of course in this case we all agree that it's a good idea to subcategorise them (Bathroom, LivingRoom, Kitchen, etc).

On this topic:

  • Yes I agree we shouldn't try to list every possibly type of bathroom under the sun, but having a bit more refinement, which is optional of course, would be handy. For example, usually (not always the case), we might want to distinguish MasterBathroom (or should it now be called MainBathroom?) vs other bathrooms in the house, and this goes the same for MasterBedroom. We might want to have actions that apply to other bathrooms but not masterbathroom, for example.

Having a unique semantic tag for them, would simplify the code so you only need to filter on the semantic tag and not have to further filter again (on label, or custom tag, or group membership etc).

Of course if this is irrelevant to "you" (as in general "you"), you could just not utilise the MasterBathroom tag and apply the more generic Bathroom tag for everything in "your" house.

The nebulous thing is that you can create a custom tag MasterBathroom in this case, but then you could argue that for everything else. I think MasterBathroom / MasterBedroom has a place in the default tag, but of course this is only my opinion.

  • I agree that WaterCloset, Halfbath, shouldn't be added to the default.

I would argue that MasterBathroom is a separate category, one which is probably very common for a lot of people.

  • Or maybe create Location_Outdoor_Yard and put FrontYard and BackYard under that.

Also with FrontYard vs backyard, the two "yards" usually serve different purposes and receive different treatments when it comes to automation, that I believe they should have their own tags.

Grouping them under Outdoor_Yard is good, so it gives you option for when you don't care, you'd just use their parent.

So perhaps this rule could be further refined?

A location tag should identify a category which makes them unique for the purposes of automation as well as organisation

  • But we need to resist the urge to try to be comprehensive.

I agree as long as it satisfies the "automation + organisation" aspect above.

  • When the name of a tag is ambiguous in whether it can be an Equipment or a Point or Property, add what it is to the tag. For example, BatteryEquipment might represent an UPS and BatteryPoint with the Property Level might represent how much charge a battery may have. LightingEquipment would be used for lamps, light bulbs and other lighting fixtures and LightProperty would be used with Point tags like Control, Switch, and Measurement.

How about BatteryEquipment vs Battery (Point)? This reduces the "clutter" in the name, especially for Points, which we use the most.

A Point tag should be what you do to or how you get the state of the Item. LowBattery, BatteryProperty (I think this might be one of my custom tags I didn't filter out), OpenState, OpenLevel, Tampered, and Tilt are poor Point tags or at least poorly named.

Agreed

  • Is there really a semantically meaningful difference between a "Cupboard" and a "Kitchen_Pantry"? What about "Closet", "Tool chest", "Cabinet" and other names for a "location where stuff gets stored"? Should locations be limited to actual rooms or can a piece of furniture count as a Location?

Locations should be limited to Locations. A Kitchen Pantry is a specific location in which some equipment (sensor, lights, heater, fridge, etc) can reside.

The question about whether there's a difference between A and B goes back to the question whether having a more unique one would aid in organisation and whether they need to be differentiated in their automation.

  • This category is pretty flat. Does it make sense to add some more depth to the hierarchy? For example, Equipment_ClimateControl, Equipment_ClimateControl_HVAC, Equipment_ClimateControl_Radiator, Equipment_ClimateControl_Thermostat, etc.

This would depend on whether there's an actual need to add more things into that category. If so, then naturally a hierarchy would make sense.

These are just my ideas and I don't want to get too long of a list of rules. But I do think we need to constrain tags some. Given these rules, the following do not make good tags:

Location_Outdoor_FrontYard
Location_Outdoor_Backyard.
Location_Outdoor_BackPorch

For me each of these have separate meaning and receives separate treatment in automation. For example, I want to turn off Backyard lights, but not back porch lights.

But this is where I'm still confused about semantic tags vs actual locations.

Property_Brightness is a special case of Property_Light so should go under that as Property_Light_Brightness

Then so should ColorTemperature, however Color could also apply to other things, e.g. printer ink.

SummerHouse should be under House or removed as redundant

Somebody must've added this in the past for a reason. What if you had multiple summerhouses :D But maybe it should be called VacationHouse or something.

In the US at least, Basement and Cellar are regional synonyms, I'm not sure Cellar adds anything

I thought a Cellar is a special storage space for your liquor? Whilst traditionally it's located in some sort of basement, it could also be in a special cupboard/pantry/room in the kitchen or some other parts of the house.

A GuestRoom is a Bedroom, we don't need a separate tag for that

This goes with the idea of organising your automation without having to add extra criteria. In a "typical" house, you have:

  • Master bedroom (always occupied)
  • Kids bedroom (always occupied if you have kids/roommates)
  • Guest bedroom (usually empty, unless they are having guests)
    So the automation for the guest bedroom would probably be different and having a separate tag I think makes a lot of sense.

Patio, Porch, and Terrace are all essentially "outdoor rooms" and should be grouped as such

IMO these should be synonyms of one thing

At most we should have ExteriorDoor, InteriorDoor and GarageDoor

I kind of agree that these should exist, but not yet sure whether the others should not. FrontDoor is a special one in almost every house and I think that should exist.

Equipment_NetworkDevice_Computer and Equipment_NetworkDevice_ComputerService

  • Printer

@andrewfg
Copy link
Contributor

Coming up with a heuristic to evaluate what makes a good tag

Roger that.

@andrewfg
Copy link
Contributor

andrewfg commented Feb 28, 2025

So here are some suggestions. The easy ones..

  1. PROPERTY tags should have the flavour of a UoM

  2. POINT tags should have the flavour of an OH Item type; with some tweaks for measure/command/info/state variants.

  3. EQUIPMENT should have the flavour of a standard industrial trade classification code. The ISO publishes a list of such codes called ISIC. These are numeric codes so we would have to provide a descriptor.

  4. LOCATION .. yup this is the difficult one. Maybe the Institute of Architects have codes? EDIT or maybe ISO 4157-2

Or perhaps (more better) we should try to follow the BIM codification of ISO 19650 which is "an international standard that uses building information modeling (BIM) to manage information throughout the life of a built asset". I don't know much about the details, but I know it is definitely a big thing.

@andrewfg
Copy link
Contributor

andrewfg commented Feb 28, 2025

I have a couple of suggestions..

  1. As Equipment.LIGHT_STRIP(E) is snake case, probably Equipment.LIGHT_BULB should also be snake case.
  2. As we have Equipment.LIGHT_STRIP(E) and Equipment.LIGHT_BULB, probably we need the super case Equipment.LIGHT above it.
  3. As we have Equipment.WALL_SWITCH, probably we also need Equipment.WALL_DIAL. (e.g. Hue has a rotary dial stepper control).

@jimtng
Copy link
Contributor

jimtng commented Feb 28, 2025

3. As we have WALL_SWITCH, probably we also need WALL_DIAL. (e.g. Hue has a rotary dial stepper control).

There's also linear slider ;)

@andrewfg
Copy link
Contributor

We also probably need the following

  • Equipment.ALARM_DEVICE - an equipment that is a component part of an ALARM_SYSTEM

@andrewfg
Copy link
Contributor

There's also linear slider ;)

=> So perhaps Equipment.WALL_DEVICE ??

@andrewfg
Copy link
Contributor

To inform this thread, I learned a huge amount about semantic equipment tags on things by playing around with a real actual binding example -- namely the Hue system here => it makes me think that we would perhaps learn a huge amount more by doing similar exercises on other real actual bindings.

@andrewfg
Copy link
Contributor

andrewfg commented Feb 28, 2025

Would these be a child of Equipment_NetworkDevice

Actually @rkoshak I think Equipment.NETWORK_DEVICE is just fine.
See example from Hue binding via OH Rest API below..

[
  {
    "editable": true,
    "label": "Hue motion sensor 1",
    "bridgeUID": "hue:bridge-api2:001788fffe2157c7",
    "UID": "hue:device:001788fffe2157c7:70660557-692d-4d37-8b6b-e3ec63716a72",
    "thingTypeUID": "hue:device",
    "semanticEquipmentTag": "Sensor"
  },
  {
    "editable": true,
    "label": "Contact Sensor",
    "bridgeUID": "hue:bridge-api2:001788fffe2157c7",
    "UID": "hue:device:001788fffe2157c7:faac7940-a303-4e8e-9f06-075fffb7229c",
    "thingTypeUID": "hue:device",
    "semanticEquipmentTag": "AlarmSystem"
  },
  {
    "editable": true,
    "label": "Philips Hue (192.168.1.108)",
    "UID": "hue:bridge-api2:001788fffe2157c7",
    "thingTypeUID": "hue:bridge-api2",
    "semanticEquipmentTag": "NetworkDevice"
  },
  {
    "editable": true,
    "label": "Hue tap dial switch 1",
    "bridgeUID": "hue:bridge-api2:001788fffe2157c7",
    "UID": "hue:device:001788fffe2157c7:ebca68a4-9312-4d3b-86a9-59b5a4a6a988",
    "thingTypeUID": "hue:device",
    "semanticEquipmentTag": "WallSwitch"
  },
  {
    "editable": true,
    "label": "Conservatory Wallplate Switch",
    "bridgeUID": "hue:bridge-api2:001788fffe2157c7",
    "UID": "hue:device:001788fffe2157c7:a0509519-3ecb-47d0-9183-25db1e4ea2b2",
    "thingTypeUID": "hue:device",
    "semanticEquipmentTag": "WallSwitch"
  },
  {
    "editable": true,
    "label": "Office",
    "bridgeUID": "hue:bridge-api2:001788fffe2157c7",
    "UID": "hue:room:001788fffe2157c7:1166743f-fe3d-47d1-bd7d-b5bb378098cc",
    "thingTypeUID": "hue:room",
    "semanticEquipmentTag": "Lightbulb"
  },
  {
    "editable": true,
    "label": "Office Lamp",
    "bridgeUID": "hue:bridge-api2:001788fffe2157c7",
    "UID": "hue:device:001788fffe2157c7:24e7a04e-ad36-4192-961e-ca7f22103cbc",
    "thingTypeUID": "hue:device",
    "semanticEquipmentTag": "Lightbulb"
  }
]

@rkoshak
Copy link
Author

rkoshak commented Feb 28, 2025

I do want to emphasize something. I'm not really arguing for or against any specific tags. I'm mainly using these as examples to try to come to some rules we can use to assess these and future tags and then I want to use the rules to justify or eliminate the existing tags and apply them to future tags.

I also want to emphasize that tags identify the type of something. It will be common to have multiple Items with the same tag in as model. To uniquely identify a specific instance we need additional information (e.g. position in the model. name, label, metadata).

Location is a little weird because the tags are actually the least important in the semantic model (they add the least amount of information and they cause the least amount of impact on how everything is shown and how reasoning is performed). At the same time, these tags are the most likely to be used only once in the model. So I don't want to get too hung up on Location tags.

If I tagged everything as "Location" but built my semantic model the same way I do now, the only different is the automatic color chosen for the cards that appear in the Locations tab of MainUI. The label on the card, the information HABot uses to reason on the model, and everything else would work the same. Locations should follow any rules we come up with, but we should probably not base our rules on Location tags.

AFter this post I will switch to Equipment and Point/Property examples I think because I think the nature of Locations is leading us astray.

we might want to distinguish MasterBathroom (or should it now be called MainBathroom?) vs other bathrooms in the house, and this goes the same for MasterBedroom. We might want to have actions that apply to other bathrooms but not masterbathroom, for example.

The tag isn't the only piece of information we have here though. We also have:

  • Item name
  • Item label
  • synonyms Item metadata

All of these should be used in addition to the semantic tag to provide information about the specific Item. A tag's entire reason for being should not be to uniquely identify a specific Location, Equipment, or Point/Property. The purpose of the tag is to identify the type of that Item.

So do we need a separate tag for "MainBathroom" or is the semantic tag "Bathroom" coupled with the Item name "Main_Bathroom" enough. I'm not arguing against a "MainBathroom" tag here. I'm just making sure that this is taken into consideration when assessing any new tag. It will be common to have many instances of Items tagged with the same semantic tag. Tags cannot be used to uniquely identify something.

If I get a list of all the Bathrooms, I still need to use additional information to identify the hall bathroom on the main floor and the hall bathroom on the top floor (for example).

Where we ran into trouble before is everyone wanted to have their own terms represented as a separate tag. "Yes, we already have a Patio tag but in Florida we call that a 'lenai' so I want a 'lenai' tag." I want to create some rules we can use to say "Yes, that's a great idea!" or "No, we already have that case covered with the existing tags, you should use the existing Patio tag but call your Item 'Lenai' or create a custom tag."

Without some rules, it's just going to be arbitrary based on what the reviewer thinks and we won't have consistency. But our rule needs to be consistent too. If we think MainBathroom makes sense but Lenai does not, our rules need to clearly lead to that result.

The nebulous thing is that you can create a custom tag MasterBathroom in this case, but then you could argue that for everything else. I think MasterBathroom / MasterBedroom has a place in the default tag, but of course this is only my opinion.

I do too but I think it's a useful case to consider when comming up with a rule. And if we accept that these make sense, what does that open us up to in other categories where applying the same rule could lead to scores of new tags rendering the list too hard to work with or forcing us to be inconsistent.

A location tag should identify a category which makes them unique for the purposes of automation as well as organisation

HalfBath and WaterCloset can both meet that rule and we already both intuitively feel they these shouldn't be included.

But I do take issue with the word "unique". We do not and should not have a unique tag for every light in the house forr example. The semantic tag identifies the type of something and does not uniquely identify it. If we are not in agreement on this point I don't think we can ever come up with a consistent approach. Location tags need to be the type of the location, not a unique identifier for a specific Location.

How about BatteryEquipment vs Battery (Point)? This reduces the "clutter" in the name, especially for Points, which we use the most.

As long as it's clear I'm happy with any approach. That approach makes sense.

The question about whether there's a difference between A and B goes back to the question whether having a more unique one would aid in organisation and whether they need to be differentiated in their automation.

But how are we to judge that? That's really what I'm after. I can make a good argument that having a tag for HalfBath would aid in my organization and differentiated in my automation. My half bath doesn't have a humidity sensor in it and it would be convenient to not have it included when I want to turn on the vents since there's no info to turn on that vent.

A Kitchen Pantry is a specific location in which some equipment (sensor, lights, heater, fridge, etc) can reside.

If I have a wardrobe with motion sensors and lights?

I'm inclined to say no, that wardrobe shouldn't be included but I'm struggling with comming up with rules that would clearly exclude that tag while including tags that do seem to make sense like MainBedroom.

For me each of these have separate meaning and receives separate treatment in automation. For example, I want to turn off Backyard lights, but not back porch lights.

So how do we make a rule or rules that decides that those are good but HalfBath and Wardrobe are bad? That's what I'm really after. As I said above, getting hung up on Locations may be hindering us. It might be better to focus on Equipment.

Then so should ColorTemperature, however Color could also apply to other things, e.g. printer ink.

That's where it gets complicated. But I think that ColorTemperature is only something that, in a home automation context, is used with lighting. So I would include both and put ColorTemperature under Light and Color would stand on it's own.

But that's just my own arbitrary thoughts. What would that look like as a rule we can use to make sure we are consistent?

Somebody must've added this in the past for a reason. What if you had multiple summerhouses :D But maybe it should be called VacationHouse or something.

That's a major point I'm trying to get across. If you have multiple summerhouses, all of them should have the same tag. They are all summerhouses. The tag isn't the only piece of information. You distinguish between multiples using the name, label, and synonyms. It's the Item name that distinguises between the two.

Given that you can and should have more than one instance of most of these tags, our heuristic can't be based around something that implies each Item has a unique tag.

I personally don't think "SummerHoure" or "VacationHouse" either really add anything. I wouldn't include either. But I'm open if there's a consistent rule we can apply to justify them.

The fact that it's a house is captured. Which house it is doesn't need to be and I'd argue shouldn't be encoded in the tags. That's what all the other information is there for.

I think about it like bedrooms. Ignoring the the whole MainBedroom discusssion, do we need Child1Bedroom, Child2Bedroom, Child3Bedroom, or just Bedroom and have the Item name and other info used to distinguish between the three? If the same arguments for including FrontYard (for excample) justifies adding a bunch of ChildBedroom tags, I think we are off the mark. If the same argument can be used to add a proliferation of LightBulb tags because if there's one type of thing that there is likely to be more than one of in a Location, it's lights, we are off the mark.

The tags need to be used to tag something based on what kind of thing it is, not uniquely identify it.

Guest bedroom (usually empty, unless they are having guests)
So the automation for the guest bedroom would probably be different and having a separate tag I think makes a lot of sense.

I agree, so we need a rule that allows that without needing to create a separate tag for each child's bedroom. The automation for the teenager might be very different from the automation for the eight-year-old.

PROPERTY tags should have the flavour of a UoM

I like that idea. We just need to be careful because not all Properties are Numbers. We can't exclude them because UoM is meaningless in that context. I can have a String, Switch, Contact, Player, Rollershutter, Dimmer, et al Item which all represent a Property. For example, a Dimmer Item to represent a volume control, or a Contact Item to represent Openness. But in cases where there is a clear mapping between the unit and a Property tag that should be probmoted somehow.

POINT tags should have the flavour of an OH Item type; with some tweaks for measure/command/info/state variants.

I'm not sure about this one. We need the Point tag in the first place because there isn't enough information only in the Item type. And Item types can be used in unusual ways. For eaxample, OH Switch Items are binary, only ON or OFF. But the concept of a switch with multiple states is reasonable (e.g. ON, OFF, AUTO) and one would use a String Item for that. It still makes sense to use a Switch semantic tag on that String Item.

But there are other cases where they can be more tightly coupled. A DateTime Type would probably only be tagged with a "timestamp" tag an a Number:Time would only be tagged with a "time" tag (I don't think "time" exists as a tag yet). A Setpoint tag would only be used with a Number or a Dimmer Item.

EQUIPMENT should have the flavour of a standard industrial trade classification code. The ISO publishes a list of such codes called ISIC. These are numeric codes so we would have to provide a descriptor.

End users are not going to know about or be able to use an ISO spec to choose their Equipment tags. We also don't want to eliminate the flexibility to "build your own equipment".

For example I have a dumb humidifier powered by a smart outlet with a wireless humidity sensor near by. The outlet and humidity sensor are modeled as a single equipment in my model because they work together (through a rule) to make my humidifier smart. We can't be so proscriptive here to eliminate these sorts of possibilities.

And the ISIC is huge! Same for ISO 19650. I like the idea of reviewing those but a whole sale adoption of them I think would be unweildy.

As Equipment.LIGHT_STRIP(E) is snake case, probably Equipment.LIGHT_BULB should also be snake case.

Indeed, I think there's more than one tag that need to be fixed. I think most of the tags use camel case so using that as the standard would probably be the least disruptive overall.

@andrewfg
Copy link
Contributor

andrewfg commented Mar 1, 2025

come to some rules we can use to assess these and future tags

@rkoshak I fully agree with, and support, your aim.

Forgive me for being blunt, but a thousand word essay about the things you don't like, will not advance your aim.

I would like to propose a way forward.

We need four rules. Each rule being one paragraph. No longer.

So let us try together to write those paragraphs.

My proposal is that I write four DRAFT paragraphs. Based on what everyone has said so far in this thread.

Then our operational working procedure is that if one does not like the paragraph, then they are obligated to provide an edited and improved version of that draft.

In other words, we try to follow a positive criticism and editing cycle. No more essays on the negative.

Hopefully if we can repeat this cycle of positive criticism and editing, after a few iterations we will generate a usable final set of texts.

Is that OK with you?

@rkoshak
Copy link
Author

rkoshak commented Mar 1, 2025

I don't think I'm being negative.

Your proposal is fine.

I thought I already did that with the rules I posted above. Maybe we'll have better luck if they didn't come from me.

Here are the rules again, with the examples removed.

A Location tag should identify a category, a type  A proposed new tag should not be just another name for an already existing tag.

It is OK to add some sub-tags to a category if it serves to help inform the end user what the category tag represents and it's a commonly used name for a location/equipment/point/property. But we need to resist the urge to try to be comprehensive.

When the name of a tag is ambiguous in whether it can be an Equipment or a Point or Property, add what it is to the tag. 

A Point tag should be what you do to or how you get the state of the Item. 

Use the hierarchy. 

Properties should always be a noun and represent something commonly controlled or sensed in a home automation context.

@jimtng
Copy link
Contributor

jimtng commented Mar 2, 2025

I don't quite understand this rule:

When a point#Status tag is provided, a sub-type property tag shall NOT be provided. As an example, point#Status plus property#Temperature is not OK.

Why is Property not allowed here?

@andrewfg
Copy link
Contributor

andrewfg commented Mar 2, 2025

I wrote that because it encapsulated something that was in the original documentation. But I agree that it doesn’t really make sense. PS it is not in the word document, which I think should become our definitive text.

EDIT: there may be cases of Status points where a property is not necessary (e.g. Status : Ready) but it's hard to extend that into an argument that a status property is forbidden

EDIT2: I will modify the word doc to reflect that.

@andrewfg
Copy link
Contributor

andrewfg commented Mar 2, 2025

Attached is a revised version of the proposed rules DEVELOPER INFORMATION ON SEMANTIC TAGS.docx -- this describes a) the rules for using tags, and b) the rules for adding new tags. => @rkoshak / @jimtng please enter your revisions to the document and post the revised version here.

@rkoshak the rules for adding new tags can equally be used for your purpose of retroactively removing existing but non appropriate tags; however since this will be a one time effort I will not explicitly mention that purpose in the document.

@rkoshak
Copy link
Author

rkoshak commented Mar 4, 2025

I don't have Word and don't want Word so I have no idea if track changes and comments survived the conversion back and forth. I don't really have a good palce to host it. I'll try to share it through my NextCloud instance. Let me know if that doesn't work.

One general comment I have is I think there might be confusion over how locations are used in realtion to points and equipment. Almost all of the time the location applies to the equipment, not the points. The points become placed in a location by being a member of an equipment that is a member of a location. It's a transitive relationship. Rarely does one put a point in a location individually without an equipment. Putting a point in a location and an equipment is basically a hack to solve a specific UI problem and it is not something that contributes to the logical structure of the model.

https://nc.koshak.us/s/En2jNfRMdmtzWE5

@andrewfg
Copy link
Contributor

andrewfg commented Mar 5, 2025

there might be confusion over how locations are used in realty on to points and equipment

It is a good point. In #4615 I am introducing XSD validation to allow up to one point tag and up to one property tag on channel types resp. instances, and in #4617 I am introducing support for, and XSD validation of, one single equipment tag on things types resp. instances.

So in other words I am preventing the use of location tags by developers. And the location tags would ONLY be added by the user when setting up their specific system for the purposes of grouping items in the semantic model. But nevertheless this obviously doesn’t not remove the need for scrubbing the location tags.

@rkoshak
Copy link
Author

rkoshak commented Mar 5, 2025

But nevertheless this obviously doesn’t not remove the need for scrubbing the location tags.

Agreed.

I was just confused by the rule for providing a loaction tag to the Channel. That would be pushed down to the point Items linked to those Channels, presumably. While not an impossible use case to have points from one Thing end up in different locations, it's a less common use case to have a model configured in that way so the rule surprised me.

However, if we were to support location tagging at the time of creation of an Equipment, I think that would be wholly outside anything the binding developer can influence. So nothing more would need to be done in the Thing XSDs and such beyond what you describe even were MainUI changed to allow us to create a new Location when adding equipment or points to the model instead of requiring the location to be created first.

@andrewfg
Copy link
Contributor

andrewfg commented Mar 5, 2025

that would be wholly outside anything the binding developer can influence

I don't want to enter into a big discussion here. But just to take minor issue with your "wholly outside" statement. There are many bindings (e.g. Hue, NeoHub, HDPowerView, Tado, ..) where you first configure your system using the respective manufacturer's App. And that process involves assigning your equipment to rooms. Then when you add those devices as things into OH the respective API gives you this equipment room information. But as I say it is quite an exotic potential use case, with many potential pitfalls, so I don't really want to open up that can..

@andrewfg
Copy link
Contributor

andrewfg commented Mar 5, 2025

I don't have Word and don't want Word so I have no idea if track changes and comments survived the conversion back and forth.

:) .. and yes the comments did make it; many thanks.

Attached below is a revised version of the document where I think I have taken over all your suggestions.

DEVELOPER GUIDELINES ON SEMANTIC TAGS MERGED.docx

@andrewfg
Copy link
Contributor

andrewfg commented Mar 10, 2025

@rkoshak are you happy with the revised version of the word document? If so then the next steps would be:

  1. I shall transfer the contents of the word document to Improve developer information on semantic tags openhab-docs#2466 .. probably in form of separate chapters for developers who use existing tags, and maintainers or developers concerning creation of new tags.
  2. Someone (you?, @jimtng?, me?) should start to interpret this document to make a PR for a clean up of the existing set of tags.

Is that OK?


EDIT: I already did part 1. of the above here so perhaps instead of reviewing the word document you can review the respective PR instead?

andrewfg added a commit to andrewfg/openhab-docs that referenced this issue Mar 10, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@rkoshak
Copy link
Author

rkoshak commented Mar 11, 2025

Sorry for the delay. I'm rarely at a computer where I can easily review a Word document over the weekends. I'll go over and review the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

No branches or pull requests

3 participants