Call determinated actuator for Traits - google-assistant-sdk

I've a doubt... i'm starting with assistant SDK, and I dont know how make a differece between several actuators.
I've seen in google's guide how it works, but there I only can see the code for one actuator.
print('Do command', command, 'with params', str(params)) # Add the following:
if command == "action.devices.commands.OnOff":
if params['on']:
print('Turning the LED on.')
else:
print('Turning the LED off.')
My problem is that dont undertand how works the "if command" ... because here its only cheking if arrives from recognition "On" or "Off" but not define the destiny.
Supose that we have 2 independent lights... this code will turn on and off both at the same time. Although then in GPIO configuration I'll put 2 differents outputs the condition will be the same.
I should declare my actuators before and then change "action.devices.commands.OnOff" by "action.actuator1.commands.OnOff" and "action.actuator2.commands.OnOff" ?
Thanks a lot for any help... sorry if I did not explain myself well

If you want to control two separate subcomponents, you will want to create custom device actions with a pattern that includes a parameter for which item you want to turn on/off.

Related

Integromat Scenario: One-shot module after iterating through a loop

I have created a scenario where I iterate through multiple modules with an array of data. This works fine.
After this completes, I want to run a module once before the scenario completes.
How do I add a module that won't get called in the loop?
There are few ways to achieve this,
Use Router to Create a new Route that will be triggered after the
first route is complete
Trigger new Scenario via Webhooks after you are done with the
scenario
If you are working with array, then using Array Aggregator or other
Aggregators will allow you to first complete the iteration and then
trigger the module you want to use
I am not sure exactly what you want to do after the iteration is complete, but setting the scenarios as displayed in the screenshot below should help you get started on this,
Using Router
For this you can create a router, the upper hand of the router is always executed first, so the iterator and other operations will be done there. After which, the next hand/route will be executed which will be the module you want to trigger at last.
However, If you want to pass some values from the first hand/route to the last one then you will need to set a variable and fetch it on the second route. See details here : https://www.integromat.com/en/help/converger
Using Aggregator Module
You can either use Array, Text or Numeric Aggregator to aggregate all the iteration operations and then trigger the module that you want to use at last.
As far as my knowledge goes, there is no Integromat default modules that can be configured before the scenario ends. We can leverage the Integromat API in future that is currently in development to do so.
I found a filter to be the most easy way of doing this. Essentially chekcing if this bundle position is equal to the total number of bundles!
If you're interested in doing something on the last iteration only, you can use a filter to check if the current bundle is equal to the total number of bundles
last bundle filter
They won't let me paste pics sigh

In SAP UI5 `List` the "count-indicator" [ item-N / total-M ] is missing below the "More" button

