Voice Control the £20 way

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • cliffwright
    Automated Home Guru
    • Mar 2007
    • 117

    #16
    Cool - great - pretty much there now!

    26k lines?! ... how many objects /modules do you have in your setup!?! ... Do you live in a 42 Bedroom mansion?


    In iOS Shortcuts:

    * Select "+" to create a new shortcut
    * Click "+ Add Action"
    * Using the search option, search for "GET" and select the "Get Contents of URL" option
    * Click the elipsis (...) to rename it to something you want - bear in mind this will be the thing you speak to Siri if you want to use Siri to do this ... ie if you name it "Toggle Garage Door", it'll work with the action "Hey Siri, Toggle Garage Door" .. so name it something you don't mind saying out loud if you intend to use Siri :-D
    * Click on the "URL" part to replace this with your Cortex IP / Objects URL
    * Select "Show more"
    * Make sure the method is set to POST
    * Expand the "Headers" option by selecting the right Chevron >
    * Click "+ Add new header"
    * Enter the key value as "Authorization" and Text value as "Basic <your Base64 encoded Authentication value you've grabbed from Postman>"
    * Make sure you've got the request body set to JSON
    * Hit "Done" if you completed the 2nd step above or "Next" if you didn't, and give it a name.

    It should look like this if you've followed the above

    iOSShortcut.jpg

    Hopefully this get you up and running - shout if you need anything else

    Clearly you can include any Cortex action like this ... so there's tonnes of scope
    Last edited by cliffwright; 6 December 2020, 09:28 PM.
    www.clifford-wright.co.uk/blog

    Comment

    • chris_j_hunter
      Automated Home Legend
      • Dec 2007
      • 1713

      #17
      yes - quite a few modules, real & virtual ...

      in my day job, I learnt that sensor fusion was good, and it needed plenty of inputs ...

      plus our house is open-plan ... so need more to distinguish ...

      iOS Shortcuts ...

      after Select "+" to create a new shortcut ...

      we don't see the next step - there's clearly a space to make an input, but no +, no response to tapping in the space, no way on initiating one ...

      we're running iOS 12.4.9 ...

      wonder if there's a bug ...

      Chris

      PS: our iPhones are 6+ ... and some Googling suggests they won't work with Shortcuts ...

      we bought them late 2014 ...

      so ... do we update our 'phones, or do we switch to something else ...

      our gear is mostly Apple, but seems to me, for a while now, they are not what they were ...
      Last edited by chris_j_hunter; 8 December 2020, 12:38 AM.
      Our self-build - going further with HA...

      Comment

      • cliffwright
        Automated Home Guru
        • Mar 2007
        • 117

        #18
        Originally posted by chris_j_hunter View Post
        yes - quite a few modules, real & virtual ...

        in my day job, I learnt that sensor fusion was good, and that needed plenty of inputs ...

        plus our house is open-plan ... so need more to distinguish ...

        iOS Shortcuts ...

        after Select "+" to create a new shortcut ...

        we don't see the next step - there's clearly a space to make an input, but no +, no response to tapping in the space, no way on initiating one ...

        we're running iOS 12.4.9 ...

        wonder if there's a bug ...

        Chris

        PS: our iPhones are 6+ ... and some Googling suggests they won't work with Shortcuts ...

        we bought them late 2014 ...

        so ... do we update our 'phones, or do we switch to something else ...

        our gear is mostly Apple, but seems to me, for a while now, they are not what they were ...
        Sensor fusion? Sounds interesting ... what do you mean by this?



        Hmm .. I'm not sure. I'm using an iPhone 12 Pro running iOS 14.2.1. I'm no "Apple fanboy", but (and in the context that in my work, I've worked on projects developing mobile apps across both platforms, so used a wide range of devices from several flavours of tech companies) I find iOS very intuitive, whereas for whatever reason, I can't get on with Android as week and I'm a bit "tin foil hat" with Google having seen the amount of data they collect, aggregate and commoditise. I trust Apple's privacy more than Google (whilst not being naive enough to think Apple doesn't also see users' data as a commodity too).

        That said, as you're experiencing, Apple devices are "run out" over time, so you are tended to be forced to upgrade every few years.

        It's a personal preference clearly ..

        What use-case are you trying to achieve here exactly? Is it the "having a shortcut on your phone that's simpler than having to log into the Cortex Mobile Web" or the "voice control" aspect, or something else?
        www.clifford-wright.co.uk/blog

        Comment

        • chris_j_hunter
          Automated Home Legend
          • Dec 2007
          • 1713

          #19
          OK - after some tapping around / exploring on the 'phone I've managed to enter & set all you said ... and it seems to work ...

          but nothing happens (the Light that was switched from Postman is not switched) ...

          running it as a test, there's a response window - it says "Invalid user or password" ...

          have checked my typing, twice, but ... it has to be me having got something wrong - maybe I don't understand the format ...

          So will have lunch & watch the GP (recorded last night) & check / try again ...

          PS: eventually it worked - I deleted the Key & Text, and entered new ones (the Text by copy & paste from the old one) ... and, wow !

          have also got Siri in on the act ...

          so, phew ... and many thanks, once again !

          getting a button onto the Home screen hasn't yet done what I expected - ie: it doesn't just get the light turned on or off, but gets into editing the shortcut ...

          will try again ...

          have also to work out how to do the authorisation part in Applescript, too - to enable RFID tags to do the same ...


          Sensor fusion - meaning taking into account multiple sensors ... ie: in our case, using one or more General Logic objects to combine data from several modules to activate something or feed a virtual module or ...

          eg: open plan space, so Rooms without doors, several PLH / DRB / QBI / other modules => GL object which deduces where in the space motion was detected & feeds virtual PLHs on which which Room Presence depends ...

          in other words, the GL extracts something sensible from a situation in which multiple sensors were confusingly triggered ... as when a person is picked-up by a sensor in another room ...

          we also use GL to give context sensitivity - eg: from a sequence of triggers, deduce what a person is intending to do, or might have forgotten, or ... to help Cortex act appropriately ...

          and for having things work more conveniently - eg: operating yard gate & garage doors from button-presses in several locations, including such things as opening the gate to different degrees - for car, for bike, for people ...

          as well as things like NightNight - check doors & windows, cancel lighting scenes, warn of this or that being on or open or set, gate status, outside temperature & weather forecast, lights off, medical reminders, etc ...

          lots more examples ... headline statistics for our set-up are : 2858 objects, of which 799 logic objects, 259 modules, 229 virtual modules ...


          iPhone12 - have just watched Apple's last October presentation of HomePod Mini & iPhone12 ... and was impressed ...

          the HomePod Mini looks to be well thought-out, and am very tempted to buy a couple - to have Siri able to command Cortex in whatever ways ...

          and the iPhone12 - will have to see what our budget could allow ... wife's iPad is one of the first (early adopter) - a museum piece - so that's another consideration ...

          Android ... we have Android tablets around the house (for NoticeBoard display, including Met.Office weather forecasts, house data, spoken messages - in-case missed them) etc ... so have some inkling of what you mean - plus we are down to seven still working, about half the total - the failed ones all having frozen in some way, with resuscitation proving futile ... even the good ones often show messages that something or other (of no relevance to what we're running, Karam's app) has stopped working ...

          Cortex Mobile ... we still use it on iPhone & Android tablets, but we were looking for something more direct, for things like your garage door, so Home Screen buttons & Siri ... we having found, since we moved to Cortex W10, that the special buttons we'd included in Cortex Mobile via Menus no longer worked, seemingly due to incompatibilities with iOS - I gave up trying to sort it, but intend to get back to it, hopefully with a fresh mind ...

          Cortex e-mail - also stopped working when we moved to Cortex W10 - haven't been able to fathom it, could be an incompatibility with Google, but much of it is beyond me !

          Chris
          Last edited by chris_j_hunter; 8 December 2020, 12:09 AM.
          Our self-build - going further with HA...

          Comment

          • cliffwright
            Automated Home Guru
            • Mar 2007
            • 117

            #20
            Ah good .. hopefully something simple then .. let me know how you get on.

            The GP was good .. I was pleased and disappointed with the result in equal measure

            Interesting points about "Sensor fusion" .. I might have to play a little. Our house isn't open plan, but the family room is large enough to have both lounging, dining and a TV / sitting areas and the kitchen a kinda L shape where I treat this as 2 zones and control the lights accordingly .. some extra logic might make it more effective.


            Yes - I'd like to play with one of the Homepods too .. but earliest delivery of a mini is end of Jan at the minute ... I've not yet fully researched how it actually works. I believe the speaker in effect tells your device that hosts the shortcut to take action so I want to figure it out for sure. I've read somewhere there's support for "Multi person" context, so the speaker can know who was speaking to it and act accordingly which might offer some degree of interesting preference options.
            www.clifford-wright.co.uk/blog

            Comment

            • chris_j_hunter
              Automated Home Legend
              • Dec 2007
              • 1713

              #21
              GP - yes, we thought the same ...

              GL & virtual modules - so very useful, for so many things ... well worth a try ... we use them, too, for fixing all sorts of issues - eg: making sure our switch-dimmable lights cycle only when we want them too, run our bath or fill a bucket without us keeping an eye, cutting down on shower water usage, running dishwasher while we are asleep or no one about, etc, etc ...

              HomePods - yes, in the October presentation they mentioned that it could distinguish between people, and that two could also work co-operatively when appropriate (eg: working in stereo) ...

              Siri - it's great that there's no need to enter the Passcode before doing a long press of the Home button ...

              meaning (eg) ... in car, when arrive home, can simply press the Home button long and just tell Siri to open-up (gate, garage door, lights, announce arrival, etc) ... so simple & convenient, and safe (no distraction, can keep eyes on the road) ...
              Last edited by chris_j_hunter; 8 December 2020, 12:37 AM.
              Our self-build - going further with HA...

              Comment

              • cliffwright
                Automated Home Guru
                • Mar 2007
                • 117

                #22
                Originally posted by chris_j_hunter View Post
                GL & virtual modules - so very useful, for so many things ... well worth a try ... we use them, too, for fixing all sorts of issues - eg: making sure our switch-dimmable lights cycle only when we want them too, run our bath or fill a bucket without us keeping an eye, cutting down on shower water usage, running dishwasher while we are asleep or no one about, etc, etc ...
                Yeah - I'll have a play over the weekend to see what I can enhance.

                How do you cut down shower water usage? Are you actually cutting off the shower water, or just warning "users" after a period of time in the shower through flashing lights or something?

                I don't have any taps controlled by Cortex - what valves or taps are you using? How are you physically controlling the tap? I've not done anything like this so far because for small amounts of water (single cup fulls) I just don't see a need, but for bucket full's and bath-fills, I can see the point ...


                Originally posted by chris_j_hunter
                HomePods - yes, in the October presentation they mentioned that it could distinguish between people, and that two could also work co-operatively when appropriate (eg: working in stereo) ...

                Siri - it's great that there's no need to enter the Passcode before doing a long press of the Home button ...

                meaning (eg) ... in car, when arrive home, can simply press the Home button long and just tell Siri to open-up (gate, garage door, lights, announce arrival, etc) ... so simple & convenient, and safe (no distraction, can keep eyes on the road) ...

                For me, I don't have to press the home button (well, there isn't a home button on the iPhone X and up) .. I've accepted the crack in the tin-foil-hat and on m'phone, enabled the "Listen for Hey Siri" option .. so I don't have to touch my phone at all to make it open the garage door, but it doesn't seem to work whilst in my pocket, but fine if I leave my phone just "out" in the car.

                Originally posted by chris_j_hunter
                Cortex Mobile ... we still use it on iPhone & Android tablets, but we were looking for something more direct, for things like your garage door, so Home Screen buttons & Siri ... we having found, since we moved to Cortex W10, that the special buttons we'd included in Cortex Mobile via Menus no longer worked, seemingly due to incompatibilities with iOS - I gave up trying to sort it, but intend to get back to it, hopefully with a fresh mind ...

                Cortex e-mail - also stopped working when we moved to Cortex W10 - haven't been able to fathom it, could be an incompatibility with Google, but much of it is beyond me !

                I use Cortex mobile, but it really isn't "the best" ... I mostly use it locally in the house, and so whitelist my IP to avoid the login .. but even then, I find that every time I "return" to it after even a short period, it returns me to the home page again rather than leaving me in place ..

                When outside the house, I clearly then use a DDNS address with authentication, but again find the login doesn't persist at all and I find myself dead-ended on a page telling me I'm not authorized, but it doesn't return me to the login page again, so I have to then literally close the tab, open a new one, re-enter the Mobile address and login again .. it's just too faffy to be practical to perform quick actions (hence why this iOS Shortcut is a god-send).

                An iOS app with FaceId would be far better .. but I understand that it's an investment to produce ..


                Did you get your iOS Shortcut working in the end?
                www.clifford-wright.co.uk/blog

                Comment

                • chris_j_hunter
                  Automated Home Legend
                  • Dec 2007
                  • 1713

                  #23
                  iOS shortcuts ... yes, we did succeed ...

                  eventually, it all tumbled into place, and we now already have six shortcuts working, each also with Siri ...

                  and that’s a big thanks to you - your patience was much appreciated ...

                  we hadn’t reallised settings could be set to have Siri hands-free - but we now have that option selected, too ...

                  shame, though - it only works hands-off when connected to power - at least on our 'phones ...

                  Shortcuts - they seem to work fine pulsing relays (in DRBs & QRIs), but not with button presses (in QBIs) - was hoping to remotely do double-clicks ... will have another go later ...

                  working with Postman was very useful - being able to click code to see what was actually sent got me straight on how to code cURL instructions - the irrelevant examples available via Google having not helped at all ...

                  it was a long haul, but all this now means we can also write GET instructions in Applescript which work - via a Shell script ...

                  on the other hand, we can’t get POST instructions to work - which is odd, because the scripts for GET & POST are very similar ... and they both work in Postman, so why not in Applescript / Shell ??

                  of course, it’s the POST ones we really need to work - for our RFID tags to send commands to Cortex ...

                  ie: pass an RFID over a Mir:ror, connected to our MacBookPro, feeding Reflexio which then sends an Applescript POST to Cortex ... if only the POST would work !

                  shower, taps, etc - we found an affordable way to make all our water outlets automated ... Coastform no-touch sensors, vending-machine solenoids, and Swedish chromed gauze outlets (as fitted to many taps), triggered by Cortex relays ... add in some GL, and the outlets can be timed to run only so-long ... the so-long being context-sensitive - eg: shower on enough to wet, off while soap, on again to rinse ... and whatever for other outlets ...

                  Cortex Mobile ... yes, we have the same issues, plus the Menu-driven buttons no longer working ... we too white-list while in-house ... will now investigate DNNS + authentication for while we are outside ... at the moment we just require log-in ...

                  Chris
                  Last edited by chris_j_hunter; 9 December 2020, 07:47 PM.
                  Our self-build - going further with HA...

                  Comment

                  • Karam
                    Automated Home Legend
                    • Mar 2005
                    • 863

                    #24
                    I don't know anything about Applescript/Shell, but in case of relevance - there was a fix put into CortexW10 very recently to handle some aspect of the POST feature which didn't work the same as it did for GET (courtesy of feedback from Cliffwright, except I thought this only relevant when using the CortexW10 Client). Anyhow you could try a development update.

                    Comment

                    • chris_j_hunter
                      Automated Home Legend
                      • Dec 2007
                      • 1713

                      #25
                      ah ... could be, because the GET script runs & stops, in under a second, while the POST one just runs & runs ...

                      which maybe suggests all could be well at the Applescript end ...

                      both fine via Postman, though ...

                      will update at the next opportunity, fingers crossed ...
                      Last edited by chris_j_hunter; 9 December 2020, 04:50 PM.
                      Our self-build - going further with HA...

                      Comment

                      • cliffwright
                        Automated Home Guru
                        • Mar 2007
                        • 117

                        #26
                        Great - glad you're up and running - pleasure to help

                        The Issue I found that Karam describes is with the GET requests from Cortex (outbound traffic from Cortex fetching data back into Cortex) using the Web API Client it wasn't putting the Authorization Key-Value pair in the header appropriately, but for POST requests it was. A very swift turn around from Karam / Viv sorted it in the latest Development build though so all working perfectly now.

                        If I'm interpreting what you're saying correctly, you're firing a POST request IN to Cortex from your macBook / reflexio (what is reflexio btw?) ? This aspect (albeit from Postman) works fine for me even before this dev fix and is what you're doing in the iOS Shortcuts successfully to pulse relays in DRB's QRI's? ... If you can you successfully fire the POST request in Postman / iOS Shortcut, then it can't be a Cortex issue .. perhaps run the request through Wireshark / Fiddler etc between reflexio and Cortex to check what is coming out of the Applescript to compare it to what you see in Postman (that is successful)?

                        I don't have any QBI's to play with, but I've just had a little play with 'pressing buttons' on an SLD using the API's and I think I see the same thing. Grabbing the port info for just the "Button 1" port and forming;

                        POST /api/v1/Objects/Office Bedroom Dimmer Main Buttons?Button 1=1

                        works fine .. but;

                        POST /api/v1/Objects/Office Bedroom Dimmer Main Buttons?Double Click Button 1=1

                        doesn't seem to work (Whilst you get a 200 response).

                        @Karam - is this something you can look at? I "Think" the request is fine here .. (Apologies, I appear to be causing you grief these days finding these low level fiddly issues )


                        @Chris .. what action is your "Double click" taking? You can just hit that "thing" direct perhaps? for example, my theoretical example SLD has a Double click action of setting a certain scene ... so instead of doing;

                        POST /api/v1/Objects/Office Bedroom Dimmer Main Buttons?Double Click Button 1=1

                        To do a "Double press" .. I can do;

                        POST /api/v1/Objects/Office Bedroom Dimmer Main Dimmer?Set to Scene 2=1

                        which will achieve the same output and this approach seems to work on my SLD.




                        iOS Shortcuts for me don't demand the phone to be on charge .. not sure if that changed at any point in the iOS lifecycle but I've never known it to be a requirement (although didn't really use Siri much til now).

                        Interesting stuff on the Tap / Water front thanks .. will look into what you've said and consider it on my roadmap
                        www.clifford-wright.co.uk/blog

                        Comment

                        • chris_j_hunter
                          Automated Home Legend
                          • Dec 2007
                          • 1713

                          #27
                          Mir:ror & Reflexio :



                          download here :

                          Last edited by chris_j_hunter; 12 December 2020, 02:19 PM.
                          Our self-build - going further with HA...

                          Comment

                          • chris_j_hunter
                            Automated Home Legend
                            • Dec 2007
                            • 1713

                            #28
                            haven't tried POSTing to General Logic objects, yet - but, if all else fails, maybe can always create a Virtual Relay in Cortex, that triggers whatever ...

                            real or virtual, both seem to respond ...
                            Last edited by chris_j_hunter; 9 December 2020, 07:43 PM.
                            Our self-build - going further with HA...

                            Comment

                            • Karam
                              Automated Home Legend
                              • Mar 2005
                              • 863

                              #29
                              Buttons don't actually show that they have an (In) port when queried but posting a Button n=1 does act as a virtual button push. However the double click, single click and long push ports only look to be exposed as output ports. As you say it may be better to actually directly trigger whatever the double click is doing though this might be grouped into a macro if multiple items. Remember that one undesirable side effect of 'virtually pushing' a button is that Cortex will see this as someone has physically pushed it so the associated room occupancy will be affected. So if intent on using virtual buttons to do things it may be a good idea to put these outside the house.

                              Comment

                              • chris_j_hunter
                                Automated Home Legend
                                • Dec 2007
                                • 1713

                                #30
                                dimmer / scenes is not something we've explored - have always worked from the scenes end ... so will now explore ...

                                buttons - yes, more direct might be best ...

                                shortcuts - now we know how to do them, and can think of many many we might implement, maybe the trick is just to keep an eye, and implement just the few that will help most often ...

                                NB: we're already using the few we have created quite a lot - and those created on my 'phone, have been transferred also onto my wife's 'phone, without me asking ... not complaining, but how does that happen ?

                                Cortex update - have now updated, and no change ... ie: GET & POST work via Postman, only GET works via Applescript ... logic implies problem lies in Applescript ...

                                taps / water ... we have cold & warm outlets, each with an associated Coastform no-touch sensor ... feed to the bath is tripled and, when bath is being filled, we pause it while water is required elsewhere ... also, we have a Cleaning Mode, to block signals while house-chore cleaning is going-on ... our sensors command hot & cold individually, but could also be together, with combinations of short / longer / long waves used to signal whether hands or pans of buckets are what's needed to be filled ... plus, when we want our bath to be run, we have logic that first checks on available temperatures & warns accordingly - our ASHP + solar system is low in kW, as against gas boilers that are high in kW & so can manage fast response - big & wasteful as they are, they are soon to be banned ... there's a choice, too, of being prompted on relay activation or release - we went for the latter, because seemed more natural ...

                                Chris
                                Last edited by chris_j_hunter; 11 December 2020, 11:33 AM.
                                Our self-build - going further with HA...

                                Comment

                                Working...
                                X