Multiple entities custom widget

Hi!

Trying to put several scenes triggers/switches into one widget as shown on mockup:

Tried to reverse engineering the scene and heater widgets :slight_smile: , but totally lost.
Can somebody help?

My dashboard entry should be look something like this:

  widgetswitch:
    widget_type: scenex
    widget_style: "background-color: #2e4226"
    title_style:
    title2_style:
    entity: scene.switch
    icon_on: 
    icon_off:
    icon_style_active:
    icon_style_inactive:
    entity1: scene.switch1
    icon1_on:
    icon1_off:
    icon1_style_active:
    icon1_style_inactive:    
    entity2: scene.switch2
    icon2_on:
    icon2_off:
    icon2_style_active:
    icon2_style_inactive:    
    entity3: scene.switch3
    icon3_on:
    icon3_off:
    icon3_style_active:
    icon3_style_inactive:    
    entity4: scene.switch4
    icon4_on:
    icon4_off:
    icon4_style_active:
    icon4_style_inactive:

thats very hard to do for a custom widget that we dont know.
do you have a link to the custom widget?
did you copy the custom widget to the right place? with the right filerights?
do you get errors?
is there any kind of description?
leaving things empty after a : is most of the times a bad idea.
if its written correct then those lines are not needed.

Rene, there’s no such widget) I’m trying to make one.
Looking for some examples how I can add additional switch toggle to corner of the exist widget with additional entity_id.

it’s just an example/skeleton, of course it will come with icon/style definitions…

first you need to create a working custom widget. (for instance by copying an existing one and modifying it.)
then you can start to change it.

but you really need to know your way around in programming javascript, css and html
you can compare the base_heater with base_switch files.

base_switch has only 1 entity, base_heater has 2 entities.

the problem is that a widget like that isnt that usefull in most cases.
you need at least the space from four widgets to make it workable (or else the toucharea would be to small)
so you could also use 4 widgets to do the trick.

That’s done.

That’s true but I don’t understand how to use post_service_active/inactive for different entities when the service is the same service.

post_service_active:
    service: homeassistant/turn_on
    entity_id: {{entity}}
post_service_inactive:
    service: homeassistant/turn_off
    entity_id: {{entity}}

Useful or not it depends)
For my setup heater is absolutely useless, but I’m not stating that it isn’t useful for others)

4 widgets can work but it’s ugly, same as having 4 widgets for the heater (temperature sensor, fan, minus and plus buttons for the temperature)

In my setup I want to use for example big button (2x2) to turn on/off the tv, and the small buttons/icons in the corners will control tv input (usually no need to change, only sometimes) so it will accessible but not taking too much extra space.

i meant it isnt usefull like it wont be workable unless you set the size to 2x2
and then you can use 4 widgets which takes the same place and just configere it so that they look as 1 widget.


this is 1 of my dashboards but i didnt create 1 widget that has 15 entities :wink:

the services that are in the yaml file are called in the functions from the javascript file

in the switch widget it is like this:

        if (self.state == self.parameters.state_active)
        {
            args = self.parameters.post_service_inactive
        }
        else
        {
            args = self.parameters.post_service_active
        }
        self.call_service(self, args);

but you need to connect the function to an event and a location
and you need to data bind the styles and values to that same location.

Still, the idea is one big “main” trigger (often use, common/standard scene) and several small (not often use, advanced entities). I started a repository, tried to put additional entity as I saw in baseheater, but no luck, the icon updating on both buttons:

image

The repository is: https://github.com/radinsky/scenex

Do you have any idea how to separate entity and entity1?

you need to set extra callbacks which you connect to
you need to use different functions for different entities
you need to change the set_view.

you need to understand what the javascript does, or else it would be a very difficult process.

by the way, the best way to learn how to create custom widgets is by following the instructions from the one who created the dashboard program.
he did a hell of a job writing instructions down.

so you might want to read through the docs and figure it out that way.
https://appdaemon.readthedocs.io/en/dev/WIDGETDEV.html

it probably answers more questions then i can :wink:

Can you tell me how to nest more widgets inside one as you show in this picture? Do i need a custom widget ? Where to find examples?

at the moment it is not possible to nest more widgets inside 1.
i adchieved that by creating a background picture.

Ok, thanks…