(Very) Basic Homeassistant dashboard for E-ink devices and Kiosk apps

Very cool idea with the symbols, and glad to hear its working for you!

Hi.
So I continued fiddeling. I would like to set the volume of my Sonos. I have a button in the dashboard, that calls:

function setvolume() {
  var hassadress="http://ip:8123"; //your Homeassistant address (without / at the end)
  var hasspass="Password"; //your Homeassistant password
  
  var xmlhttp = new XMLHttpRequest();   // new HttpRequest instance 
  xmlhttp.open("POST", hassadress+"/api/services/media_player.wohnzimmer/media_player.volume_set");
  xmlhttp.setRequestHeader('x-ha-access', hasspass);
  xmlhttp.setRequestHeader("Content-Type", "application/json");
  xmlhttp.send(JSON.stringify({entity_id:new String('media_player.wohnzimmer'),volume_level:new String('0.8')}));
}

How ever it doesn’t work. Any idea? Can you tell me where I can find more information on the API?

Best

first off run it on a PC and press F12, go to the console and see if there are any errors (logic/syntax) if you haven’t already.

and I used these docs here:
https://developers.home-assistant.io/docs/en/external_api_rest.html

I think you are looking for this, make sure you are formatting your JSON correctly, not sure you need “New String” etc, I think that might be causing the issue,
check out
https://www.w3schools.com/js/js_json_stringify.asp

#### POST /api/services/<domain>/<service>

Calls a service within a specific domain. Will return when the service has been executed or after 10 seconds, whichever comes first.

You can pass an optional JSON object to be used as  `service_data` .

```
{
    "entity_id": "light.Ceiling"
}
```

Returns a list of states that have changed while the service was being executed.

```
[
    {
        "attributes": {},
        "entity_id": "sun.sun",
        "last_changed": "2016-05-30T21:43:32.418320+00:00",
        "state": "below_horizon"
    },
    {
        "attributes": {},
        "entity_id": "process.Dropbox",
        "last_changed": "22016-05-30T21:43:32.418320+00:00",
        "state": "on"
    }
]
```

Hey, i do not know what the issue was, but now it works.
I added two functions. One to set the volume and one to select the source of my Sonos. We like to listen to radio in the mornings and music later the day. Therefore it is quite use full.

function setvolume(id,volume) {
  var hassadress=""; //your Homeassistant address (without / at the end)
  var hasspass=""; //your Homeassistant password
  
  var xmlhttp = new XMLHttpRequest();   // new HttpRequest instance 
  xmlhttp.open("POST", hassadress+"/api/services/"+id.substring(0,id.indexOf('.'))+"/volume_set");
  xmlhttp.setRequestHeader('x-ha-access', hasspass);
  xmlhttp.setRequestHeader("Content-Type", "application/json");
  xmlhttp.send(JSON.stringify({entity_id:id,volume_level:volume}));
}

function selectsource(id,name) {
  var hassadress=""; //your Homeassistant address (without / at the end)
  var hasspass=""; //your Homeassistant password
  
  var xmlhttp = new XMLHttpRequest();   // new HttpRequest instance 
  xmlhttp.open("POST", hassadress+"/api/services/"+id.substring(0,id.indexOf('.'))+"/select_source");
  xmlhttp.setRequestHeader('x-ha-access', hasspass);
  xmlhttp.setRequestHeader("Content-Type", "application/json");
  xmlhttp.send(JSON.stringify({entity_id:id,source:name}));
}

I guess one could combine it all somehow. But for now this solution dosn’t bother me. Thank’s again for the input. :grinning:

Hi there!

This sounds very nice! Which kindle version would I need to have the basic browser and wifi functionality and touchscreen?

Is it possible to have it always stay on the web page without some kind of screen saver or something?
An how long will the battery last while doing this?

I wonder why there are not more people interested in this. Seems to be the cheapest and best solution for some kind of Hass monitoring and controlling :slight_smile:

Does anyone know which eReader supports HA with Lovelace? Full support? I heard Kobo ones do, anyone could confirm this?

Hi luhu,
all your questions are already answered in the github link :slight_smile:
as far as I know you’ll need at least a Kindle 2 (using Advanced mode browser).
for me on a kindle paperwhite with 0 light the battery lasts for about 2-3 weeks on each charge, but i bought a slim microusb connector so I can put it on the wall have it plugged in

and you can disable the screensaver like this:

Newer kindles (2015 Paperwhite & up) type ~ds in the search bar and click search. (Don't worry, After restarting the Kindle the screensaver will return)

Older Kindles: Type ~disableScreensaver in the search box (type del on the home screen) and your Kindle will not go into sleep mode. ~resumeScreensaver will revert the Kindle back to its default (screensaver enabled) state. Note that this does not increase power consumption, as the Kindle consumes no power (with wireless off) when displaying a page

Or < Del > to open the search box on the home screen ;debugOn ~disableScreensaver NOTE: this also stops you from manually using the power switch to enter sleep mode. To re-enable: ~resumeScreensaver and to turn off debug mode: ;debugOff

@gurbina93 - if lovelace works on kindle its probably better than this, but I dont think it does

Hi,

oh sorry, I didn’t had a look on the description in that detail… :smiley:
But that sounds really good! I will have a look if I find a cheap kindle. :slight_smile:
Thanks!

sure, np,
btw it just occurred to that while it should work with the kindle 2, im unsure which generation of kindle was the first to have touch, I don’t think the second gen had a touch screen, im guessing the first one was the “kindle touch” and then 4th generation kindle / first generation paperwhite, some of those should be pretty cheap on ebay (~$20 probably)

Is this project still working?

It wasn’t (last updated 3 years ago), but I went ahead and made some changes to support the latest API and updated the instructions on how to use, so its working now (right now I left only the local version of the HTML files, might get to the cloud versions later if someone asks for it)

Waoo thank you! I just found a kindle on eBay. Planning to attach it by the pool to show weather and pool temperature!

i just tried this on my paperwhite, i can load all the entity but when i press on or off, i just no respond, but if i load that on pc browser, it works, any idea?

1 Like

Did you add
cors allowed origin null (and maybe 127.0.0.1)?

Problem with https…

ssl certificate for address not expired up to 08 oct 2022 ( certificate obtained from the Let’s Encrypt )

under module in configuration.yaml, add:

cors_allowed_origins:
  - 'null'

create token and place in ManualLOCAL.html

I try to configure address local https://192.****:8123/
or external configured in ssl https://address_on_my_server:8123/

same error - 401: Unauthorized

2022-09-04_08-22-10

Any solution for https ?

can you share your html file?

401 is not necessarily an https issue, are you sure you are using the long lived API token and that it is valid?

My mistake!
I didn’t have to change "Bearer " to a username

I am so lost, how do I link my entities to the cards???

in my case I saw the issue was on the hassaddress, my address was missing http(S), after including it, it worked :slight_smile:

This is a very cool project thank you all for keeping it alive!

Hello!

Based on this, I’ve created Kfloorp!

A similar dashboard, but with no need to create templates, no python scripts and easier to host.

Thanks for the inspiration!

Check it out:

1 Like