Custom widget help, blank

hey guys, i wanted to make a custom widget based off of an existing one. The widget loads and compiles but is blank square, i cant seem to find out why or where to look for trouble.

Im not sure i set logging up correctly, i dont see anything in the file. AD add-on log not throwing any error. Chrome console not throwing any error. Tried reboot countless times, clearing cache with dash closed on all devices. I went though other posts with same issue and tried suggestions, its entirely possible i missed something, well obviously. any help or pointer much appreciated! thank you!

hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards
  dash_force_compile: 1
  accessfile: /config/appdaemon/logs/dash_access.log

i also tried /var/log/dash_access but dont see it created when i check from terminal, making sure either folder was created and a reboot of hass.io

the widget is based off the ā€œbasealarmā€ from github. iā€™ve renamed thinking a conflict with existing base name. so i called it ā€œbasemattā€ and matt.yaml

in:

config/appdaemon/custom_widgets/
                               matt.yaml
config/appdaemon/custom_widgets/basematt/
                               basematt.css
                               basematt.html
                               basematt.js

i went though css/js/html rename any ā€œbasealarmā€ to ā€œbasemattā€

start of matt.yaml:

widget_type: basematt
entity: "{{entity}}"

Dashboard:

#
# Main arguments, all optional
#
title: Status
widget_dimensions: [121, 122]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 10
rows: 6
global_parameters:
    use_comma: 0
    precision: 0
    use_hass_icon: 1
alarm:
  widget_type: basematt
  entity: alarm_control_panel.home_alarm
# Layout
#
layout:
    - alarm(5x3)

AD log from add-ons

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: AppDaemon
 Python Apps and HADashboard using AppDaemon 3.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 4.0.1
 You are running the latest version of this add-on.
 System: HassOS 2.12  (amd64 / qemux86-64)
 Home Assistant version: 0.96.5
 Supervisor version: 170
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing... 
[18:53:33] INFO: Updating Hass.io API token in AppDaemon with the current one...
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[18:53:33] INFO: Starting AppDaemon...
2019-07-29 18:53:34.489940 INFO AppDaemon Version 3.0.5 starting
2019-07-29 18:53:34.490189 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-07-29 18:53:34.491353 INFO AppDaemon: Starting Apps
2019-07-29 18:53:34.495464 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-07-29 18:53:34.618552 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-07-29 18:53:34.618925 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-07-29 18:53:34.619153 INFO Starting Dashboards
2019-07-29 18:53:34.624889 INFO API is disabled
2019-07-29 18:53:34.630130 INFO AppDaemon: HASS: Connected to Home Assistant 0.96.5
2019-07-29 18:53:34.656945 INFO AppDaemon: Got initial state from namespace default
2019-07-29 18:53:36.651268 INFO AppDaemon: Reading config
2019-07-29 18:53:36.652727 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-07-29 18:53:36.652844 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-07-29 18:53:36.652951 INFO AppDaemon: App 'hello_world' added
2019-07-29 18:53:36.653108 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-07-29 18:53:36.653367 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2019-07-29 18:53:36.658861 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2019-07-29 18:53:36.734585 INFO hello_world: Hello from AppDaemon
2019-07-29 18:53:36.735519 INFO hello_world: You are now ready to run Apps!
2019-07-29 18:53:36.735988 INFO AppDaemon: App initialization complete
2019-07-29 18:53:55.563125 INFO Compiling dashboard 'Status'
2019-07-29 18:53:55.661411 INFO Loading custom widget 'matt.yaml'
2019-07-29 18:53:55.661570 INFO Loading custom widget 'basematt'
2019-07-29 18:53:55.750016 INFO function [get_dashboard] finished in 187 ms

aw crap, chrome console is throwing errors i didnt catch. im not an expert by any means, does this mean i should be looking for problems in basematt.js? thanks!