I'm developing software for 40+ years but I'm absolutely new to SAP UI5, so maybe this is very basic or a trivial problem but half a day of searching the internet brought no results:
In a Master-Detail View (defined in xml) I want to display a list of items with growing=true, growingThreshold=50 and growingScrollToLoad=false as a List.
In principle it got everything working OK now. But there is a tiny glitch, not essential, more in the category of a "nice to have":
All the examples I've seen so far show something like "[ 50 / 107 ]" below the "More" button. But in my program it is missing. I'm very sure the reason is __count is not included in the response sent from the Odata-Service implementation.
Testing directly with the SAP Gateway Service Builder (/SEGW) shows to include the count in the response $inlinecount=allpages needs to be appended to the service URI. And here it works fine - once I add this to the URI the count is included, when I leave it out or set it to none there is no count included.
Therefore the problem seems not to be in the service implementation. (At least the __count field is present or not present as expected. And I assume this is what enables the "[ # / # ]" indicator.)
When the request is then sent from the controller (implemented in JavaScript) this part is not added to the service URI, despite the OData-Model is created with defaultCountMode: "sap.ui.model.odata.CountMode.InlineRepeat". On the "Network" page of Chrome's developer tools I don't see the $inlinecount=allpages appended and also the "[ 50 / 107 ]" (or whatever is appropriate) is not shown with the "More" button.
I checked with the Chrome developer tools immediately after creating the Odata-Model if my setting in the OData-Model takes effect – and it does. And I checked once more before a request is made based on this OData-Model – and it is still there.
My only idea now is it might have something to do with the fact the request originates from the XML-view (ie. the JavaScript code created on behalf of it) and it might be using a different Odata model in which that option is not set.
How can I test for this?
Any other ideas?
Maybe an internationalization issue? (The trigger-text for displaying more entries is set to "Weiter" in German language. Maybe also the "[ # / # ]" parts needs to be re-defined elsewhere too?
The answer in the comment of Boghyon Hoffmann solved the problem:
[Use] defaultCountMode: "InlineRepeat" instead of adding a fully qualified name in string.

Vimscript - Programmatically get colors from colorscheme

I'm trying to create an autocmd in Vimscript which sets a few attributes of the colorscheme as I want them. Specifically, I'm trying to make the NonText background have the same color as the regular background.
The problem is, I have no idea how to get a colorscheme's background color from within vimscript.
Anyone have any ideas?
Edit:
So here's what I'm trying to achieve. Actually a few things:
Originally, I was trying to hide the "~" that's in front of all non-existant lines. Someone suggested setting it as the same color as the background, so I added an autocmd that did this: hi NonText guifg=bg.
After doing that, I realized that some colorschems have a different background color for the regular lines and the "non-existant" part of the buffer. This is a problem, since my autocmd sets the NonText color to be the same as the regular background, not the special "non-existant" background.
Also, I decided that even without the whole "get rid of the ~" issue, I don't like it when the non-existant parts of buffers are a different color.
Lastly, I'm trying to learn about vim colorschemes in general, since I'm planning to write a plugin that will need some other tricks like figuring out the colors from schemes.
There are two approaches here:
Use hi NonText. Not alone, but with :redir, of course. I won’t describe it more verbose because I personally don’t like any solution using :redir for a number of reasons (they are: 1. requires parsing 2. no nested redirections 3. no way to know whether redirection is active).
Use synIDattr() and hlID():
let bgcolor=synIDattr(hlID('NonText'), 'bg#')
will assign something in form "#rrggbb" (just "N" in terminal) to variable bgcolor, or -1 if background was not defined for this group. You can use this to construct :hi command (regular background should be defined in Normal group).
Just use
hi link NonText Ignore
. Works unless your colorscheme has redefined Ignore group so that it actually is shown.
hi NonText guibg=bg
How about that?
EDIT after clarification from the OP:
Okey, let's go from the start. For now I'd put writing of a plugin on hold for a while until you get acquinted with the basic Vim settings and language. The characters, one of which is the ~ you're trying to hide, are so called list characters, and they can be defined in the listchars option. What yours are you can see by set listchars?. They can also be turned on/off (visible or invisible, I mean) by either set list / set nolist, or toggled on/off with set invlist.
The NonText highlighting group is the one that "covers" the display of those characters, but really the way to turn them on/off is via the setting, not via overwriting the background/foreground color of that group. Therefore my original confusion over your intentions. There is also a highlighting group SpecialKey that you might also find interesting, since it cover some cases.

Point of extension - Use case

Suppose I have a use case buy book, and the main flow is the following:
1- The user types the book code that he wants to buy
2- The system replies that there's enough stock of the requested book
3- The user confirm
Very simple.
Now suppose I want to give the option to the user to also do another thing between 2 and 3. How should I say it? I guess it's an extension to this use case, but I'm not sure where it's the point of extension.
As far as I know, if I choose, say, point of extension in 3, then the user has the opportunity to do 3 or do all the extension but not 3. The same behaviour of alternative flows.
But what I want is different. I want some "2.5" or nothing... do it or do nothing instead; not another thing.
I'm sorry for the vague question.
One option is the format recommended in Alistair Cockburn's Writing Effective Use Cases:
2a- User wants to do another thing:
2a1- The user does another thing
2a2- The system responds in some way, returns to step 3
Step 2a occurs after step 2 and before step 3. If the UC ends at step 2a2 then simply replace 'returns to step 3' with 'Use Case ends' or similar.
hth.
The problem here is the difference between the use case model in UML and use case descriptions. Extensions point is a concept from UML used to decouple extended and extending use cases. If you want adhere to this, you have to define the position of branching and returning back yourself, because UML says nothing about use case descriptions. I am personally as well as sfinnie a fan of Alistair Cockburns's approach to use cases, however it does not correspond well with the UML standard. There is yet another way, proposed by Bittner (Use case modeling book), who proposes to split the scenario into subflows with headlines.
I think what you actually want is an alternate path. An alternate path references a step in the main or in a different alternate path. I usually make that reference the Start step in the alternate. Then the End step is either a reference to where it returns to or an indication the path stops.

How do you make a combo of two emotes in lua in World of Warcraft work?

How do you make a combo of two emotes in lua in World of Warcraft work?
function Button2_OnClick()
PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav");
DoEmote("moon");
DoEmote("sit");
DoEmote("dance");
DoEmote("beckon");
end
I am using Wow Addon Studio to make a fart application on Wow.
I used this function, and only the sit motion showed, and beckon and moon only showed on the chat window. The dance emote didn't show up anywhere.
Blizzard has explicitly prohibited anything that can be used to make lua wait or pause because it is an essential ingredient to making a gold mining or grinding bot.
There isn't a native (i.e. lua only) way to have lua wait without using all the CPU. Outside of the WOW client, you'd use win.sleep or some other 3rd party API call that calls into the host application or operating systems threading functions.
It may be possible to simulate a wait by having code execute on a frequent event (such as text arriving at the chat window) and then in the event handler checking to see if enough time has passed to permit executing the next command in the sequence. This probably wouldn't be a very accurate timer and it would be rather complex as you'd have to create a data structure to hold the sequence of commands, the timings between each, the current command, etc. and so on.
This may be an intentional limitation of the API to prevent in game automation (botting).
What has worked for me is to have a global variable that is incremented through the loop. Such as
Integer count = 0;
function Button2_OnClick()
i++
switch
case(1)
PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav");
case(2)
DoEmote("moon");
case(3)
DoEmote("sit");
case(4)
DoEmote("dance");
case(5)
DoEmote("beckon");
default
i=0;
end
end
What you would have to do then is to click the button multiple times, but you would get the effect you're going for.
I would suggest you wait some time before doing the next emote. As far as I know, the server disconnects you if you spam too much. This might just trigger it sometimes.
Besides that, I guess maybe the client has a way of preventing it? In either case, I would suggest you add some sort of fraction-of-a-second delay between the emotes.
Cheers,
Amit Ron
Could it be that the last two can't be done while sitting?
infact, integer i = 0, because defining integer 'count' and then using i is incorrect. :)

Resources