Wall Mounted Dashboard (now known as HADashboard)

    <li data-row="5" data-col="1" data-sizex="2" data-sizey="1">
      <div data-id="camera1" data-view="cameras" data-title="CAM" </div>
    </li>

this is how i made the config… But i Fail of course.

Have you got your camera working in HASS yet? You have to go to the states page on hass then find the camera entity, you will see something like this /api/camera_proxy/camera.name?token=1234567890, copy it and replace the sample in jobs/cameras.rb - the bold section in that line
@camera1_api_url = “/api/camera_proxy/camera.name?token=1234567890&api_password=#{ha_key}”

Make sure you remove all other code for extra camera in cameras.rb if you have less than 4 cameras.

Post your code here if you still have trouble getting it to work, happy to help.

require 'net/http'
require "uri"

@cameraDelay = 1             # Needed for image sync.
@fetchNewImageEvery = '1s'  # replace new image every 10secs, change to whatever refresh time you want
@ha_host = "192.168.1.22"   # your hass ip
@ha_port = "8123"            # hass port
ha_key = ""           # hass api key

@camera1_api_url = "/api/camera_proxy/camera.emevth_security_cam?token=1827471472&api_password=#{ha_key}"     # get your camera1 api url from hass entity page
@newFile1 = "assets/images/cameras/snapshot1_new.jpg"
@oldFile1 = "assets/images/cameras/snapshot1_old.jpg"



def fetch_image_http(host,old_file,new_file, cam_port, cam_url)
        `rm #{old_file}`
        `mv #{new_file} #{old_file}`
        Net::HTTP.start(host,cam_port) do |http|
                req = Net::HTTP::Get.new(cam_url)
                response = http.request(req)
                open(new_file, "wb") do |file|
                        file.write(response.body)
                end
        end
        new_file
end