jquery-3.1.1.min.js:2 jQuery.Deferred exception: Cannot convert undefined or null to object TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at basematt.WidgetBase (http://192.168.3.222:5050/javascript/dashboard.js:261:12)
    at new basematt (http://192.168.3.222:5050/compiled_javascript/application.js:2591:16)
    at HTMLDocument.<anonymous> (http://192.168.3.222:5050/compiled_javascript/default/status_init.js:31:36)
    at j (http://192.168.3.222:5050/javascript/jquery-3.1.1.min.js:2:29948)
    at k (http://192.168.3.222:5050/javascript/jquery-3.1.1.min.js:2:30262) undefined

The widget_type should be the same as the name of your yaml file, in this case:

alarm:
  widget_type: matt  # not basematt
  entity: alarm_control_panel.home_alarm

Thanks! When i changed that i get:

500 Internal Server Error
Server got itself in trouble

interestingly when it was ā€œbasemattā€ the dash loaded but empty. if i use something that doesnt exist say "widget_type: fakematt " the dash loads and has the expected message ā€œUnable to find widget type ā€˜fakemattā€™ā€.

Im going to start over creating the custom widget as i think i boogered something up somewhere.

Unfortunately, I still get the 500 Internal Server Error. I checked for tabs in yaml file and not sure what to do from here. AD log has a bunch of new info.

2019-07-30 01:24:55.556428 INFO Compiling dashboard 'Status'
2019-07-30 01:24:55.652037 WARNING ------------------------------------------------------------
2019-07-30 01:24:55.652146 WARNING Unexpected error during DASH creation
2019-07-30 01:24:55.652244 WARNING ------------------------------------------------------------
2019-07-30 01:24:55.652774 WARNING Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 318, in _load_widget
    final_widget = yaml.load(yaml_file, Loader=yaml.SafeLoader)
  File "/usr/lib/python3.7/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3.7/site-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3.7/site-packages/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 23, column 3:
      title: """"
      ^
expected <block end>, but found '<scalar>'
  in "<unicode string>", line 23, column 12:
      title: """"
               ^
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 818, in get_dashboard
    dash = self._conditional_compile(name, skin, recompile)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 770, in _conditional_compile
    dash = self._get_dash(name, skin, skindir)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 573, in _get_dash
    dash = self._create_dash(name, css_vars)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 455, in _create_dash
    dash, layout, occupied, includes = self._create_sub_dash(name, "dash", 0, {}, [], 1, css_vars, None)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 545, in _create_sub_dash
    self._add_layout(lay, layout, occupied, dash, page, includes, css_vars, global_parameters)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 429, in _add_layout
    widget["parameters"] = self._load_widget(dash, includes, name, css_vars, global_parameters)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 320, in _load_widget
    _log_error(dash, name, "Error in widget definition '{}':".format(widget_type))
NameError: name '_log_error' is not defined
2019-07-30 01:24:55.652889 WARNING ------------------------------------------------------------
2019-07-30 01:24:55.653039 INFO function [get_dashboard] finished in 96 ms
Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 416, in start
    resp = yield from self._request_handler(request)
  File "/usr/lib/python3.7/site-packages/aiohttp/web.py", line 325, in _handle
    resp = yield from handler(request)
  File "/usr/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 93, in impl
    return (yield from handler(request))
  File "/usr/lib/python3.7/site-packages/appdaemon/rundash.py", line 51, in wrapper
    return await myfunc(*args)
  File "/usr/lib/python3.7/site-packages/appdaemon/rundash.py", line 269, in load_dash
    return web.Response(text=response, content_type="text/html")
  File "/usr/lib/python3.7/site-packages/aiohttp/web_response.py", line 471, in __init__
    type(text))
TypeError: text argument must be str (<class 'dict'>)

the server 500 error will go away if i rename the custom_widget\basematt folder to just matt, along with the html/js/css to just matt.ext. replacing basematt with matt within the files lets
the dash loads but is an empty widget inside.

Removing ā€˜baseā€™ part come from referencing another post. The solution in that one was to recompile dash which i believe iā€™ve done so already by adding to appdaemon.yaml and trying http:hassio:5050/Status?recompile=1.

I feel like im missing something its probably right under my nose.:face_with_monocle:

500 means something is wrong with your code. Please post the widget files so we can have a look.

thanks! I appreciate it! I dont see that I can attach files so here is copy and paste.

/config/appdaemon/
-appdeamon.yaml

/config/appdaemon/dashboards/
-Status.dash

/config/appdaemon/custom_widgets/
-matt.yaml

/config/appdaemon/custom_widgets/basematt/
-basematt.js
-basematt.css
-basematt.html

logs:
-dash_log.log (appdaemon)
-dash_errors.log (empty)
-dash_access.log

# /config/appdeamon/appdaemon.yaml
secrets: /config/secrets.yaml
log:
  logfile: /config/appdaemon/logs/dash_log.log
  accessfile: /config/appdaemon/logs/dash_access.log
  errorfile: /config/appdaemon/logs/dash_errors.log
appdaemon:
  threads: 10
  disable_apps: 0
  app_dir: /config/appdaemon/apps
  plugins:
    HASS:
      type: hass
      ha_url: http://hassio/homeassistant
      token: redacted
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards
  dash_force_compile: 1
  accessfile: /var/log/dash_access.log
  dash_compile_on_start: 1
dash_force_compile: 1
# /config/appdaemon/dashboards/Status.dash
##
## Main arguments, all optional
##
title: Hello
widget_dimensions: [120, 120]
widget_margins: [5, 5]
columns: 8

mattgit:
    widget_type: matt
    entity: alarm_control_panel.home_alarm

# Layout
#
layout:

    - mattgit(2x2)
## /config/appdaemon/custom_widgets/matt.yaml
widget_type: basematt
entity: "{{entity}}"
initial_string: "Enter Code"
post_service_ah:
    service: alarm_control_panel/alarm_arm_home
    entity_id: "{{entity}}"
post_service_aa:
    service: alarm_control_panel/alarm_arm_away
    entity_id: "{{entity}}"
post_service_da:
    service: alarm_control_panel/alarm_disarm
    entity_id: "{{entity}}"
post_service_tr:
    service: alarm_control_panel/alarm_trigger
    entity_id: "{{entity}}"
state_map:
  pending: Pending
  armed_home: Armed Home
  armed_away: Armed Away
  disarmed: Disarmed
  triggered: Triggered
fields:
  title: "{{title}}"
  title2: "{{title2}}"
  state: ""
  code: ""
static_css:
  title_style: $alarm_title_style
  title2_style: $alarm_title2_style
  state_style: $alarm_state_style
  widget_style: $alarm_widget_style
  panel_state_style: $alarm_panel_state_style
  panel_code_style: $alarm_panel_code_style
  panel_background_style: $alarm_panel_background_style
  panel_button_style: $alarm_panel_button_style
css: []
icons: []
static_icons: []
# /config/appdaemon/custom_widgets/basematt/basematt.js
function basematt(widget_id, url, skin, parameters)
{
    // Will be using "self" throughout for the various flavors of "this"
    // so for consistency ...
    
    self = this
    
    // Initialization
    
    self.widget_id = widget_id

    // Parameters may come in useful later on
    
    self.parameters = parameters
       
    self.OnButtonClick = OnButtonClick
    self.OnCloseClick = OnCloseClick
    self.OnDigitClick = OnDigitClick
    self.OnArmHomeClick = OnArmHomeClick
    self.OnArmAwayClick = OnArmAwayClick
    self.OnDisarmClick = OnDisarmClick
    self.OnTriggerClick = OnTriggerClick
    
    
    var callbacks =
        [
            {"selector": '#' + widget_id + ' > span', "action": "click", "callback": self.OnButtonClick},
            {"selector": '#' + widget_id + ' #close', "action": "click", "callback": self.OnCloseClick},
            {"selector": '#' + widget_id + ' #0', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "0"}},
            {"selector": '#' + widget_id + ' #1', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "1"}},
            {"selector": '#' + widget_id + ' #2', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "2"}},
            {"selector": '#' + widget_id + ' #3', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "3"}},
            {"selector": '#' + widget_id + ' #4', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "4"}},
            {"selector": '#' + widget_id + ' #5', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "5"}},
            {"selector": '#' + widget_id + ' #6', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "6"}},
            {"selector": '#' + widget_id + ' #7', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "7"}},
            {"selector": '#' + widget_id + ' #8', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "8"}},
            {"selector": '#' + widget_id + ' #9', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "9"}},
            {"selector": '#' + widget_id + ' #BS', "action": "click", "callback": self.OnDigitClick, "parameters": {"digit" : "BS"}},
            {"selector": '#' + widget_id + ' #AH', "action": "click", "callback": self.OnArmHomeClick},
            {"selector": '#' + widget_id + ' #AA', "action": "click", "callback": self.OnArmAwayClick},
            {"selector": '#' + widget_id + ' #DA', "action": "click", "callback": self.OnDisarmClick},
            {"selector": '#' + widget_id + ' #TR', "action": "click", "callback": self.OnTriggerClick},
                
        ]
 
    // Define callbacks for entities - this model allows a widget to monitor multiple entities if needed
    // Initial will be called when the dashboard loads and state has been gathered for the entity
    // Update will be called every time an update occurs for that entity
     
    self.OnStateAvailable = OnStateAvailable
    self.OnStateUpdate = OnStateUpdate
    
    if ("entity" in parameters)
    {
        var monitored_entities = 
            [
                {"entity": parameters.entity, "initial": self.OnStateAvailable, "update": self.OnStateUpdate}
            ]
    }
    else
    {
        var monitored_entities =  []
    }
    // Finally, call the parent constructor to get things moving
    
    WidgetBase.call(self, widget_id, url, skin, parameters, monitored_entities, callbacks)  

    self.set_view = set_view
    
    // Function Definitions
    
    // The StateAvailable function will be called when 
    // self.state[<entity>] has valid information for the requested entity
    // state is the initial state
    // Methods

    function OnStateAvailable(self, state)
    {    
        self.set_field(self, "state", self.map_state(self, state.state))
    }
 
    function OnStateUpdate(self, state)
    {
        self.set_field(self, "state", self.map_state(self, state.state))
    }  

    function OnButtonClick(self)
    {
        self.code = self.parameters.initial_string
        self.set_view(self)

        $('#' + widget_id + ' > #Dialog').removeClass("modalDialogClose")
        $('#' + widget_id + ' > #Dialog').addClass("modalDialogOpen")
    }

    function OnCloseClick(self)
    {
        $('#' + widget_id + ' > #Dialog').removeClass("modalDialogOpen")
        $('#' + widget_id + ' > #Dialog').addClass("modalDialogClose")
    }

    function OnDigitClick(self, parameters)
    {
        if (parameters.digit == "BS")
        {
            if (self.code != self.parameters.initial_string)
            {
                if (self.code.length == 1)
                {
                    self.code = self.parameters.initial_string
                }
                else
                {
                    self.code = self.code.substring(0, self.code.length - 1);
                }
            }
        }
        else
        {
            if (self.code == self.parameters.initial_string)
            {
                self.code = parameters.digit
            }
            else
            {
                self.code = self.code + parameters.digit
            }
        }
        self.set_view(self)
    }
    
    function OnArmHomeClick(self)
    {
        
        args = self.parameters.post_service_ah
        args["code"] = self.code
        self.call_service(self, args)
        
        self.code = self.parameters.initial_string
        self.set_view(self)
    }
    
    function OnArmAwayClick(self)
    {
        args = self.parameters.post_service_aa
        args["code"] = self.code
        self.call_service(self, args)
        
        self.code = self.parameters.initial_string
        self.set_view(self)
    }
    
    function OnDisarmClick(self)
    {
        args = self.parameters.post_service_da
        args["code"] = self.code
        self.call_service(self, args)
        
        self.code = self.parameters.initial_string
        self.set_view(self)
    }
    
    function OnTriggerClick(self)
    {
        args = self.parameters.post_service_tr
        args["code"] = self.code
        self.call_service(self, args)

        self.code = self.parameters.initial_string        
        self.set_view(self)
    }
    
    function set_view(self)
    {
        self.set_field(self, "code", self.code)
    }
}
# /config/appdaemon/custom_widgets/basematt/basematt.css

