SEPIA-Framework / sepia-docs

Documentation and Wiki for SEPIA. Please post your questions and bug-reports here in the issues section! Thank you :-)
https://sepia-framework.github.io/
238 stars 16 forks source link

Add Events (calender / alarm ) to my android device and reverse | android app download #117

Closed royrogermcfreely closed 2 years ago

royrogermcfreely commented 3 years ago

Hey,

as i saw on your Twitter Page this picture: https://twitter.com/sepia_fw/status/1136013539334938624/photo/1

i was wondering how i get this?

i tried it with webconsole, smartphone and tablet. but i never get the links. do i have to enable some options for this?

2.) if its possible to put it into my calender, can i get maybe somehow my events from my nextcloud calender into sepia? maybe via caldav?

3.) is there a other way to download the apk? i have devices without google services and from apkpure i can only get the 0.22 version.

greetings roy

ps: do you know when sepia will get the next update? just asking if i should put more time into to work with home assistant or wait till the next update and see if its still necessary.

fquirin commented 3 years ago

Hi Roy,

The "Calendar" button should appear inside the Android app automatically. It only works there because it uses the Android intention system so it will not appear inside the browser. I just double-checked my Android apps and can confirm its still there on all of my devices. If you don't see it inside your Android app please post your Android version (as many details as possible) and the app APK version.

can i get maybe somehow my events from my nextcloud calender into sepia

This is something I would be very interested in too. As far as I know it has not been tried yet, but I think technically it should be possible. To make this happen we need a few things:

is there a other way to download the apk?

Yes, each SEPIA-Home release offers the APK as well, check the "Assets" section at the bottom of the latest release :-)

do you know when sepia will get the next update?

I hope very soon. The current update has gotten a bit out of control since I've rebuilt the web audio lib completely together with an update of Porcupine wake-word engine and a new speech recognition server :sweat_smile: . Currently I'm trying to find the last bugs, fine tune everything and then prepare the release. Compatibility to the current version will be very high so you should be able to do a "simple" update later ... just maybe don't start with the old STT Server (v1) anymore if you don't run it yet ;-)

royrogermcfreely commented 3 years ago

i checked it again and the solution was that i have to click the icon and then the options were there :) info: when i set a alarm for tomorrow 8 oclock and want to import it to my alarm app it will go off on the same day at 8 oclock.

This is something I would be very interested in too. As far as I know it has not been tried yet, but I think technically it should be possible. To make this happen we need a few things:

how are the events stored in sepia? maybe vdirsyncer is a solution for that https://github.com/pimutils/vdirsyncer im trying to sync my nextcloud events with my own mail server with that - but can try it in few days

Yes, each SEPIA-Home release offers the APK as well, check the "Assets" section at the bottom of the latest release :-)

thanks, found it

Currently I'm trying to find the last bugs, fine tune everything and then prepare the release.

nice to hear :)

fquirin commented 3 years ago

i checked it again and the solution was that i have to click the icon and then the options were there :)

ah yes, true. I think I've mentioned somewhere in the tutorial that "some cards might have" this feature :sweat_smile:

how are the events stored in sepia? maybe vdirsyncer is a solution for that https://github.com/pimutils/vdirsyncer

Interesting, that might be useful.

Events (as most of the user-specific data) are stored in the SEPIA database as "user data list". I've added an example to the API docs page how to read alarms (this includes timers and reminders).

The result is a little bit complex but basically it is an array of "lists": [[{...}, {...}, ...], ...] that contains your time events (timers, alarms , ...). If your requests looks exactly like the one in the docs you could get all time events via timeEvents = result.lists[0] and then look for timeEvents[0].title == "timer" or timeEvents[0].title == "alarmClock". Finally you should see something like that (alarm example):

"indexType": "alarms",
"data": [
    {
        "date": "16.07.2021",
        "eleType": "alarm",
        "eventId": "alarm-1626419600000-961",
        "repeat": "onetime",
        "name": "Meeting with XY",
        "lastChange": 1626419600000,
        "time": "10:00:00",
        "day": "16.07.2021",
        "targetTimeUnix": 1626429600000,
        "activated": false
    }
],
"section": "timeEvents",
"_id": "AW6z....",
"title": "alarmClock",
"lastEdit": 1626419600000,
"user": "uid1007"

If this is too complicated I could maybe add an easier endpoint to the server :-).

royrogermcfreely commented 2 years ago

hey,

was playing arround if i get the alarms via the api.

i can ping and authenticate with sepia via the api but i cant get the alarms.