def fetch_image_https(host,old_file,new_file, cam_port, cam_url)
        `rm #{old_file}`
        `mv #{new_file} #{old_file}`

        uri = URI('https://...')

        Net::HTTP.start(host,cam_port,
                :use_ssl => uri.scheme == 'https',
                :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
                req = Net::HTTP::Get.new(cam_url)
                response = http.request(req)
                open(new_file, "wb") do |file|
                        file.write(response.body)
                end
        end
        new_file
end


def make_web_friendly(file)
  "/" + File.basename(File.dirname(file)) + "/" + File.basename(file)
end

SCHEDULER.every @fetchNewImageEvery, first_in: 0 do
        new_file1 = fetch_image_http(@ha_host,@oldFile1,@newFile1,@ha_port,@camera1_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl
        new_file2 = fetch_image_https(@ha_host,@oldFile2,@newFile2,@ha_port,@camera2_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl
        new_file3 = fetch_image_https(@ha_host,@oldFile3,@newFile3,@ha_port,@camera3_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl
        new_file4 = fetch_image_https(@ha_host,@oldFile4,@newFile4,@ha_port,@camera4_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl

        if not File::exists?(@newFile1 && @newFile2 && @newFile3 && @newFile4)              # add/remove according to the number of camera needed
                warn "Failed to Get Camera Image"
        end

        send_event('camera1', image: make_web_friendly(@oldFile1))
        sleep(@cameraDelay)
        send_event('camera1', image: make_web_friendly(new_file1))
end

this is how my camrea.rb looks like… how do i now have to put this in hadashboard?

this is my config in hadash:

    <li data-row="1" data-col="2" data-sizex="2" data-sizey="2">
      <div data-id="emevth_security_cam" data-view="camera1" data-title="Front Cam">
      </div>
    </li>

remove these lines

    new_file2 = fetch_image_https(@ha_host,@oldFile2,@newFile2,@ha_port,@camera2_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl
    new_file3 = fetch_image_https(@ha_host,@oldFile3,@newFile3,@ha_port,@camera3_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl
    new_file4 = fetch_image_https(@ha_host,@oldFile4,@newFile4,@ha_port,@camera4_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl

and

&& @newFile2 && @newFile3 && @newFile4 so it read if not File::exists?(@newFile1)

if you don’t use password for hass, try to remove this part as well “&api_password=#{ha_key}”, I haven’t try it without password.

    <li data-row="6" data-col="2" data-sizex="2" data-sizey="2">
      <div data-id="emevth_security_cam" data-view="camera1" data-title="Front Cam">        
      </div>
    </li>
pi@Home-Assistant:~/hadashboard/jobs $ cat cameras.rb
require 'net/http'
require "uri"

@cameraDelay = 1             # Needed for image sync.
@fetchNewImageEvery = '1s'  # replace new image every 10secs, change to whatever refresh time you want
@ha_host = "192.168.1.22"   # your hass ip
@ha_port = "8123"            # hass port
ha_key = ""           # hass api key

@camera1_api_url = "/api/camera_proxy/camera.emevth_security_cam?token=1827471472"     # get your camera1 api url from hass entity page
@newFile1 = "assets/images/cameras/snapshot1_new.jpg"
@oldFile1 = "assets/images/cameras/snapshot1_old.jpg"



def fetch_image_http(host,old_file,new_file, cam_port, cam_url)
        `rm #{old_file}`
        `mv #{new_file} #{old_file}`
        Net::HTTP.start(host,cam_port) do |http|
                req = Net::HTTP::Get.new(cam_url)
                response = http.request(req)
                open(new_file, "wb") do |file|
                        file.write(response.body)
                end
        end
        new_file
end

def fetch_image_https(host,old_file,new_file, cam_port, cam_url)
        `rm #{old_file}`
        `mv #{new_file} #{old_file}`

        uri = URI('https://...')

        Net::HTTP.start(host,cam_port,
                :use_ssl => uri.scheme == 'https',
                :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
                req = Net::HTTP::Get.new(cam_url)
                response = http.request(req)
                open(new_file, "wb") do |file|
                        file.write(response.body)
                end
        end
        new_file
end


def make_web_friendly(file)
  "/" + File.basename(File.dirname(file)) + "/" + File.basename(file)
end

SCHEDULER.every @fetchNewImageEvery, first_in: 0 do
        new_file1 = fetch_image_http(@ha_host,@oldFile1,@newFile1,@ha_port,@camera1_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl

        if not File::exists?(@newFile1 )              # add/remove according to the number of camera needed
                warn "Failed to Get Camera Image"
        end

        send_event('camera1', image: make_web_friendly(@oldFile1))
        sleep(@cameraDelay)
        send_event('camera1', image: make_web_friendly(new_file1))
end

Hi,

How can I do a location.reload or something similar for refresh all page?

Thanks!

There’s a widget for it in example.erb, is it something like that you mean?
You put

  data-id="reload" data-view="Reload"

in your div tag for it to show up.

Hi i really like the Dashboard! I just installed it today.
However i’m running in some problems. I adjusted the main.erb to only show time and a switch for now.
When i push the switch it will take around 8 minutes to turn it on or off. it throw some errors:

2016-10-30 15:45:23 - Net::ReadTimeout - Net::ReadTimeout:
        /usr/lib/ruby/2.1.0/net/protocol.rb:158:in `rescue in rbuf_fill'
        /usr/lib/ruby/2.1.0/net/protocol.rb:152:in `rbuf_fill'
        /usr/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'
        /usr/lib/ruby/2.1.0/net/protocol.rb:144:in `readline'
        /usr/lib/ruby/2.1.0/net/http/response.rb:39:in `read_status_line'
        /usr/lib/ruby/2.1.0/net/http/response.rb:28:in `read_new'
        /usr/lib/ruby/2.1.0/net/http.rb:1408:in `block in transport_request'
        /usr/lib/ruby/2.1.0/net/http.rb:1405:in `catch'
        /usr/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'
        /usr/lib/ruby/2.1.0/net/http.rb:1378:in `request'
        /usr/lib/ruby/2.1.0/net/http.rb:1371:in `block in request'
        /usr/lib/ruby/2.1.0/net/http.rb:853:in `start'
        /usr/lib/ruby/2.1.0/net/http.rb:1369:in `request'
        /home/pi/hadashboard/jobs/homeassistant.rb:23:in `ha_api'
        /home/pi/hadashboard/jobs/homeassistant.rb:45:in `block in <top (required)>'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `[]'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call'
        /var/lib/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
        /var/lib/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
        /var/lib/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
        /var/lib/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
        /var/lib/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
        /var/lib/gems/2.1.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/logger.rb:15:in `call'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/commonlogger.rb:33:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:219:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:212:in `call'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/head.rb:11:in `call'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:25:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
        /var/lib/gems/2.1.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/urlmap.rb:65:in `block in call'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `each'
        /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `call'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/connection.rb:86:in `block in pre_process'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/connection.rb:84:in `catch'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/connection.rb:84:in `pre_process'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/connection.rb:53:in `process'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/connection.rb:39:in `receive_data'
        /var/lib/gems/2.1.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run_machine'
        /var/lib/gems/2.1.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/backends/base.rb:73:in `start'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/server.rb:162:in `start'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/controller.rb:87:in `start'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:200:in `run_command'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:156:in `run!'
        /var/lib/gems/2.1.0/gems/thin-1.6.4/bin/thin:6:in `<top (required)>'
        /usr/local/bin/thin:23:in `load'
        /usr/local/bin/thin:23:in `<top (required)>'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `load'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/cli/exec.rb:27:in `run'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/cli.rb:332:in `exec'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/cli.rb:20:in `dispatch'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/cli.rb:11:in `start'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/exe/bundle:34:in `block in <top (required)>'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
        /var/lib/gems/2.1.0/gems/bundler-1.13.6/exe/bundle:26:in `<top (required)>'
        /usr/local/bin/bundle:23:in `load'
        /usr/local/bin/bundle:23:in `<main>'
192.168.1.8 - - [30/Oct/2016 15:45:24] "GET /events?lastEventId=&r=6179000933000782 HTTP/1.1" 200 - 240.5259
================================================================================
scheduler caught exception:
Net::ReadTimeout
/usr/lib/ruby/2.1.0/net/protocol.rb:158:in `rescue in rbuf_fill'
/usr/lib/ruby/2.1.0/net/protocol.rb:152:in `rbuf_fill'
/usr/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'
/usr/lib/ruby/2.1.0/net/protocol.rb:144:in `readline'
/usr/lib/ruby/2.1.0/net/http/response.rb:39:in `read_status_line'
/usr/lib/ruby/2.1.0/net/http/response.rb:28:in `read_new'
/usr/lib/ruby/2.1.0/net/http.rb:1408:in `block in transport_request'
/usr/lib/ruby/2.1.0/net/http.rb:1405:in `catch'
/usr/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'
/usr/lib/ruby/2.1.0/net/http.rb:1378:in `request'
/usr/lib/ruby/2.1.0/net/http.rb:1371:in `block in request'
/usr/lib/ruby/2.1.0/net/http.rb:853:in `start'
/usr/lib/ruby/2.1.0/net/http.rb:1369:in `request'
/home/pi/hadashboard/jobs/homeassistant.rb:23:in `ha_api'
/home/pi/hadashboard/jobs/homeassistant.rb:282:in `block in <top (required)>'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `call'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `trigger_block'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in `block in trigger'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `call'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `block in trigger_job'
================================================================================

I’m running Hadashboard on an rpi 2 with raspbian jessie and i used the manual installation method.
I have adjusted ha_conf.rb to:
$ha_url = “https://myname.duckdns.org:443
$ha_apikey = “mypassword”

Maybe somebody can see what i did wrong or need to do?
Thanks in advance!

You shouldn’t need the port here.

Thanks for your response i removed the :443. But now i can’t start it somehow.

pi@raspberrypi:~/hadashboard $ dashing start
bundler: failed to load command: thin (/usr/local/bin/thin)
NoMethodError: undefined method `each' for nil:NilClass
  /home/pi/hadashboard/jobs/news.rb:56:in `<top (required)>'
  /var/lib/gems/2.1.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
  /var/lib/gems/2.1.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
  /var/lib/gems/2.1.0/gems/dashing-1.3.7/lib/dashing/app.rb:171:in `block in require_glob'
  /var/lib/gems/2.1.0/gems/dashing-1.3.7/lib/dashing/app.rb:170:in `each'
  /var/lib/gems/2.1.0/gems/dashing-1.3.7/lib/dashing/app.rb:170:in `require_glob'
  /var/lib/gems/2.1.0/gems/dashing-1.3.7/lib/dashing/app.rb:181:in `<top (required)>'
  /var/lib/gems/2.1.0/gems/dashing-1.3.7/lib/dashing.rb:3:in `require'
  /var/lib/gems/2.1.0/gems/dashing-1.3.7/lib/dashing.rb:3:in `<top (required)>'
  config.ru:1:in `require'
  config.ru:1:in `block in <main>'
  /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
  /var/lib/gems/2.1.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/rack/adapter/loader.rb:33:in `eval'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/rack/adapter/loader.rb:33:in `load'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/controller.rb:182:in `load_rackup_config'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/controller.rb:72:in `start'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:200:in `run_command'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:156:in `run!'
  /var/lib/gems/2.1.0/gems/thin-1.6.4/bin/thin:6:in `<top (required)>'
  /usr/local/bin/thin:23:in `load'
  /usr/local/bin/thin:23:in `<top (required)>'

and i installed thin after this but it gives the same error.

sudo gem install thin
Building native extensions.  This could take a while...
Successfully installed thin-1.7.0
Parsing documentation for thin-1.7.0
Done installing documentation for thin after 7 seconds
1 gem installed

EDIT: The not starting was caused by me deleting:
$news_feeds = {
“Traffic” => “http://api.sr.se/api/rss/traffic/2863”,
“News” => “http://feeds.bbci.co.uk/news/rss.xml”,

}

I think the problem is in your ha_conf.rb file - what do you have set for your newsfeeds?

oh i just edited my post. i deleted that when removing de 443 part.
it now started.

pi@raspberrypi:~/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 stop
192.168.1.8 - - [30/Oct/2016 18:25:38] "GET /main HTTP/1.1" 200 1689 0.0423
192.168.1.8 - - [30/Oct/2016 18:26:49] "GET /views/clock.html HTTP/1.1" 200 66 0.0070
192.168.1.8 - - [30/Oct/2016 18:26:49] "GET /views/haswitch.html HTTP/1.1" 200 130 0.0057
================================================================================
scheduler caught exception:
Net::ReadTimeout
/usr/lib/ruby/2.1.0/net/protocol.rb:158:in `rescue in rbuf_fill'
/usr/lib/ruby/2.1.0/net/protocol.rb:152:in `rbuf_fill'
/usr/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'
/usr/lib/ruby/2.1.0/net/protocol.rb:144:in `readline'
/usr/lib/ruby/2.1.0/net/http/response.rb:39:in `read_status_line'
/usr/lib/ruby/2.1.0/net/http/response.rb:28:in `read_new'
/usr/lib/ruby/2.1.0/net/http.rb:1408:in `block in transport_request'
/usr/lib/ruby/2.1.0/net/http.rb:1405:in `catch'
/usr/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'
/usr/lib/ruby/2.1.0/net/http.rb:1378:in `request'
/usr/lib/ruby/2.1.0/net/http.rb:1371:in `block in request'
/usr/lib/ruby/2.1.0/net/http.rb:853:in `start'
/usr/lib/ruby/2.1.0/net/http.rb:1369:in `request'
/home/pi/hadashboard/jobs/homeassistant.rb:23:in `ha_api'
/home/pi/hadashboard/jobs/homeassistant.rb:282:in `block in <top (required)>'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `call'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in `trigger_block'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in `block in trigger'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `call'
/var/lib/gems/2.1.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `block in trigger_job'

but now i get the same error as before removing the 443 part.

now this is my ha_conf.rb:

$ha_url = "https://myname.duckdns.org"
$ha_apikey = "mypassword"
$news_feeds = {
  "Traffic" => "http://api.sr.se/api/rss/traffic/2863",
  "News" => "http://feeds.bbci.co.uk/news/rss.xml",
}

OK, the problem now is that the dashboard can’t speak to homeassistant - have you verified that URL works in a browser? FWIW, in my setup, with SSL, I just use the IP address and port not the whole dynamic DNS name, e.g. https://192.168.1.20:8123 and it works fine.

That could be my problem, because i can’t use something like https://192.168.1.20:8123 since i did set-up ssl.
But it does somehow talk to hass trough my url, because after like 8 minutes the switch is turned on or off?

can maybe someone help me to setup the cam widged?

That should work for SSL as well - I have SSL with letsencrypt and it works fine for me.

Thank you for your help. i’m using lets encrypt aswell. The problem is not with hadashboard. I removed the port forwarding from 443 to 8123 and i can acces it via this

And hadashboard is working fine. So i think i need to do some searching, because now i can’t use ssl and hadashboard at same time.

EDIT: I don’t know what did happen, but it is working now.:smile:
EDIT2: It happens to be a function of my netgear wndr4500 router which is called something like external control. After disabling it everything works perfect. I can finally start configuring the dashboard. Thanks for the help.
EDIT 3: Problem still Exist somehow it works for some periods off time, mostly when i change a setting in de router and it updates then the problem goes away for some time.

Thanks @gustafh, yes something like this but to run automatically every X minutes.

Hey guys. I was looking around to find maybee another nice dashing theme and found this: https://github.com/Aricwithana/LCARS-SDK do you think it is possible to integrate this in hadashboard?

@thundergreen this is what i have.

require 'net/http'
require "uri"

@cameraDelay = 1             # Needed for image sync. 
@fetchNewImageEvery = '1s'  # replace new image every 10secs, change to whatever refresh time you want
@ha_host = "192.168.1.55"   # your hass ip
@ha_port = "8123"            # hass port
ha_key = "mypass"           # hass api key

@camera1_api_url = "/api/camera_proxy/camera.tuin?token=1831727640&api_password=#{ha_key}"     # get your camera1 api url from hass entity page
@newFile1 = "assets/images/cameras/snapshot1_new.jpg"
@oldFile1 = "assets/images/cameras/snapshot1_old.jpg"
 
def fetch_image_http(host,old_file,new_file, cam_port, cam_url)
	`rm #{old_file}` 
	`mv #{new_file} #{old_file}`	
	Net::HTTP.start(host,cam_port) do |http|
		req = Net::HTTP::Get.new(cam_url)
		response = http.request(req)
		open(new_file, "wb") do |file|
			file.write(response.body)
		end
	end
	new_file
end
 
def fetch_image_https(host,old_file,new_file, cam_port, cam_url)
	`rm #{old_file}` 
	`mv #{new_file} #{old_file}`	

	uri = URI('https://...')

	Net::HTTP.start(host,cam_port,
		:use_ssl => uri.scheme == 'https',
		:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
		req = Net::HTTP::Get.new(cam_url)
		response = http.request(req)
		open(new_file, "wb") do |file|
			file.write(response.body)
		end
	end
	new_file
end


def make_web_friendly(file)
  "/" + File.basename(File.dirname(file)) + "/" + File.basename(file)
end
 
SCHEDULER.every @fetchNewImageEvery, first_in: 0 do
	new_file1 = fetch_image_https(@ha_host,@oldFile1,@newFile1,@ha_port,@camera1_api_url)    # change fetch_image_https to fetch_image_http if you use hass without ssl


	if not File::exists?(@newFile1)              #removed # && @newFile2 && @newFile3 && @newFile4 ##add/remove according to the number of camera needed
		warn "Failed to Get Camera Image"
	end
 
	send_event('camera1', image: make_web_friendly(@oldFile1))
	sleep(@cameraDelay)
	send_event('camera1', image: make_web_friendly(new_file1))

end 

and in main.erb:

<div class="gridster"> <!-- Panel - PAGE 2 -->
  <ul>
	<li data-row="5" data-col="1" data-sizex="3" data-sizey="3">
      <div data-id="camera1" data-view="Cameras" data-title="tuin" ></div>
   </li>

	<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
      <div data-id="cpage1" data-view="ChangePage" data-icon="cogs" data-title="Main panel" data-page="1" data-stagger="false" data-fasttransition="true" data-event-click="onClick"></div>
    </li>

	<li data-row="6" data-col="8" data-sizex="1" data-sizey="1">
      <div data-id="reload" data-view="Reload"></div>
    </li>
</div>

But this gives me only an image when i reload the dashboard. It is not automatic updating. Is that how it is supposed to work?