not sure, try it from the command line. But it looks promising.
Works from the command line as well. Even without running the virtualenv, so I don’t know how it works.
$ python
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from homeassistant.util import location
>>> def loadHAconfig():
... haConfig={}
... locinfo=location.detect_location_info()
... haConfig["IP"]=locinfo.ip
... haConfig["country_code"]=locinfo.country_code
... haConfig["country_name"]=locinfo.country_name
... haConfig["region_code"]=locinfo.region_code
... haConfig["region_name"]=locinfo.region_name
... haConfig["city"]=locinfo.city
... haConfig["zip_code"]=locinfo.zip_code
... haConfig["time_zone"]=locinfo.time_zone
... haConfig["latitude"]=locinfo.latitude
... haConfig["longitude"]=locinfo.longitude
... haConfig["metric"]=locinfo.use_metric
... return haConfig
...
>>> hainfo=loadHAconfig()
>>> print("hainfo={}".format(hainfo))
hainfo={correct result redacted}
>>>
Edit:
I found I had the location of homeassistant in my PATH environmental variable. If I take that out, I get
graham@lubuntu1610-VirtualBox:~
$ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
graham@lubuntu1610-VirtualBox:~
$ python
Python 2.7.12+ (default, Sep 17 2016, 12:08:02)
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from homeassistant.util import location
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named homeassistant.util
>>>
thanks,
I’m trying to understand the common thread why its in some people’s path and not in others. Did you do the manual install into the virtual environment?
Yes, its just a test box, not running as a special user.
Edit:
So I tried it on my working Pi.
homeassistant@raspberrypi:~ $ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from homeassistant.util import location
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named homeassistant.util
>>>
homeassistant@raspberrypi:~ $ set -o vi
homeassistant@raspberrypi:~ $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@raspberrypi:~ $ python
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from homeassistant.util import location
>>>
So it has to be within the virtualenv to work. And as with my test machine, both appdaemon and homeassistant are in the same virtualenv.
Virtual Environments - would be my guess.
A lot of users (AIO included) install HA in a virtual environment. That means it is not visible from AppDaemon’s environment.
I should have spotted this when you were previously asking about this error.
It’s a mute point now really since I see you are giving me the infromation in AD now.
Well since you are my power user number 2 along with Rene, I take your requests seriously!