hassio-addons / addon-appdaemon

AppDaemon4 - Home Assistant Community Add-ons
https://addons.community
MIT License
149 stars 46 forks source link

ESPHome Button Template throws error in dashboard #257

Closed CestLaGalere closed 1 year ago

CestLaGalere commented 1 year ago

Problem/Motivation

(Why the issue was filed) I have a number of ESPHome projects, up to now they work fine with appdaemon dashboard. I have added a button template entity, this causes an exception and all elements on the dashboard are grey boxes.

Expected behavior

(What you expected to happen) to show the button as a normal button allowing a push

Actual behavior

(What actually happened) All tiles on the dashboard are grey

Steps to reproduce

(How can someone else make/see it happen) Create a ESPHome project using a template button create a dashboard in appdaemon add the template button to the .dash file

all elements on the dashboard are now grey

ESPHome > gym-fan.yaml

esphome:
  name: gym-fan
  friendly_name: gym-fan

esp32:
  board: esp32dev
  framework:
    type: arduino

# wifi bits
captive_portal:

dallas:
  - pin: 4

sensor:
  - platform: dallas
    address: 0xdd0213191768aa28
    name: "t1"
    unit_of_measurement: '°C'

fan:
  - platform: speed
    name: Cooling Fan
    id: cooling_fan
    output: cooling_fan_speed
    speed_count: 3
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      lambda: id(cooling_fan).speed = 1;

button:
  - platform: template
    name: Low
    on_press:
      fan.turn_on:
        id: cooling_fan
        speed: 1

appdaemon > dashboards > gym.dash

_title: Gym
widget_dimensions: [120, 120]
widget_margins: [5, 5]
columns: 3
global_parameters:
    use_comma: 0
    precision: 1
    use_hass_icon: 1
    namespace: default

layout:
  - sensor.gym_fan_t1
  - button.gym_fan_low

entities show correctly on viewer and work correctly in lovelace

button.gym_fan_low
gym-fan Low
2023-05-11T13:12:21.544659+00:00    friendly_name: gym-fan Low

sensor.gym_fan_t1
gym-fan t1
21.1    state_class: measurement
unit_of_measurement: °C
device_class: temperature
friendly_name: gym-fan t1

Inspection of the element gives:

<div data-bind="attr: {style: widget_style}" class="widget widget-baseerror-default-button-gym-fan-low" id="default-button-gym-fan-low"><h1 class="error" data-bind="text: error"></h1></div>

the gym_application.css has:

.widget-baseerror-default-button-gym-fan-low .error {
    position: absolute;
    top: 5px;
    width: 100%;
}

Chrome error:

jquery-3.1.1.min.js:2 jQuery.Deferred exception: Unable to process binding "text: function(){return error }"
Message: error is not defined ReferenceError: Unable to process binding "text: function(){return error }"
Message: error is not defined
    at text (eval at parseBindingsString (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:68:172), <anonymous>:3:57)
    at update (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:98:202)
    at a.B.i (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:72:379)
    at Function.Qc (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:51:391)
    at Function.Rc (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:51:155)
    at Function.aa (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:50:502)
    at a.m.a.B (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:49:67)
    at http://192.168.1.11:5050/javascript/knockout-3.4.1.js:72:366
    at Object.q (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:11:244)
    at m (http://192.168.1.11:5050/javascript/knockout-3.4.1.js:71:428) undefined
r.Deferred.exceptionHook @ jquery-3.1.1.min.js:2
k @ jquery-3.1.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
fire @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
ready @ jquery-3.1.1.min.js:2
R @ jquery-3.1.1.min.js:3
jquery-3.1.1.min.js:2 Uncaught ReferenceError: Unable to process binding "text: function(){return error }"
Message: error is not defined
    at text (eval at parseBindingsString (knockout-3.4.1.js:68:172), <anonymous>:3:57)
    at update (knockout-3.4.1.js:98:202)
    at a.B.i (knockout-3.4.1.js:72:379)
    at Function.Qc (knockout-3.4.1.js:51:391)
    at Function.Rc (knockout-3.4.1.js:51:155)
    at Function.aa (knockout-3.4.1.js:50:502)
    at a.m.a.B (knockout-3.4.1.js:49:67)
    at knockout-3.4.1.js:72:366
    at Object.q (knockout-3.4.1.js:11:244)
    at m (knockout-3.4.1.js:71:428)

Proposed changes

(If you have a proposed change, workaround or fix, describe the rationale behind it)

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

CestLaGalere commented 1 year ago

This is still happening - all boxes are blank because of an exception thrown

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!