Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Built-in Tasker integration #257

Closed
kubawolanin opened this issue Dec 25, 2016 · 25 comments
Closed

Feature: Built-in Tasker integration #257

kubawolanin opened this issue Dec 25, 2016 · 25 comments
Labels
enhancement Indicates new feature requests

Comments

@kubawolanin
Copy link

kubawolanin commented Dec 25, 2016

Currently openHAB Android client is a standalone app, with no connections with smartphone's sensors or environment.
I think that combining the power of the app with Tasker plugin would revolutionize a way we interact with our home automation system. Or, at least, make it easier to integrate multiple Android apps with HABdroid (is it still accurate name?:))

Here's one tutorial on how to create your own Tasker plugin and a thread on that matter as well.

Best regards,
Kuba

Bountysource

@watou
Copy link
Contributor

watou commented Dec 25, 2016

Agree! Along similar lines, I would like to be able to choose item names in the app which will be updated by the app based on location, motion, battery level, signal level, etc.

@kubawolanin
Copy link
Author

I created two mockups of basic plugin configuration steps.

In Tasker, after you choose the plugin and go to Configuration, you'd see a list of possible actions.
(e.g. Items Actions, Binding Actions, Things Actions... whatever our REST API allows us to use :))
I think we should focus on Items Actions at first. Baby steps.
1

And in the next screen you'd assign a command to the item you selected:
2

@kubawolanin kubawolanin changed the title Enhancement: Built-in Tasker integration Feature: Built-in Tasker integration Jan 8, 2017
@kubawolanin
Copy link
Author

kubawolanin commented Jan 8, 2017

openHAB Tasker integration

  • Display an openHAB icon in Tasker Actions / Plugin
  • Show a OpenHABTaskerActionActivity window (title: "Action configuration")
    • A list view of two elements: openHAB Item and command
      • Clicking Item element should open a dialog
        with radio list of all items (you can select only one item)
        with one button: Cancel
      • Clicking Command element should open a dialog
        with Text field and two buttons: Cancel, Save
    • Two buttons: Cancel, Done
  • Command element can receive Tasker variables (like %BATT)

I'm not a Java dev, but I started studying the docs and HABdroid's source code to get things going.
I encourage others (more experienced) to jump in! :)

@hakan42
Copy link

hakan42 commented Jan 9, 2017

Actually, I think it would be better to create a seperated Tasker plugin which is not too tightly integrated with the Android App.

That way, the plugin could be used for:

There are examples that show how a plugin for both services at once can be written.

@kubawolanin
Copy link
Author

Thanks @hakan42 for the input! What would be the benefit of having them maintained separately?

So is there anything to be done on HABdroid's side in order to communicate with the separate plugin?
At a glance, it seems that we would need a BroadcastReceiver to handle item's state change.

I found some examples already and I'm looking at the toast example from the Tasker docs, but to be fair, it's my first date with Android (I'm a JS dev) and it can take a while before I even start coding anything 🙂
Cheers

@hakan42
Copy link

hakan42 commented Jan 9, 2017

The main reason is, I don't believe in one application that does everything. And extending the Android App into Tasker area sounds like one thing that tries to do everything.

My personal philosophy is to create small tools that do one thing really well and leave it to the user to combine them into unexpected little gems. Therefore the plugin idea. You might also notice that OH2 and Tasker itself are basically a large number of plugins / addons that speak the same API.

@kubawolanin
Copy link
Author

kubawolanin commented Jan 9, 2017

I get your point, but in this case we would just extend HABdroid with additional feature (like NFC or Beacon integration, the only difference being wired to third party app and not the hardware).
See apps like Pushbullet, Unified Remote etc. These are also big apps but extended with Tasker Action.
I think it would alsp be easier to keep maintaining one app.

@watou
Copy link
Contributor

watou commented Jan 10, 2017

I don't see a problem adding Tasker integration, as long as it does not create any new mandatory dependencies or new/higher minimum requirements that non-Tasker users would have to contend with, and does not have any impact on licensing issues. For users who are uninterested in Tasker, they see no new UIs or other changes and the app continues to work as if nothing changed for them.

@rkoshak
Copy link

rkoshak commented Jan 10, 2017

As a heavy Tasker user I'll +1 for the idea. I do not think adding support for Tasker into Habdroid itself would necessarily be apparent to users who do not use Tasker. Looking at the examples @kubawolanin mention, there is no evidence of Tasker in the main application. It is only when you go into Tasker that you find it in Plugins (I'm not sure what the distinction between Plugins and 3rd Party is within Tasker but suspect Plugin is where this would fall).

At a minimum, exposing an intent that Tasker can call with the Item name update type (command or update) and state would be awesome for most commanding and sensor updates from the phone use cases. Personally that is all I would need for my use cases. This is how I control Waze and PocketCasts from Tasker and it works great.

