1

I followed this link : https://developers.google.com/assistant/sdk/guides/service/python/extend/custom-actions

And I successfully create three actions files. and it works individually. but when I test all together like deploying three action packages:

./gactions update --action_package MqttAct.json --action_package action.json --action_package MesureTemp.json --project rpi3-0001-ga-******

I found that only two packages will work. it's like we can't have more than two action packages?

shilovk
  • 11,718
  • 17
  • 75
  • 74
Guopeng Li
  • 81
  • 1
  • 9

1 Answers1

0

I'm surprised you can even deploy two packages at the same time. The idea is that you have one action package, which can contain a variety of actions merged together.

Here is a merged action package, based on the documentation:

{
"manifest": {
    "displayName": "Blinky light",
    "invocationName": "Blinky light",
    "category": "PRODUCTIVITY"
},
"actions": [
    {
        "name": "com.example.actions.BlinkLight",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.BlinkLight",
            "parameters": [
                {
                    "name": "number",
                    "type": "SchemaOrg_Number"
                },
                {
                    "name": "speed",
                    "type": "Speed"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "blink ($Speed:speed)? $SchemaOrg_Number:number times",
                    "blink $SchemaOrg_Number:number times ($Speed:speed)?"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Blinking $number times"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.BlinkLight",
                                "params": {
                                    "speed": "$speed",
                                    "number": "$number"
                                }
                            }
                        }
                    ]
                }
            }
        }
    },
   {
        "name": "com.example.actions.BlonkLight",
        "availability": {
            "deviceClasses": [
                {
                    "assistantSdkDevice": {}
                }
            ]
        },
        "intent": {
            "name": "com.example.intents.BlonkLight",
            "parameters": [
                {
                    "name": "number",
                    "type": "SchemaOrg_Number"
                },
                {
                    "name": "speed",
                    "type": "Speed"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "blonk ($Speed:speed)? $SchemaOrg_Number:number times",
                    "blonk $SchemaOrg_Number:number times ($Speed:speed)?"
                ]
            }
        },
        "fulfillment": {
            "staticFulfillment": {
                "templatedResponse": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "Blonking $number times"
                            }
                        },
                        {
                            "deviceExecution": {
                                "command": "com.example.commands.BlonkLight",
                                "params": {
                                    "speed": "$speed",
                                    "number": "$number"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
],
"types": [
    {
        "name": "$Speed",
        "entities": [
            {
                "key": "slowly",
                "synonyms": [
                    "slowly",
                    "slow"
                ]
            },
            {
                "key": "normally",
                "synonyms": [
                    "normally",
                    "regular"
                ]
            },
            {
                "key": "quickly",
                "synonyms": [
                    "quickly",
                    "fast",
                    "quick"
                ]
            }
        ]
    }
]
}
Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • Can you give me a example how to code that? I want to make some interactions among my actions. Sometimes I should exchange some parameters before doing the next action. I found Google has some predefined actions. Does it mean we can have a few actions files? – Guopeng Li May 15 '18 at 17:20
  • I added an example in the answer. – Nick Felker May 16 '18 at 19:04