Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The component generation tool uses a template in YML to create the component's IDL and implementation.

Code Block
languagecppyml
titletuya_bulb.yml
linenumberstrue
working_dir: ~/home/developer/workspace
prefix: ACSIOT
module: acsiot
component_name: TuyaBulb
functions:
  - 'void turnOn(in string api_region, in string api_key, in string api_secret, in string device_id)'
  - 'void turnOff(in string api_region, in string api_key, in string api_secret, in string device_id)'

...

  1. In one terminal run:

    Code Block
    languagebash
    acsStop
    acsStart
  2. In a second terminal run:

    Code Block
    languagebash
    acsStartContainer -py aragornContainer
  3. And in a third terminal run:

    Code Block
    languagebash
    from Acspy.Clients.SimpleClient import PySimpleClient
      
    
    api_region = 'my_regionus'
    api_key = 'my_api_key'
    api_secret = 'my_api_secret'
    device_id = 'my_device_id'
    
    client = PySimpleClient()
    
    bulb = client.getComponent("TuyaBulbPython")
    bulb.turnOn(api_region, api_key, api_secret, device_id)
    bulb.turnOff(api_region, api_key, api_secret, device_id)
  4. If everything is ok you should have witnessed how the smart bulb lit on and off using ACS.