/*noinspection ALL*/
.widget-basematt-{{id}}  .state {
	display: inline-block;
	vertical-align: middle;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .title {
	position: absolute;
	top: 5px;
	width: 100%;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .title2 {
	position: absolute;
	top: 23px;
	width: 100%;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .code {
	width: 100%;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .toggle-area {
	z-index: 10;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .container {
    width: 275px;
    display: inline-block;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .panel-state {
    font-size: 100%;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .block {
    display: inline-block;
    width: 75px;
    height: 75px;
    margin: 5px;
    float: top;
    font-size: 175%;
    text-align: center;
    vertical-align: middle;
    line-height: 75px; 
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .block2 {
    width: 165px;
}

/*noinspection ALL*/
.widget-basematt-{{id}}  .block3 {
    width: 255px;
}
# /config/appdaemon/custom_widgets/basematt/basematt.html (no changes)
<span class="toggle-area" id="switch"></span>
<h1 class="title" data-bind="text: title, attr:{ style: title_style}"></h1>
<h1 class="title2" data-bind="text: title2, attr:{ style: title2_style}"></h1>
<h2 class="value" data-bind="text: state, attr:{ style: state_style}"></h2>
<div id="Dialog" class="modalDialog">
<div data-bind="attr:{style: panel_background_style}">
<h2 id="close" class="modalDialogCloseButton">X</h2>
<h2 class="panel-state" data-bind="text: state, attr:{style: panel_state_style}"></h2>
<h2 class="panel-state" data-bind="text: code, attr:{style: panel_code_style}"></h2>
<div class="container">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="1">1</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="2">2</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="3">3</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="4">4</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="5">5</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="6">6</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="7">7</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="8">8</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block" id="9">9</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block block2" id="0">0</span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block mdi mdi-keyboard-backspace" id="BS"></span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block mdi mdi-home" id="AH" ></span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block mdi mdi-home-outline" id="AA"></span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block fa fa-power-off" id="DA"></span class="block">
    <span data-bind="attr:{style: panel_button_style}" class="block block3" id="TR">Trigger</span class="block">
</div>
</div>
</div>
# dash_log
2019-07-30 20:33:08.917402 INFO AppDaemon Version 3.0.5 starting
2019-07-30 20:33:08.917725 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-07-30 20:33:08.917872 DEBUG AppDaemon Section: None
2019-07-30 20:33:08.918024 DEBUG HADashboard Section: None
2019-07-30 20:33:08.919170 INFO AppDaemon: Starting Apps
2019-07-30 20:33:08.919998 DEBUG AppDaemon: Creating worker threads ...
2019-07-30 20:33:08.922209 DEBUG AppDaemon: Done
2019-07-30 20:33:08.922364 DEBUG AppDaemon: Entering run()
2019-07-30 20:33:08.923119 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-07-30 20:33:09.043620 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-07-30 20:33:09.044004 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-07-30 20:33:09.044205 DEBUG AppDaemon: Starting utility loop
2019-07-30 20:33:09.044389 INFO Starting Dashboards
2019-07-30 20:33:09.050129 INFO API is disabled
2019-07-30 20:33:09.050309 DEBUG Start Loop
2019-07-30 20:33:09.055551 INFO AppDaemon: HASS: Connected to Home Assistant 0.96.5
2019-07-30 20:33:09.061040 DEBUG AppDaemon: HASS: get_ha_config()
2019-07-30 20:33:09.061219 DEBUG AppDaemon: HASS: get_ha_config: url is http://hassio/homeassistant/api/config
2019-07-30 20:33:09.075539 DEBUG AppDaemon: HASS: get_ha_state: url is http://hassio/homeassistant/api/states
2019-07-30 20:33:09.081290 DEBUG AppDaemon: HASS: Got state
2019-07-30 20:33:09.081880 INFO AppDaemon: Got initial state from namespace default
2019-07-30 20:33:11.074186 DEBUG AppDaemon: Starting timer loop
2019-07-30 20:33:11.074430 DEBUG AppDaemon: Reading Apps
2019-07-30 20:33:11.075230 INFO AppDaemon: Reading config
2019-07-30 20:33:11.075481 DEBUG AppDaemon: Reading /config/appdaemon/apps/apps.yaml
2019-07-30 20:33:11.076762 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-07-30 20:33:11.076936 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-07-30 20:33:11.077092 INFO AppDaemon: App 'hello_world' added
2019-07-30 20:33:11.077301 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-07-30 20:33:11.077553 DEBUG AppDaemon: Found module /config/appdaemon/apps/hello.py
2019-07-30 20:33:11.077737 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2019-07-30 20:33:11.083929 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2019-07-30 20:33:11.160751 INFO hello_world: Hello from AppDaemon
2019-07-30 20:33:11.161777 INFO hello_world: You are now ready to run Apps!
2019-07-30 20:33:11.162308 INFO AppDaemon: App initialization complete
2019-07-30 20:33:11.163420 DEBUG AppDaemon: Util loop compute time: 0.0ms
2019-07-30 20:33:12.001348 DEBUG AppDaemon: Scheduler loop compute time: 0.0ms
# dash_access.log
2019-07-30 20:33:11.359312 INFO Compiling dashboard 'Status'
2019-07-30 20:33:11.462322 WARNING ------------------------------------------------------------
2019-07-30 20:33:11.462518 WARNING Unexpected error during DASH creation
2019-07-30 20:33:11.462652 WARNING ------------------------------------------------------------
2019-07-30 20:33:11.464552 WARNING Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 318, in _load_widget
    final_widget = yaml.load(yaml_file, Loader=yaml.SafeLoader)
  File "/usr/lib/python3.7/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3.7/site-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3.7/site-packages/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 23, column 3:
      title: """"
      ^
expected <block end>, but found '<scalar>'
  in "<unicode string>", line 23, column 12:
      title: """"
               ^

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 818, in get_dashboard
    dash = self._conditional_compile(name, skin, recompile)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 770, in _conditional_compile
    dash = self._get_dash(name, skin, skindir)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 573, in _get_dash
    dash = self._create_dash(name, css_vars)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 455, in _create_dash
    dash, layout, occupied, includes = self._create_sub_dash(name, "dash", 0, {}, [], 1, css_vars, None)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 545, in _create_sub_dash
    self._add_layout(lay, layout, occupied, dash, page, includes, css_vars, global_parameters)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 429, in _add_layout
    widget["parameters"] = self._load_widget(dash, includes, name, css_vars, global_parameters)
  File "/usr/lib/python3.7/site-packages/appdaemon/dashboard.py", line 320, in _load_widget
    _log_error(dash, name, "Error in widget definition '{}':".format(widget_type))
NameError: name '_log_error' is not defined

2019-07-30 20:33:11.464696 WARNING ------------------------------------------------------------
2019-07-30 20:33:11.464891 INFO function [get_dashboard] finished in 105 ms

.
500 Internal Server Error
Server got itself in trouble

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The problem is in your matt.yaml file. You should not use quotes here, it should be like:

entity_id: {{entity}}  # Dont use quotes.

Also check that you do not have any tabs in the files, only spaces are allowed. It looks like you have tabs in the indentation for the post_services sections.

The .html, .css and .js files looks fine.

I mean no tabs in the yaml file.

Same with the

fields:
  title: "{{title}}"
  title2: "{{title2}}"

which should be

fields:
  title: {{title}}   # No quotes
  title2: {{title2}}

OMG you are the bomb :bomb:. It was the quotes on title and title2!
Iā€™ve confirmed the yaml files do not have tabs by using notepad++ view>symbols>white space and tabs.

I noticed the error log pointing to title last night but didnt think twice about the quotes because of comparing to other posts (and github). I tried adding titles removing the title trying to fumble through, sounds like i need yaml 101 :blush:

Im puzzled why are the quotes are there in the first place coming from github. Also referencing another post on a custom_widget, their yaml has the quotes also.

Maybe an update by design? or very likely I need to learn the fundamentals of yaml and appdeamon ā€“ I am a happy camper. this is a great learning experience for me and thank you for taking the time to help me out!

1 Like

You are welcome.
If there are errors in the docs, we should ask @ReneTode to fix this if he has time. (I referenced another @rene by mistake earlier in my post, sorry for this.)

Yes, yaml is quite unforgiving regarding syntax. Regarding the 500 error code, you will also get this if a css mapping is missing from your custom css files, i.e. if you are referencing a non-existing css entry in the variables.yaml file in your matt.yaml file in the static css section.

I would recommend either vs code or atom https://atom.io/ as an editor. vs code https://code.visualstudio.com/download has an addon for Home Assistant which makes editing much easier. Works on Windows, Mac and most Linux distros such as Ubuntu.

1 Like

:exploding_head: Wow! those look seriously cool. Iā€™m currently downloading both to try. Thanks!
-exits the dark age-

there are no errors in the docs i think, but the error is that @mattch looks at the wrong place.
in AD 3.0 there are no quotes, but in the dev version from AD (4) there are quotes.

so if you copy from dev in github, you get quotes.
the docs https://appdaemon.readthedocs.io/en/latest/
have the right info for AD 3.0

I see that now, being the dev branch instead of master branch.
I will try to pay closer attention to details like that.

For the sake of letting my noobness shine, on the Docs if i switch to DEV and check out devwidgets i dont see the quote on title.

I know that means my post could have been avoided if i RTFM, but also want to bring it up in case it needs to be updated. if its in the works and aware already i apologize.

PS @tjntomas Iā€™ve fallin in love with VS Code with the hass addon installed. Also the hassio add-in for vs code is stellar for when im away.

1 Like