Closed theFeverDog closed 6 years ago
I'm gonna look at this from the axis component point of view shortly.
This is still applicable for 0.49. I tried excluding some components from the logger but without success.
This seems to be related with this issue with recorder/amcrest #8551
I have this same issue. I am using the Axis component, but not any remote component
Issue appears to be solved on the Armcrest component. Any word on this one
I haven't spent any time the last couple of months on automation. Will try to get my environment back up tomorrow evening. I think I know whats causing the issue but not how to solve it yet.
So I have a fix for this, all creds to @tchellomello who I just copied the solution for this issue from :)
If you guys wanna try it out you can find it here https://pypi.python.org/pypi/axis/9
@Kane610 I would be happy to test, but I'm not clear on what needs to be done.
Nevermind.. I figured it out.. Testing now
pip3 install --upgrade axis
Ok, tested I still see the same issue. When I remove the Axis component, i get logging. But when I reinstate it, I get this problem. I did the pip3 upgrade, but since I'm using docker, I also copied the files to /config/deps/lib/python3.6/site-packages
I also still get 2017-09-01 17:23:16 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: Object of type 'HomeAssistant' is not JSON serializable
Not sure if maybe I didnt do something correctly..
I upped the version number. That might have something to with it. Just change version to 8 in the setup.py. Don't you have a deps folder in your home assistant folder? I have no experience with docker yet.
Installed the Axis update. Problem still exist. I'm on Hassbian version 0.52.1. This is my log entry.
2017-09-03 15:50:01 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: <homeassistant.core.HomeAssistant object at 0x76a64a70> is not JSON serializable
Ok, did you change the version number to 8 since hass won't use it otherwise. Can you verify that at the bottom of the init.py file there is a function called as_dict(self)?
Oké, how do I check this? In the directory /srv/homeassistant/lib/python3.4/site-packages/axis/ there is a file init.py. The last function in this file is is_tripped(self).
I do the following:
pip3 install --upgrade axis
Collecting axis
Using cached axis-9.tar.gz
Collecting requests (from axis)
Using cached requests-2.18.4-py2.py3-none-any.whl
Requirement already up-to-date: certifi>=2017.4.17 in /srv/homeassistant/lib/python3.4/site-packages (from requests->axis)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /srv/homeassistant/lib/python3.4/site-packages (from requests->axis)
Requirement already up-to-date: idna<2.7,>=2.5 in /srv/homeassistant/lib/python3.4/site-packages (from requests->axis)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in /srv/homeassistant/lib/python3.4/site-packages (from requests->axis)
Installing collected packages: requests, axis
Found existing installation: requests 2.14.2
Uninstalling requests-2.14.2:
Successfully uninstalled requests-2.14.2
Found existing installation: axis 8
Uninstalling axis-8:
Successfully uninstalled axis-8
Running setup.py install for axis ... done
Successfully installed axis-9 requests-2.18.4
If I now check the file /srv/homeassistant/lib/python3.4/site-packages/axis/init.py, then the function as_dict(self) does exist. But after a reboot of the Pi3 it's all gone again.
Is there something I do wrong?
You don't need to reboot the pi only hass. My guess is that Hass only allows v8 of the axis component, and you're installing v9. What you need to do is to change version number to 8 in the setup.py prior to installing it.
I've downloaded version 9 on my Pi3 changed the version number in setup.py. But how do I install it?
pip install PATH1 --target PATH2 --upgrade Where PATH1 is the folder path to your downloaded axis component and PATH2 is the path to HASS deps folder which is either in your .homeassistant or in your sitepackages if you're running venv (in my case it is /home/pi/home-assistant/venv/lib/python3.4/site-packages/)
I've managed to install version 9 as version 8. At the bottom of the init.py file there is a function called as_dict(self), even after a HA restart. But unfortunately HA still has the same JSON error.
Would you mind doing one last thing? Put a _LOGGER.warning("Something something") on the line after as_dict(self). Just to verify that it is actually run. Else it would mean that the package is failing to install. Since it all worked well with all things enabled on my computer.
Good morning Kane,
I've done what you asked. The package has installed, because when I restart HA, the following entry appears in the logfile:
sep 04 09:10:42 hassbian hass[24861]: File "/srv/homeassistant/lib/python3.4/site-packages/axis/__init__.py", line 300
**sep 04 09:10:42 hassbian hass[24861]: _LOGGER.warning("Dit is een check om te zien of het script heeft gewerkt!")**
sep 04 09:10:42 hassbian hass[24861]: ^
sep 04 09:10:42 hassbian hass[24861]: IndentationError: unindent does not match any outer indentation level
Well, thats good at least... But annoyed since it seems the fix doesn't solve it... You still get the json error?
That's correct. When I remove the _LOGGER.warning and restart HA, the Axis camera works without a problem. Though the recorder doesn't work and the error still exist.
Nevermind, I enabled the camera part of the axis component and got new issues, probably what you're seeing.
Done it. The last function looks like this:
def as_dict(self):
"""Callback for __dict__."""
cdict = self.__dict__.copy()
del cdict['callback']
del cdict['_device']
_LOGGER.warning('%s', cdict)
return cdict
No difference, this is what I get when restarting HA:
home-assistant@homeassistant.service - Home Assistant for homeassistant
Loaded: loaded (/etc/systemd/system/home-assistant@homeassistant.service; enabled)
Active: active (running) since ma 2017-09-04 09:42:14 CEST; 1min 34s ago
Main PID: 25931 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@homeassistant.service
├─25931 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass
└─26144 nmap -oX - 192.168.2.1/24 -F --host-timeout 5s --exclude 192.168.2.30,192.168.2.10,192.168.2.2,192.168.2.73,192.168.2.250,192.168.2.252,192.168.2.254,192.168.2.3,192.168.2.20,192.168.2.235,192.168.2.71,192.168.2.143,192.168.2.205,192.168.2.238,192.168.2.251,192.168.2.86,192.168.2.72,192.168.2.125,192.168.2.5,192.168.2.88,192.168.2.253,192.168.2.7,192.168.2.6,192.168.2.118,192.168.2.1,192.168.2.81,192.168.2.123,192.168.2.85,192.168.2.121
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=check_config, domain=homeassistant>
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=reload_core_config, domain=homeassistant>
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=create, domain=persistent_notification>
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=dismiss, domain=persistent_notification>
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.bootstrap] Home Assistant core initialized
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.loader] Loaded mqtt from homeassistant.components.mqtt
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.loader] Loaded recorder from homeassistant.components.recorder
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.loader] Loaded logger from homeassistant.components.logger
sep 04 09:42:21 hassbian hass[25931]: 2017-09-04 09:42:21 INFO (MainThread) [homeassistant.setup] Setting up logger
sep 04 09:42:55 hassbian hass[25931]: 2017-09-04 09:42:55 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: <homeassistant.core.HomeAssistant object at 0x769c0a70> is not JSON serializable
I think I found the issue. I thought it was only the events that triggered this issue, but it was the camera component as well. And I have a different thing you could try if you want to. This would be the last time if it proves to work. In your local components/axis.py file
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/axis.py#L239
Replace that line with clean_config = config.copy() del clean_config['hass'] discovery.load_platform(hass, component, DOMAIN, clean_config) remember to keep indentation.
I've altered this file:
/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/axis.py
Replaced line 239:
discovery.load_platform(hass, component, DOMAIN, config)
with:
clean_config = config.copy()
del clean_config['hass']
discovery.load_platform(hass, component, DOMAIN, clean_config)
Then I restarted HA and got an error on the Axis component. HA says: Invalid Config. The following components and platforms could not be set up: axis.
The error log shows:
home-assistant@homeassistant.service - Home Assistant for homeassistant
Loaded: loaded (/etc/systemd/system/home-assistant@homeassistant.service; enabled)
Active: active (running) since ma 2017-09-04 10:49:30 CEST; 42s ago
Main PID: 27767 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@homeassistant.service
└─27767 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass
sep 04 10:49:42 hassbian hass[27767]: value = future.result()
sep 04 10:49:42 hassbian hass[27767]: File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
sep 04 10:49:42 hassbian hass[27767]: raise self._exception
sep 04 10:49:42 hassbian hass[27767]: File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
sep 04 10:49:42 hassbian hass[27767]: result = self.fn(*self.args, **self.kwargs)
sep 04 10:49:42 hassbian hass[27767]: File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/axis.py", line 189, in setup
sep 04 10:49:42 hassbian hass[27767]: if not setup_device(hass, config):
sep 04 10:49:42 hassbian hass[27767]: File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/axis.py", line 220, in setup_device
sep 04 10:49:42 hassbian hass[27767]: from axis import AxisDevice
sep 04 10:49:42 hassbian hass[27767]: ImportError: cannot import name 'AxisDevice'
Hmm, that shouldn't happen. That would be related to the external component which you didn't do anything with
After a reboot of the Pi3 the log file shows:
2017-09-04 10:57:16 ERROR (MainThread) [homeassistant.setup] Error during setup of component axis
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 194, in _async_setup_component
component.setup, hass, processed_config)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/axis.py", line 189, in setup
if not setup_device(hass, config):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/axis.py", line 220, in setup_device
from axis import AxisDevice
ImportError: cannot import name 'AxisDevice'
Ok, revert your changes back so it works for you. I think I got all gates covered. Thanks for your help Wilfred!
Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
Home Assistant release (
hass --version
): 0.48.0Python release (
python3 --version
): 3.4.2Component/platform: axis / remote (harmony) / Logger
Description of problem: When enabling both the component Harmony Remote and Axis Camera, the Logger component throws an exception and no state changes are recorded. Both the Harmony and the Axis Camera functions can be used as expected.
When disabling the Axis Camera component again, this behavior does not occur.
Expected: The logger component works normally.
Problem-relevant
configuration.yaml
entries and steps to reproduce:Traceback (if applicable):
Additional info:
Traceback seems to repeat for several times if discovery is used to add the camera. When adding the camera manually in the YAML, the error only occurs once.