@atomicpapa: Try sudo apt-get install ruby-dev
When i run./hapush.py hapush.cfg then noting happens.
i run my HA without api_key.
I haven’t tested it without a key but unless you are getting errors its probably working OK. HAPush won;t really do anything until you have a dashboard configured, and the dashboard must include widgets that map back to real devices otherwise it will just ignore the events that it sees.
If you didn’t at least see a message about it loading the dashboard then you may have an error in your config not pointing at the directory where the dashboard resides.
That worked!!! Now, while running Bundler, I got the following 2 errors…
Installing dm-do-adapter 1.2.0
Installing do_postgres 0.10.17 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby2.1
--with-pgsql-server-dir
--without-pgsql-server-dir
--with-pgsql-server-include
--without-pgsql-server-include=${pgsql-server-dir}/include
--with-pgsql-server-lib
--without-pgsql-server-lib=${pgsql-server-dir}/lib
--with-pgsql-client-dir
--without-pgsql-client-dir
--with-pgsql-client-include
--without-pgsql-client-include=${pgsql-client-dir}/include
--with-pgsql-client-lib
--without-pgsql-client-lib=${pgsql-client-dir}/lib
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20160620-32002-1o3rcxido_postgres-0.10.17/gems/do_postgres-0.10.17 for inspection.
Results logged to /tmp/bundler20160620-32002-1o3rcxido_postgres-0.10.17/extensions/x86_64-linux/2.1.0/do_postgres-0.10.17/gem_make.out
Installing do_sqlite3 0.10.17 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking for sqlite3.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby2.1
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20160620-32002-17gyv42do_sqlite3-0.10.17/gems/do_sqlite3-0.10.17 for inspection.
Results logged to /tmp/bundler20160620-32002-17gyv42do_sqlite3-0.10.17/extensions/x86_64-linux/2.1.0/do_sqlite3-0.10.17/gem_make.out
You’ll need a postgress install -
A quick google found this:
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 libpq-dev
Let me know if that works - I had to do something similar on my PI I now remember.
Sweet! Thanks!! Here’s what worked…
`sudo apt-get install postgresql-9.4 postgresql-server-dev-9.4 libpq-dev sqlite libsqlite3-dev
Bundle completed successfully after this… Now on to the rest
Edit: UP AND RUNNING!!! Now just to add my stuff. But, alas, that will have to wait until tonight when I get home from work!!! Thank you for this AWESOME project. My only dislike for HASS has been the UI, and you have now solved that.
Excellent - thanks for capturing this for me I will add it to the docs when you are done.
Thank you for the answer, i will test that out and let you know if it works
I have setup hapush and started it but as i siad before nothing happens.
And when i do ctrl+c to abort the running python i get some weird errors
I have setup the dasboard to fetch temperature and humidity value from HA and have added a button to power on the windows. The dashboard does not get the values and when i press the windows button i does notting happens.
Hope you guys can help me out.
hi
I didn’t setup ha key… seem like I need key to run ? is theres’ anyway run with out key?
Lets start with the Dashboard first - do you see the widgets as expected? Did you setup the config in lib/haconf.rb? Can you post it? Can you post your main.erb file so I can have a look at it as well? Are you seeing any errors from Dashing?
Regarding the hapush error - you have to hit ctrl-c twice to stop it that is expected behavior. It is intended to run as a daemon when you have finished debugging it, that is part of what the init script does.
I haven’t tested it without a key but I think it should work. I’ll work on a version that doesn’t need the key.
The dashboard is working fine. I see the same interface as yours.
That i have changed in my main.erb is the temperature, humidity and added the “Windows On”.
Here is the changes in main.erb
<li data-row="1" data-col="5" data-sizex="1" data-sizey="1"> <div data-id="inne_temperature" data-view="Hatemp" data-title="Temperature"></div> </li> <li data-row="1" data-col="6" data-sizex="1" data-sizey="1"> <div data-id="inne_humidity" data-view="Hahumidity" data-title="Humidity"></div> </li> <li data-row="3" data-col="1" data-sizex="1" data-sizey="1"> <div data-id="windows_on" data-view="Hascript" data-title="Windows On"></div> </li>
My haconf.rb looks like this:
ha_url = “http://10.0.1.159:8123”
ha_key = api_key
dash_host = “http://10.0.1.169:3030”
dash_dir = “/srv/hass/src/hadashboard/dashboards”
logfile = “/etc/hapush/hapush.log”
When i start dashing it looks like this.
kristoffer@SKYNETDASH:/srv/hass/src/hadashboard$ dashing start
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stopscheduler caught exception:
SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol
/usr/lib/ruby/2.3.0/net/http.rb:933:inconnect_nonblock' /usr/lib/ruby/2.3.0/net/http.rb:933:in
connect’
/usr/lib/ruby/2.3.0/net/http.rb:863:indo_start' /usr/lib/ruby/2.3.0/net/http.rb:852:in
start’
/usr/lib/ruby/2.3.0/net/http.rb:1398:inrequest' /srv/hass/src/hadashboard/jobs/homeassistant.rb:20:in
ha_api’
/srv/hass/src/hadashboard/jobs/homeassistant.rb:173:inblock in <top (required)>' /var/lib/gems/2.3.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in
trigger_block’
/var/lib/gems/2.3.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:inblock in trigger' /var/lib/gems/2.3.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in
block in trigger_job’
I have this done on three virutal servers.
Home-Assistant on 10.0.1.159
Dashing on 10.0.1.169
Hapush on 10.0.1.170
Your first issue is that you seem to have confused the ha_conf.rb file with hapush.cfg.
ha_conf.rb should look like this:
$ha_url = "http://192.168.1.10:8123"
$ha_apikey = "your key"
If you haven’t edited the ha_conf.rb file correctly it might explain why the dashboard can’t connect.
Also note, that at this time, hapush and Dashing need to be on the same host - I didn’t mention that in the docs, my bad, I have added it for an upcoming commit.
Also, on reviewing the code it looks like I am assuming an https connection which I will have to fix. I’ll try and get that done today, if not it will have to wait until the weekend as I am traveling on business.
I appreciate your feedback, and we’ll get this working!
My bad i posted the hapush.cfg.
My ha_conf.rb looks like this:
$ha_url = “http://10.0.1.159:8123”
$ha_apikey = “test”
I will move my hapush to the dashing server as soon as i can.
I didnt have an apikey on my HA-server, I did add I add the right way?
my configuration.yaml looks like this.
http:
api_password: “test”
Yeah, you look pretty close, my code just doesn’t support the idea of people not using SSL or an API Key I am fixing that now and will push a new version soon. You don;t need to add a key to HA just for this, I’ll make sure it works without, so change your configuration.yaml back if you prefer, and I will make the key variable optional for dashing an hapush.
Stay tuned …
Thank you for the quick response
When i run the hapush on the dashing server I’ll get this message.
I guess it’s because i’m not running ssl.
2016-06-21 19:53:49,845 CRITICAL ------------------------------------------------------------
2016-06-21 19:53:54,856 CRITICAL Unexpected error:
2016-06-21 19:53:54,856 CRITICAL ------------------------------------------------------------
2016-06-21 19:53:54,856 CRITICAL Traceback (most recent call last):
File “./hapush.py”, line 233, in run
messages = SSEClient(ha_url + “/api/stream”, verify = False, headers = headers, retry = 3000)
File “/home/kristoffer/.local/lib/python3.5/site-packages/sseclient.py”, line 37, in init
self._connect()
File “/home/kristoffer/.local/lib/python3.5/site-packages/sseclient.py”, line 50, in _connect
self.resp.raise_for_status()
File “/home/kristoffer/.local/lib/python3.5/site-packages/requests/models.py”, line 844, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: UNAUTHORIZED for url: http://10.0.1.159:8123/api/stream
2016-06-21 19:53:54,857 CRITICAL ------------------------------------------------------------
OK, I pushed a new version - you should be able to update your repository with:
$ git pull origin
This release has improved docs and now should work fine with http and with or without the key.
Let me know how you get on!
Now it works like a charm!
I am running without ssl and api_key
Right now i trying temperature, script and input_select and works great.