OH3 Create switch using dimmer

Hey all, I’ve been using OH2 for a while and have finally decided to move to OH3. I decided to start from scratch so I spun up a fresh Ubuntu server and did a clean install of OH3. So far I’ve been able to create my model and add my equipment. I haven’t started on pages yet so for the moment I’m just using the location cards. I use Insteon for my lighting and I have control over my lights from within the cards on the ‘Locations’ tab, no problem.

By default the dimmer switches are added as dimmers which is fine, that’s what they are. But I’d like have simple toggles to just turn them on and off without having to mess with the slider. I thought I could have both by adding the dimmer point again and using metadata to change it to a toggle. All that would do is change the exiting point, not add it again. (Can you add the same point to the same location twice?) Then I tried to simply change the slider to a toggle, but that exhibited weird behavior. On the Settings > Model page, it would change to a toggle, but the Location card stayed a slider and continued to work as a slider.

Is it possible to have the card show a simple toggle in front of the slider? That would be my ideal outcome, but I don’t know if it’s possible on the location card. (Maybe it can be done in pages, but I haven’t gotten that far yet.) Barring that, how can I change the card to simply show a toggle INSTEAD of the slider? 90% of the time all I want to do it turn them on and off like I used to do in OH2, but it would be nice to have both options.

Thanks in advance,

~Mark

No. A point is just an item and location and equipment are just groups. So the same item cannot be part of a single group more than once, it either is a member or is not.

Yes. You can create any combination of widgets you want and then assign those widgets as the default display for an item. There is a whole section of the getting started tutorials that covers this in detail:

If you aren’t ready to build your own custom widgets yet, then the next easiest solution here is probably just to create a second item. You can link more than one item to a channel and a dimmer channel can have a switch item linked to it. When you add that switch item to the model as a switch point it will have a toggle in all the model displays. If you have both of them as part of the same dimmer equipment then you will see both options on the model:

image

If you are moving from OH2, have you considered moving directly to OH4? I’ve been using OH4 with Insteon for a few months now and it’s been very stable for me.

When you create items, you can select the type. It will default to “Dimmer”, but you can change it to “Switch”

I want to elaborate a little on this for future readers of the forum.

Everything said here is absolutely correct. However, what if I cheat? What if I put the Item directly under a Location and then also add it to an Equipment under that Location. That would kind of put the same Point in the same Location without requiring the Point appear as a member of the Location Group twice thanks to the intervening Equipment Group.

But this too would not work because there is an additional constraint in that no entity in the semantic model can appear in the model more than once.

It also wouldn’t address the problem because everything used to configure how that one single Item appears there is stored on the Item. So even if it did work, it’d have that same slider widget in both places.

It’s true this won’t work at all in this case, but there are specific exceptions to this rule. For example, a temperature point can be added to an equipment group and that equipment’s location group at the same time. This allows the model to know which of possibly many temperature points in a location represents the actual environmental temperature and not some set point or other temperature. There are one or two other exceptions if I recall but I don’t remember what they are.

1 Like

Hey guys, thanks for the replies. I figured Pages would be the answer, but I was hoping there might be a solution for the location cards. And just curious too. For now I’ll focus on the semantic model and use the location cards as a stepping stone to Pages.

I see that 4.0 is on the way, but after many, MANY years in IT I’ve learned not to be in a hurry to jump on the latest release. 3.4.X looks to be stable and so far everything I’ve wanted to automate either has bindings in the market or available on github. It looks like the move to Java 17(?) is causing some issues for certain bindings, and I’d rather not deal with that while I’m getting my head around setting up the model the way i want. The move from 2.x to 3.x was a pretty big paradigm shift, so I wanted to start from scratch and see if I could do it all without config files. (Great though they are.) By the time I get my head around semantic classes and properties, metadata and Blockly, 4.0 should be ready and hopefully all the bindings I use will be updated. My hope is that upgrading from 3.x to 4.x should be relatively easy. (Famous last words, I know.)

Thanks again,

~Mark

It may not have been clear but there is a solution for the location cards. If you set the “default list item widget” metadata on the Item, that’s the widget that will be shown on the Location card. But that’s going to require you to configure/create a custom UI widget.

The move to OH 4 is less so.

Thanks Rich! I know there are custom widgets for pages, I assumed that’s what we were referring to. If I get ambitious I’ll look into it for the location cards, but at that point I’ll probably be ready to start creating pages.

I’ve been lurking around the 4.x milestone thread, sounds like the path from 3.x should be relatively smooth.

I’m glad you’re still kicking around. You’ve been answering my questions since I started on 1.8! I’m really digging what 3.x has to offer. I’m looking forward to getting my head around it moving from the ‘fancy remote control’ I had in 2.x to a ‘real’ smart home with true automation in 3.x.

Thanks again,

~Mark

1 Like

We are all glad Rich is still ‘kicking around’
Koshak for president of earth!

1 Like

I’ll second the motion.

2 Likes

OK! I somewhat accidentally figured out how to solve my switch/dimmer problem! I’ve been playing with the semantic class and property, and by setting the Class to Switch and the Property to Light, low and behold I have a toggle in the Location card! If I want the dimmer back, I just change the Class to Control and leave the Property set to Light! I thought I could only change the control with the metadata.

It’s interesting that for the the thermostat temperature, I changed the metadata ‘Default List Item Widget’ to ‘Stepper List Item’ and the card changed to a logical plus/minus control. To change the control for the light, I had to change the semantic class to change the card control. I would say this isn’t very intuitive, but there could be a very good reason that I’m simply not aware of yet.

Rich, if you can grace us with your infinite wisdom, I’d sure appreciate it!

Thanks,

~Mark

Indeed there is some limited use of the semantic model when choosing the default widget for an Item. But it’s often not perfect. I don’t think it’s documented anywhere what Point/Property combos result in which widgets being used.

That’s to be expected. That’s what a stepper widget is.

You could have set the default list item widget there too. Whatever that metadata is, if it’s present, will take precedence over everything else.

If you don’t supply a default widget, a default will be selected for you based on the Item type and the semantic tags.

Thanks Rich, that makes sense. It’s good to know that metadata wins in the event of a face off.

Thanks,

~Mark