poulou0 / nextcloud-homeassistant-integration

A dashboard widget for a home assistant template
13 stars 0 forks source link

config ? #6

Closed dl6dbh closed 1 year ago

dl6dbh commented 1 year ago

The settings are still unclear to me

Base Url is clear so far
Long-lived access token ?  is that just the token generated by home assist or is there something else?
Template widget what is entered here?
poulou0 commented 1 year ago

The long lived token can be generated from your profile settings as described in the first minute of this video https://youtu.be/p6v5ygpGZHg?si=A_5o5XfU2q7eoxq9

The template widget field gets HTML and jinja2 code. You can find an example in your instance under Developer Tools > Template

If you are more of a video tutorial person:

dl6dbh commented 1 year ago

 

Hallo poulou

thanks for the fast and goot answer.

I got a little further. The long-lived access token seems to work. I was able to successfully get data from homeassist with wget in the shell. Only with the template that doesn't seem to work yet. This is probably due to my lack of knowledge of jinja2. I'm just missing Example to get a sensor displayed

Best

Meinolf

 

 

 

 

Gesendet: Sonntag, 27. August 2023 um 16:07 Uhr Von: "Poulou" @.> An: "poulou0/nextcloud-homeassistant-integration" @.> Cc: "dl6dbh" @.>, "Author" @.> Betreff: Re: [poulou0/nextcloud-homeassistant-integration] config ? (Issue #6)

 

The long lived token can be generated from your profile settings as described in the first minute of this video https://youtu.be/p6v5ygpGZHg?si=A_5o5XfU2q7eoxq9

The template widget area gets HTML and jinja2 code. You can find an example in your insurance under Developer Tools > Template

https://jinja.palletsprojects.com/en/latest/templates/
https://www.home-assistant.io/docs/configuration/templating/

If you are more of a video tutorial person:

https://youtu.be/m1aqyX6LXlo?si=iTn5YkvtmM9EjUyf
https://youtu.be/GnW0mLt2YLg?si=GInC7zNDXqGqWgGV

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

poulou0 commented 1 year ago

No problem, hope it helps, a simple example from my use case can be:

Kitchen light: {{ states.switch.kitchen_light.state }}

A slightly fancier one:

<div class="inlineblock">Kitchen light:</div>
<img src="/apps/user_status/img/user-status-{{ 'online' if is_state('switch.kitchen_light', 'on') else 'invisible' }}.svg" alt="kitchen light" style="vertical-align: middle" />
dl6dbh commented 1 year ago

thanks 

its is not running yet

see attachment . i dont now why

 

Meinolf

 

   

Gesendet: Sonntag, 27. August 2023 um 19:59 Uhr Von: "Poulou" @.> An: "poulou0/nextcloud-homeassistant-integration" @.> Cc: "dl6dbh" @.>, "Author" @.> Betreff: Re: [poulou0/nextcloud-homeassistant-integration] config ? (Issue #6)

 

No problem, hope it helps, a simple example from my use case can be:

Kitchen light: {{ states.switch.kitchen_light.state }}

A slightly fancier one:

Kitchen light:
kitchen light

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

poulou0 commented 1 year ago

Hi, i see that you reply via email.. your attachment didn't go through..

Try replying from a browser here https://github.com/poulou0/nextcloud-homeassistant-integration/issues/6

dl6dbh commented 1 year ago

home

dl6dbh commented 1 year ago

my momently config. any mistake in the syntax ?

poulou0 commented 1 year ago

I don't see anything wrong at first glance... try making a template in home assistant and then copy paste it in the nextcloud.

image

dl6dbh commented 1 year ago

i have testet the template in the developer tool. it became an result the protocol from nextcloud write following:

ehler no app in context GuzzleHttp\Exception\ClientException: Client error: POST http://192.168.200.53:8123/api/template resulted in a 400 Bad Request response: Invalid header value char: b'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkNzg0ZjhlODg3Yzk0Z (truncated...) /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php - line 69: GuzzleHttp\Exception\RequestException::create("* sensiti ... ")/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 204: GuzzleHttp\Middleware::GuzzleHttp{closure}(" sensiti ... *")/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 153: GuzzleHttp\Promise\Promise::callHandler()/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/TaskQueue.php - line 48: GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}("** sensiti ... ")/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 248: GuzzleHttp\Promise\TaskQueue->run()/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 224: GuzzleHttp\Promise\Promise->invokeWaitFn()/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 269: GuzzleHttp\Promise\Promise->waitIfPending()/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 226: GuzzleHttp\Promise\Promise->invokeWaitList()/var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php - line 62: GuzzleHttp\Promise\Promise->waitIfPending()/var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php - line 187: GuzzleHttp\Promise\Promise->wait()/var/www/html/nextcloud/lib/private/Http/Client/Client.php - line 297: GuzzleHttp\Client->request()/var/www/html/nextcloud/apps/integration_homeassistant/lib/Service/HassIntegrationService.php - line 34: OC\Http\Client\Client->post()/var/www/html/nextcloud/apps/integration_homeassistant/lib/Dashboard/TemplateWidget.php - line 65: OCA\HassIntegration\Service\HassIntegrationService->getWidgetItems()/var/www/html/nextcloud/apps/integration_homeassistant/lib/Dashboard/TemplateWidget.php - line 54: OCA\HassIntegration\Dashboard\TemplateWidget->getItems()/var/www/html/nextcloud/lib/private/Dashboard/Manager.php - line 114: OCA\HassIntegration\Dashboard\TemplateWidget->load()/var/www/html/nextcloud/lib/private/Dashboard/Manager.php - line 138: OC\Dashboard\Manager->loadLazyPanels()/var/www/html/nextcloud/apps/dashboard/lib/Controller/DashboardController.php - line 101: OC\Dashboard\Manager->getWidgets()/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 230: OCA\Dashboard\Controller\DashboardController->index()/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 137: OC\AppFramework\Http\Dispatcher->executeController()/var/www/html/nextcloud/lib/private/AppFramework/App.php - line 183: OC\AppFramework\Http\Dispatcher->dispatch()/var/www/html/nextcloud/lib/private/Route/Router.php - line 315: OC\AppFramework\App::main()/var/www/html/nextcloud/lib/base.php - line 1071: OC\Route\Router->match()/var/www/html/nextcloud/index.php - line 36: OC::handleRequest()
poulou0 commented 1 year ago

Hmm make sure that in your token there is no "new line character" \n (Enter) after the last part.

dl6dbh commented 1 year ago

bingo . thanks for help by the way i must edit the config.php in nextcloud and inline 'allow_local_remote_servers' => true,

poulou0 commented 1 year ago

Great thanks for telling! I will include all this knowledge in the next release! :)

Cheers