However, with a proper plugin I can see the future possibility of commanding Tasker from OH which now can be achieved somewhat awkwardly through something like Pushbullet or SMS messages.

@kubawolanin
Copy link
Author

There was no progress on this feature for a long time, but I found an interesting repository yesterday.
@dereulenspiegel made a great Android app called HABSweetie some time ago :)
I couldn't make it work with my OH2, but the source code of Tasker integration is already there.
Maybe it would be worth to combine forces on this one and reuse @dereulenspiegel's work in HABDroid?

https://github.com/dereulenspiegel/HABSweetie/tree/master/App/HABSweetie/src/main/java/de/akuz/android/openhab/tasker

Besides the finding above, I started tinkering with the HABDroid code some time ago on this branch.

Cheers,
K

@digitaldan digitaldan added the enhancement Indicates new feature requests label Jul 8, 2017
@nbmaltais
Copy link

Is someone working on this? I think it would be a great idea.

@kubawolanin
Copy link
Author

@nbmaltais I think no one is working on this yet.

@mueller-ma
Copy link
Member

Can tasker send and receive android broadcasts?

@kubawolanin
Copy link
Author

@mueller-ma sorry for late response. On the Tasker docs page there are some references to BroadcastReceiver. It doesn't tell me much though 😉

Here's some introduction on Tasker plugin development.

Would you give it a try? Would be awesome!

Cheers

@mueller-ma
Copy link
Member

mueller-ma commented Apr 26, 2019

Tasker supports three different types of plugins: action, condition and event:

when event
then 
  if (condition) {
     action
  }

Event and condition plugins requires us to receive FCM messages when items update, which isn't possible right now and the same reason why #6 is blocked.

Action seems doable as well, since we have #1137 merged now.

  1. Create an activity ("EditActivity") that is started by tasker if someone selects openHAB as an action.
  2. Display all items as a list there
  3. On click, show a dialog and ask for the value.
  4. Return a bundle containing these two information (item + state)
  5. Enhance BackgroundTasksManager to start a worker if it receives the bundle from tasker

IMO we should start with action first. I'm not sure about the UI: Should the EditActivity just display a list of all items or should we display the sitemaps and let a user pick an item from there?
Sitemaps are user generated, so he knows best where to find an item.

Also following actions might be useful:
Change theme (Change between day and night theme)
Open sitemap
Start voice recognition

@rkoshak
Copy link

rkoshak commented Apr 26, 2019

Should the EditActivity just display a list of all items or should we display the sitemaps and let a user pick an item from there?
Sitemaps are user generated, so he knows best where to find an item.

From a user's perspective, I might not have any sitemap at all if I'm a HABPanel user. Also, I might not have the Item I want to interact with from Tasker on my sitemap.

As for displaying the list of items, I would hope the list is searchable? Some users have 1000+ Items.

@Confectrician
Copy link

I would also go for a list and not for a sitemap based Activty.
Besides richs points, one maybe wants to add some automation on top for items that are not in the sitemap.

@mueller-ma
Copy link
Member

The "PickItemActivity" can be used for multiple features (#538 and #6). My idea was to create multiple alias-activities with each an intent filter for tasker or widgets and assign the onClickListener based on the called alias activity.

mueller-ma added a commit to mueller-ma/openhab.android that referenced this issue May 4, 2019
mueller-ma added a commit to mueller-ma/openhab.android that referenced this issue May 4, 2019
mueller-ma added a commit to mueller-ma/openhab.android that referenced this issue May 4, 2019
@mueller-ma
Copy link
Member

Feel free to test: #1338 (comment)

Actually, I think it would be better to create a seperated Tasker plugin which is not too tightly integrated with the Android App.
That way, the plugin could be used for:

I disagree with creating a new app for this. The code used for the Tasker plugin is basically just the list to pick the items from and this list can be re-used in the future for other features.

@Confectrician
Copy link

@mueller-ma i read that it could be easily maintained within the current app source.
And i read that this would be the lowest effort related to maintainability.

If my readings are correct i would fully agree with you to keep it in one source. :)

@mueller-ma
Copy link
Member

Does it make sense to send state updates to groups?

@maniac103
Copy link
Contributor

Does it make sense to send state updates to groups?

Yes ... think e.g. roller shutters.

mueller-ma added a commit to mueller-ma/openhab.android that referenced this issue May 14, 2019
mueller-ma added a commit to mueller-ma/openhab.android that referenced this issue Jun 1, 2019
mueller-ma added a commit to mueller-ma/openhab.android that referenced this issue Jun 4, 2019
mueller-ma added a commit that referenced this issue Jun 4, 2019
@maniac103
Copy link
Contributor

@mueller-ma As #1338 is merged, can this one be closed now?

@kubawolanin
Copy link
Author

@mueller-ma big thanks for implementing this! :-) OH just became more powerful.

@mueller-ma
Copy link
Member

The app now supports Tasker variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

9 participants