Dashboard not working, TypeError: OFF is not JSON serializable

After moving appdaemon to a virtual env and at the same time upgrading to the latest version the Dashboard is showing as before but is not functional anymore which it was before the move/upgrade.
I have Installed:

HA: 0.65.5
Python: 3.5.3
appdaemon, Version: 2.1.12
hass-apps, Version: 0.20180310.1

appdaemon.yaml:

AppDaemon:
  logfile: /home/appdaemon/appdaemon/daemon.log
  errorfile: /home/appdaemon/appdaemon/error.log
  logsize: 100000
  log_generations: 3
  threads: 10
  #debug: True
HASS:
  ha_url: http://192.168.1.70:8123
  ha_key: !secret http_password
HADashboard:
  #dash_force_compile: 1
  dash_url: http://192.168.1.70:5050
  dash_password: !secret dash_password

daemon.log

2018-03-19 12:24:05.021908 INFO AppDaemon Version 2.1.12 starting
2018-03-19 12:24:05.022869 INFO Configuration read from: /home/appdaemon/appdaemon/conf/appdaemon.yaml
2018-03-19 12:24:05.170385 INFO Starting Apps
2018-03-19 12:24:05.495037 INFO Got initial state
2018-03-19 12:24:05.497108 INFO Loading Module: /home/appdaemon/appdaemon/conf/apps/hello.py
2018-03-19 12:24:05.499598 INFO Loading Module: /home/appdaemon/appdaemon/conf/apps/hass_apps_loader.py
2018-03-19 12:24:05.560216 INFO Loading Object verwarming using class HeatyApp from module hass_apps_loader
2018-03-19 12:24:06.037830 INFO verwarming: --- heaty v0.12.3 initialization started
2018-03-19 12:24:06.088416 INFO verwarming: --- Heaty id is: 'default'
2018-03-19 12:24:06.099693 WARNING verwarming: !!! [Badkamer] [climate.badkamer] Thermostat doesn't seem to support the operation mode Heat, supported modes are: ['heat', 'off']. Please check your config!
2018-03-19 12:24:06.105488 WARNING verwarming: !!! [Badkamer] [climate.badkamer] Thermostat doesn't seem to support the operation mode Off, supported modes are: ['heat', 'off']. Please check your config!
2018-03-19 12:24:06.128920 INFO verwarming: --> [Badkamer] [climate.badkamer] Received target temperature 16.0.
2018-03-19 12:24:06.190747 WARNING verwarming: !!! [Woonkamer] [climate.woonkamer] Attributes for thermostat contain no 'operation_list', Consider disabling operation mode support.
2018-03-19 12:24:06.207299 INFO verwarming: --> [Woonkamer] [climate.woonkamer] Received target temperature OFF.
2018-03-19 12:24:06.270100 WARNING verwarming: !!! [keuken] [climate.keuken] Attributes for thermostat contain no 'operation_list', Consider disabling operation mode support.
2018-03-19 12:24:06.286567 INFO verwarming: --> [keuken] [climate.keuken] Received target temperature OFF.
2018-03-19 12:24:06.358639 WARNING verwarming: !!! [Speelkamer] [climate.speelkamer] Attributes for thermostat contain no 'operation_list', Consider disabling operation mode support.
2018-03-19 12:24:06.375128 INFO verwarming: --> [Speelkamer] [climate.speelkamer] Received target temperature OFF.
2018-03-19 12:24:06.510789 INFO verwarming: <-- [Woonkamer] Temperature set to 19.5.  <scheduled>
2018-03-19 12:24:06.553012 INFO verwarming: <-- [keuken] Temperature set to 19.5.  <scheduled>
2018-03-19 12:24:06.593705 INFO verwarming: <-- [Speelkamer] Temperature set to 19.5.  <scheduled>
2018-03-19 12:24:06.605597 INFO verwarming: --- Initialization done
2018-03-19 12:24:06.606167 INFO App initialization complete
2018-03-19 12:24:06.606984 INFO Starting dashboard
2018-03-19 12:24:06.618430 INFO API is disabled
2018-03-19 12:24:06.630286 INFO Connected to Home Assistant 0.65.5
2018-03-19 12:24:07.090021 WARNING Logged an error to /home/appdaemon/appdaemon/error.log
2018-03-19 12:24:24.449685 INFO Compiling dashboard 'landscape'
2018-03-19 12:24:26.259467 INFO function [get_dashboard] finished in 1820 ms
2018-03-19 12:24:26.839842 INFO New dashboard connected: Hoog Gagel 66
2018-03-19 12:24:46.504766 INFO Dashboard disconnected
2018-03-19 12:24:47.619617 INFO function [get_dashboard] finished in 112 ms
2018-03-19 12:24:47.620442 INFO New dashboard connected: Hoog Gagel 66
2018-03-19 12:24:47.656625 INFO Dashboard disconnected
2018-03-19 12:24:48.268313 INFO New dashboard connected: Hoog Gagel 66
2018-03-19 12:24:53.987174 INFO Dashboard disconnected
2018-03-19 12:31:17.010639 WARNING Logged an error to /home/appdaemon/appdaemon/error.log
2018-03-19 12:41:32.009982 WARNING Logged an error to /home/appdaemon/appdaemon/error.log