when i try this command: curl -X POST -H "Content-Type: application/json" -d '{"KEY": "uid1007;test123", "client": "b1_chrome_browser", "device_id": "b1", "get": {"lists":[{"section": "timeEvents", "indexType": "alarms"}]}}' http://192.168.0.43:20721/userdata

i get this error: {"result":"fail","error":"400 or 500 bad request or communication error","code":"0"}

i am not really sure which value i should take for "client" and "KEY".

i tried "KEY" with my login pw and with the standard auth. token "test1234"

which section and indexType i have to choose to get the shooping list entries? or is it a diffrent way? edit: saw the example in the docs, so i have to use "todo".

fquirin commented 2 years ago

Hey roy,

you can use 2 different parameters to authenticate. The error you're getting is most likely an exception when trying to parse your login token. If you use clear text (for testing ^^) try this instead of "KEY":

"GUUID": "uid1007",
"PWD": "test123"

In a "production" environment you should use the authentication endpoint first to get the correct token for the "KEY" entry (use the same "client" for all calls afterwards).

royrogermcfreely commented 2 years ago

thanks, now i get the alarms / shopping- todolists :)

other question, how can i delte all alarms / shopping- todolists entries?

and is it possible to publish an mqtt message when i create a new alarm / list entry ? edit: can i start a script when there is a new alarm / shopping list entry?

fquirin commented 2 years ago

thanks, now i get the alarms / shopping- todolists :)

nice :-)

other question, how can i delte all alarms / shopping- todolists entries?

The easiest way is probably just using the app and quickly remove them via UI :laughing: . But ... the endpoint should support 3 methods: "set", "get" and "delete" so if you can successfully read the lists I think simply replacing "get": {...} by "delete": {...} should do the trick :-). Maybe create a test account first when experimenting with that :-p.

and is it possible to publish an mqtt message when i create a new alarm / list entry ?

Alarm events are synchronized between SEPIA clients via the chat server and I think the CLEXI server might "see" the events as well :thinking: . I will double-check tomorrow. In any case what you'd need to do is to listen to these events somehow and then convert them to MQTT messages. What do you use to broadcast MQTT messages? NodeRED or something?

royrogermcfreely commented 2 years ago

The easiest way is probably just using the app and quickly remove them via UI 😆 . But ... the endpoint should support 3 methods: "set", "get" and "delete" so if you can successfully read the lists I think simply replacing "get": {...} by "delete": {...} should do the trick :-). Maybe create a test account first when experimenting with that :-p.

i tried do replace "get" with "delete" but it gave me an error that the "id" is missing"


i got it working to sync sepia alarms /shoppinglist with nextcloud calendar / task :) and ask sepia about my nextcloud calendar / task entries.

it would be easier if the alarms/ items from sepia would get delteted after the sync so for the next time i get only items which are not yet synct and not have to filter which entries are allready on nextcloud and which not.

also i can ask sepia for the calendar / task entries from nextcloud, so i dont need them anymore in sepia

when i get the delete function working and how to recieve a new entriy i will publish under "discussion" how someone can integrate sepia with nextcloud.

fquirin commented 2 years ago

i tried do replace "get" with "delete" but it gave me an error that the "id" is missing"

Yes, I forgot that you have to know the list ID (the field is _id). This should work:

curl -X POST \
  http://[assist-server-host]/userdata \
  -H 'Content-Type: application/json' \
  -d '{
    "KEY": "[auth-token]",
    "client": "[client]",
    "device_id": "[device-id]",
    "delete": {
        "lists": [{
            "indexType": "todo",
            "section": "productivity",
            "_id": "AX6r-MTV5aBxLA0pMMm",
            "title": "test"
        }]
    }
}

When I checked this I remembered that deleting alarms and timers is actually an overwrite request via "set" and using the "_id" field as well. So if you want to delete all alarms for example you could use the set request with an empty "data": [] array I guess. I wanted to replace this with an actual, real "update" request a while ago that can target single entries and there is a working beta version, but I got stuck somehow and postponed it ^^.

i got it working to sync sepia alarms /shoppinglist with nextcloud calendar / task :) and ask sepia about my nextcloud calendar / task entries.

That sounds pretty awesome :star_struck:

when i get the delete function working and how to recieve a new entriy i will publish under "discussion" how someone can integrate sepia with nextcloud.

I'd be very interested to see that, especially since I was planning to spend some time with Nextcloud soon ^^.

royrogermcfreely commented 2 years ago

got everything working.

here is a little summary for what i did: Sepia-Discussions-Thread

thanks for the help /roy