Re: [mh] Tasker MH Integration

Stephen Switzer <[email protected]>
Newsgroups gmane.comp.misc.misterhouse.user
Message-ID <CALSXUc361wtjzB85+xjGdvHfQXbbtyQPMhcNnyCu-57UrXdqGw@mail.gmail.com>
I finally finished the main videos, put them on a separate channel and I
plan to have a security video up next:

https://www.youtube.com/channel/UCdo2NOFf6bH8WLqBlqm9V_Q

The new code is committed to my repo:
https://github.com/pmatis/misterhouse/tree/tasker

However, just yesterday I noticed this Wiki entry:
https://github.com/hollie/misterhouse/wiki/Tasker,-AutoVoice-and-MisterHouse

and this video from Bruce:
https://www.youtube.com/watch?v=KP5ziWAsjdU

It's obvious that I'm not the first to consider this integration. Brian
Rudy put some work into this as well and he used a call to
bin/RUN;last_response. Is this a better way to make a call to a voice
command? I noticed that there's no return path to Tasker for the results of
the voice command except for the HTTP response. I found that some voice
commands don't generate a response before the HTTP connection closes and
thus we need an OOB response path. This is why I used AutoRemote to send
messages to the phone. This also gives us the ability to initiate messages
to the phone without waiting for it to reach out to MH. Perhaps Brian and I
could coordinate on this and merge our ideas if he's interested, then
update the Wiki.

Bruce has some really neat code that I think I'll implement on my own -
perhaps there will be an "example" created for this cellphone tracking and
query feature. I have my own version, but this has a nice feature that
relates location to some coordinates.

One major thing that I want to figure out is my hook code. In
Tasker_Interface.pm I have add_hook (and other related subs) that I copied
from bin/mh. I can create hooks but I found that with each reload of MH I
get another duplicate hook. I haven't looked at that in a week or two in
favor of finishing up other things. If anyone is feeling adventurous, I'd
welcome the second set of eyes. This is a snippet of my local code:

#TODO: I don't know why a "reload" adds more hooks for the same function
each time. I've tried adding "if $Reload" w/ and w/o noloop.
#      I did my bext to copy the bin/mh example for adding hooks to code,
but something isn't quite right the way it survives reloads.
#      Added reset_hook_code for now to handle this situation.
$TaskerInt->reset_hook_code(); #noloop
$TaskerInt->add_hook('tasker_notify_receive', \&test_tasker_notify); #noloop
$TaskerInt->add_hook('tasker_voice_command', \&test_tasker_cmd); #noloop
$TaskerInt->add_hook('tasker_voice_command_notfound',
\&test_tasker_cmd_unknown); #noloop

sub test_tasker_notify {
    my ($TaskerInt, $hookloc, $cmd, $api) = @_;
    print_log("test_tasker_notify $api | $cmd");

}
sub test_tasker_cmd {
    #my ($TaskerInt, $hookloc) = @_;
    print_log("test_tasker_cmd ... ".Dumper(%tasker_cmd));
    #$tasker_cmd{responsetxt}='New response';
}
sub test_tasker_cmd_unknown {
    print_log("test_tasker_cmd ... 404");
    if($tasker_cmd{cmdorig} =~ m/^go forth/i) {
        @tasker_responses=("Where shall I go?");
    }
}

This logs notifications from the phone and cmd calls. It also hooks
commands that are unknown to tasker_users.pl and allows you to add your
own. I can say "go forth" and it'll process this. However, adding the hooks
is inefficient. I'm missing something - probably simple.

Thanks everyone!
Steve




On Wed, Dec 2, 2020 at 5:26 PM Stephen Switzer <[email protected]> wrote:

> I created a demo video if anyone is interested to see what it does...
>
> https://www.youtube.com/watch?v=PR9ww044-IY
>
> Hopefully I sanitized the IDs and IP addresses. LOL
>
> Let me know your thoughts.
>
> On Fri, Nov 27, 2020 at 1:07 PM Brian M <[email protected]>
> wrote:
>
>> Stephen,
>>
>> As an ordinary user, I think that could be a very interesting addition to
>> MH. I feel the same regarding live microphones in my home. My automation
>> plans are going in a different direction, so it doesn't apply to me, but
>> don't let that project die.
>>
>>                                 -Brian M.
>>
>> On 11/27/20 8:55 AM, Stephen Switzer wrote:
>>
>> Does this mean nobody has interest? If not, then there must be another
>> option in use (maybe better?)
>> Perhaps I'll make a video on my implementation to see if that makes it
>> more appealing.
>>
>> Steve
>>
>> On Sun, Nov 8, 2020 at 7:12 PM Stephen Switzer <[email protected]>
>> wrote:
>>
>>> I don't know how much anyone else has worked on this, but I build a
>>> tasker interface for MH. I can create notification on any phone or device,
>>> have it upen a URL, speak, etc through AutoRemote. I can type commands and
>>> send them to MH with amazing speed. With AutoVoice, I can even speak a
>>> command from my phone and MH processes it and replies to my phone. Before I
>>> release the code in a pull request, I'd like to have someone set it up,
>>> take notes and give feedback.
>>>
>>> Any takers?
>>>
>>> Yes, I know that Google Home and Alexa have integrations. These are even
>>> fancier beyond most programmers' abilities. BUT, I cannot bring myself to
>>> have a microphone on and listening to everything in my home 24/7. I like
>>> the fact and *I* host it, *I* have control over it, etc. I will resist! If
>>> someone else (or some company) can "securely" give me access, that means
>>> they have the access to give - and can choose to not give it to me, or can
>>> be compelled to give it to another individual or agency, or can be hacked
>>> due to lazy and complacent programming.
>>>
>>> I guess I can't be lazy and complacent now, can I?  :) That's why I need
>>> peer review. Haha!
>>>
>>> Thanks!
>>>
>>> --
>>>
>>> Best regards,
>>> Steve Switzer
>>>
>>> ---
>>> Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget!http://www.sbsROC.com
>>>
>>>
>>
>> --
>>
>> Best regards,
>> Steve Switzer
>>
>> ---
>> Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget!http://www.sbsROC.com
>>
>>
>>
>> ________________________________________________________
>> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>>
>>
>> ________________________________________________________
>> To unsubscribe from this list, go to:
>> https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>>
>>
>
> --
>
> Best regards,
> Steve Switzer
>
> ---
> Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget!http://www.sbsROC.com
>
>

-- 

Best regards,
Steve Switzer

---
Get world-class business I.T. services and a phone system with awesome
features that won't challenge your budget!http://www.sbsROC.com

________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.