error.log

2018-03-19 12:24:07.089386 WARNING ------------------------------------------------------------
2018-03-19 12:31:17.007725 WARNING ------------------------------------------------------------
2018-03-19 12:31:17.008399 WARNING Unexpected error during process_message()
2018-03-19 12:31:17.008785 WARNING ------------------------------------------------------------
2018-03-19 12:31:17.009881 WARNING Traceback (most recent call last):
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/appdaemon.py", line 771, in process_message
    appdash.ws_update(data)
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/rundash.py", line 261, in ws_update
    data = json.dumps(jdata)
  File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: OFF is not JSON serializable

2018-03-19 12:31:17.010287 WARNING ------------------------------------------------------------
2018-03-19 12:41:32.004285 WARNING ------------------------------------------------------------
2018-03-19 12:41:32.005455 WARNING Unexpected error during process_message()
2018-03-19 12:41:32.006259 WARNING ------------------------------------------------------------
2018-03-19 12:41:32.008363 WARNING Traceback (most recent call last):
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/appdaemon.py", line 771, in process_message
    appdash.ws_update(data)
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/rundash.py", line 261, in ws_update
    data = json.dumps(jdata)
  File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: OFF is not JSON serializable

2018-03-19 12:41:32.009238 WARNING ------------------------------------------------------------

There is clearly an error, however I have no clue if this is related to the dashboard not working. There is a warning in the Heaty (part of hass-apps) but it is functional (my heating is following my schedule). So what is causing the Dashboard not to work? How can I find out where the error is coming form? By the way I am running this on a RPI3 in Raspbian Stretch Lite (so no dockers). Thanks in advance for pointers on how to solve this.

I haven’t seen this specific error before but I see you are running AppDaemon 2.1.12 with python 3.5.3 - this can cause other problems. I suggest you upgrade to AppDaemon 3,0 as an initial step and see if the problem persists - if it does we can track it down in the 3,0 branch as a lot has changed.

1 Like

[edit]: seems that I have many more issues, among running appdaeom in the wrong group, so everything might be wrong what I am said here.[/edit]
[edit2] the apps.yaml file had to be moved to the apps directory as well. Now it seems it is fie again[/edit]
I have upgraded to 3.0 but that did not help directly. What got rid of the errors is that the yaml file syntax was wrong. Apparently it did change?
appdaemon,yaml now looks like:

log:
  logfile: /home/appdaemon/appdaemon/daemon.log
  errorfile: /home/appdaemon/appdaemon/error.log
  accessfile: /home/appdaemon/appdaemon/access.log
  log_generation: 3
  log_size: 100000
appdaemon:
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.1.70:8123
      ha_key: !secret http_password
hadashboard:
  dashboard_dir: /home/appdaemon/appdaemon/conf/dashboards
  dash_url: http://192.168.1.70:5050
  dash_password: !secret dash_password

To get rid of the warning of the operation mode I added this to my heaty conf (apps.yaml) file:

  thermostat_defaults:
    supports_opmodes: false

Now it looks to be in good shape again.Except for one room, which uses a different heating system, that supports operation modes but it does not actual use it.

1 Like