HADashboaed help

hello my friends

I just start working on my home assistant

I add 1 switch to my home using mqtt

I try to add this switch to my HADashborad but I don’t know how I use this code

   #
# Main arguments, all optional
#
title: Main Panel
widget_dimensions: [120, 120]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 8

    Bedroom Switch:
        widget_type: switch
        title: Bedroom Switch
        entity: switch.Bedroom_Switch
        icon_on: fa-car
        icon_off: fa-car
        

    layout:
     -Bedroom Switch(1x1)    

this is the code for the switch on hassio config

switch:
  - platform: mqtt
    name: "Bedroom Switch"
    state_topic: "tamirhome/switch1/set"
    command_topic: "tamirhome/switch1/set"
    payload_on: "ON"
    payload_off: "OFF"
    qos: 1
    retain: false 

this is what I get on my dashboard

can some one help me to set a switch on hadashborad ?

Hi,

As in HA I don’t think you can have CAPs in entity names so…

bedroom_switch:
    widget_type: switch
    title: Bedroom Switch
    entity: switch.bedroom_switch
    icon_on: fa-car
    icon_off: fa-car

layout:
  -bedroom_switch(1x1)
1 Like

in HA use the developers tools and then states to find your existing entities.
the switch is or not setup right in HA and doesnt exist there or it has a different name then you expect.

that is on my States

can you help me fix the code that it will work on dashboard ?

i think that @keithh666 already gave the answer.

  1. entitie names are in lower case only
  2. dont use spaces in the switch name.

in general, dont use spaces or capitals except in friendly (GUI) names :wink:

I fix the code and the switch don’t show ,what I see it that
what is "widget definition not found"??
on the first install it work and I see “Hello world” on the dashboard ,I play on the code and now I have this !

Does ctrl-f5 help? have you restarted appdeamon, how come you have 10 widgets and only 1 thing defined in main panel?

Do not know something went wrong the moment I touched the code
new file show on appdeamon call compiled

I try to fix that no result ,do you know ?

your dashboard file is all wrong.
its a yaml type file.
so you need to look at your indentions.

no extra spaces in front of the widget name
no extra spaces in fron of layout
all indentions need to be the same
so: 2 spaces in front of widget_type, etc. 2 spaces in front of the line beneath layout
always 1 space behind every - and :

1 Like

you can show me a simply code to dashboard that work with Mqtt switch?

I need to see a simply code to understand the logic of dashboard

note:
maybe I don’t have Widget definition library?

I add clock and relord but I cant add simple switch why I get widget not definition

read back. the answers are already given!!

1 Like

There is no difference between a ‘normal’ switch and an ‘mqttt switch’ to HA Dashboard, regardless of which switch you are adding the main.yaml file has to be correctly formatted as Rene said earlier.

You don’t need this at all…

bedroom_switch:
    widget_type: switch
    title: Bedroom Switch
    entity: switch.bedroom_switch
    icon_on: fa-car
    icon_off: fa-car

Just…

layout:
  - switch.bedroom_switch(1x1)
1 Like

that work thanks ,what if I like to add custom icon or widget how I do that

No idea I don’t currently use any, but see here…

http://appdaemon.readthedocs.io/en/latest/DASHBOARD_CREATION.html

keith has given you the right way to do it TWICE!
but you need to learn YAML first!!
you cant do anything with HA or the dashboard if you dont know what to do in YAML.