Giter Site home page Giter Site logo

samsung / ioter Goto Github PK

View Code? Open in Web Editor NEW
125.0 11.0 19.0 285.06 MB

Ioter released by Samsung is an open-source implementation of the Matter Thread Emulator

Home Page: https://twitter.com/ioter_matter

License: BSD 3-Clause "New" or "Revised" License

Shell 2.08% Python 97.92%
chip emulator iot matter openthread samsung internet-of-things connectedhomeip

ioter's Introduction

ioter-banner

Get started with ioter

ioter acts as a device emulator for developers, testers, and manufacturers of connected devices that are compliant with Matter and Thread.

Benefits include:

  • Flexibility: Multiple types of IoT devices can be implemented using a single RCP dongle.
  • Multi-Device support: Each RCP dongle supports a single device. ioter supports up to 10 RCP dongles at a time.
  • Low cost: Limited expenses for testing various IoT device types.
  • Time savings: Virtual devices on demand - no need to search for and procure multiple IoT device types.
  • Easy to use: Quickly control the status of devices from within ioter.
  • Automated testing: Repeated testing through scripts can validate device stability and connection.

ioter emulates all Matter supported devices with a Linux PC and Thread RCP dongle. ioter runs the all-clusters-app of Matter on a Linux PC to emulate multiple instances of various Matter supported IoT nodes. Each of these IoT nodes uses the underlying Thread RCP-based USB dongle (radio) for data transmission. By using the SmartThings Station as a border router and the SmartThings Application along with emulated IoT nodes, we can configure a smart home. This concept is demonstrated in the diagram below:

ioter_overview

Supported IoT devices (2023-04-27)

ioter supports a wide range of IoT devices including:

  • Light Bulb
  • Door Lock
  • Contact Sensor
  • Temperature Sensor
  • Humidity Sensor
  • Light Sensor
  • Window Covering
  • Occupancy Sensor
  • OnOff Plugin

Required tools

  • Bluetooth-enabled desktop or laptop.
  • Ubuntu 22.04 (prior versions have Bluetooth conflicts). All installation instructions have been validated on Ubuntu 22.04 LTS.
  • USB hub with power input (USB 3.0 recommended).
  • An onboarded SmartThings hub or SmartThings Station. An Apple HomePod (second gen) or HomePod Mini may also be used.
  • A Thread RCP USB dongle. Below you can find a list of compatible dongles and setup guides for each dongle:
    1. Nordic nrf52840 OT RCP dongle guide
      nordic_nrf52840_dongle
    2. Nordic nrf52840-DK board OT RCP board guide
      nrf52840dk
    3. Silabs thunderBoardSense2 OT RCP Silabs build&flash guide
      Silabs_thunderBoardSense2
    4. Silabs efr32-mighty-gecko-zigbee-and-thread-kit OT RCP Silabs build&flash guide
      Silabs_efr32-mighty-gecko-zigbee-and-thread-kit
    5. ESP32-H2-DevkitM-1 OT RCP ESP build&run guide
      ESP_esp32-h2-devkitm-1

Install and run ioter

  1. Install
cd ioter
./script/setup
  1. Run
cd ioter
./script/run

Alternatively, you can use a Docker image.

Onboard Matter supported devices

Before using ioter, ensure your SmartThings Station has been onboarded in the SmartThings app.

After initiating ioter with the run script, the main window will appear and allow you to select a device type.

  1. After selecting a device type in the ioter window, press the start button. The device control window will appear.
  2. In the device control window that appears, click the power on button. This is the same as the power operation of an actual device. A QR code will be generated that can be used to onboard the device.
  3. In the SmartThings app, click the add device button.
  4. Using the scan QR code option in the SmartThings app, scan the QR code shown in ioter. You may also pair using other options, including using a pairing code or scanning for nearby devices.

After onboarding your virtual device, your device is now controllable from within the SmartThings app.

Automated testing

Use Automations to validate the connectivity and stability of various IoT device types. Some examples of how you can do this include:

  • Test multiple devices in a loop.
  • Use the + or - button to add/remove onboarded device or sleep commands.

Automation scripts are saved in XML format and can be loaded on demand. Once executed, the progress bar shows the current completion percentage.

reference

  1. Starts/ends the loop.
  2. Add a command for the onboarded device.
  3. Add sleep for a given interval as specified below.
  4. Device type (light bulb, contact sensor, etc.).
  5. Supported commands for the onboarded device.
  6. Device command’s value (for example, light bulb is On or Off).
  7. Sleep interval, in seconds.
  8. Loop count and loop interval, in seconds.
  9. Clear all loops and commands.
  10. Run the automation script.
  11. Clear the log window.
  12. Script completion progress bar.
  13. The log window, showing activities including script loads, executions, saves, and number of successful/unsuccessful commands.

Device/sleep commands can be reordered by using the ↑ and ↓ buttons.

Known issues

1. Problem with specific linux kernel versions (higher than 5.16 and lower than 6.1.2)

The message below appears in the syslog:

kernel: wpan0 (unregistered): mctp_unregister: BUG mctp_ptr set for unknown type 65535

openthread/openthread#8523

Please use a stable kernel version of 5.15.0-60-generic

$ sudo apt-get install aptitude
$ sudo aptitude search linux-image
$ sudo aptitude install linux-image-5.15.0-60-generic
$ sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'
  ex)
    0 : menuentry 'Ubuntu, with Linux 5.19.0-32-generic' --class ubuntu
    1 : menuentry 'Ubuntu, with Linux 5.19.0-32-generic (recovery mode)'
    2 : menuentry 'Ubuntu, with Linux 5.15.0-60-generic' --class ubuntu
    3 : menuentry 'Ubuntu, with Linux 5.15.0-60-generic (recovery mode)'
$ sudo nano /etc/default/grub
   Find line GRUB_DEFAULT=...(by default GRUB_DEFAULT=0) and sets in quotes menu path to concrete Kernel.
   In my system first index was 1 and second was 2. I set in to GRUB_DEFAULT
   GRUB_DEFAULT="1>2"
$ sudo update-grub

2. With Ubuntu 20.04.2 LTS(Focal Fossa), there is a BLE connection issue while onboarding End Node. To use ioter please upgrade to Ubuntu 22.04 LTS or later.

project-chip/connectedhomeip#6347

Contributing

Interested in contributing to ioter? We welcome your contribution at any time. Visit our Contribution Guidelines for more information.

ioter's People

Contributors

bahubali-bg avatar doczillar avatar dooho-lee avatar ejunu avatar jinwon0325kim avatar junyong-sim avatar lboue avatar m-sataraddi avatar sam-tirth avatar sangsoolee avatar seungwookim99 avatar spdkimo avatar stardino2 avatar vedansh-bhardwaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ioter's Issues

[BUG] Humidity Sensor icon mismatch

There is an icon that Humidity Sensor is shown in the device search on SmartThings. But a icon on a device card created after onboarding is different from the previous one

Remove unused logs

Many logs are printing while ioter runs on stdout, most of logs from winman module are unnessary.
Example
#1
print('Window stopped moving', self.frameGeometry())

def winSet(self, w, h):
x, y = self.window_manager.add(w, h)
if x is not None:
print("MOVE to", x, y)
self.move(x, y)
else:
print("Cannot find a empty space", self.frameGeometry())
print('winSet()', self.frameGeometry())

#2
def create_device_window(self, deviceNum, discriminator, threadType, comPort, debugLevel, device_type):
print(
f"create_device_window - device number : {deviceNum} com port : {comPort}")
# print(
# f"create_device_window - device number : {deviceNum} com port : {comPort}")

[Light Bulb] Color Temperature is different

If the color Temp. is changed, The value on ioter is different from SmartThings. It can be improved as accurately as the light sensor once you refer to the code of light sensor.

update OT APIs

According to the comment of openthread community, we've changed the API signatures that are for using ot instance.

So, we should apply this changes to ioter.

[BUG] Failed to add Light sensor device type

[Step to reproduce]

  1. On SmartThings App, Device tab > + > Add device
  2. Enter setup code > Enther the code > Done
  3. Start > Error code occured

NOTE: Since This issue happened once, it is required to try to reproduce the similiar situation and save the log

Saving logs to file

ioter logs are being printed on screen, and it also need to save to file for issue analysis. It will especially helpful on the issue happens once/rarely

support NXP K32W dongle

Firmware : K32W0 SDK 2.6.11

After flashing the firmware, it returned "RadioSpinelNoResponse" error.

May 24 09:23:53 otbr-agent: [NOTE]-AGENT---: Backbone interface: wlan0
May 24 09:23:53 otbr-agent[2975558]: [NOTE]-AGENT---: Running 0.3.0-a032a864d2-dirty
May 24 09:23:53 otbr-agent[2975558]: [NOTE]-AGENT---: Thread version: 1.3.0
May 24 09:23:53 otbr-agent[2975558]: [NOTE]-AGENT---: Thread interface: wpan0
May 24 09:23:53 otbr-agent[2975558]: [NOTE]-AGENT---: Radio URL: spinel+hdlc+uart:///dev/ttyUSB0
May 24 09:23:53 otbr-agent[2975558]: [NOTE]-AGENT---: Radio URL: trel://wlan0
May 24 09:23:53 otbr-agent[2975558]: [NOTE]-ILS-----: Infra link selected: wlan0
May 24 09:23:53 otbr-agent[2975558]: [INFO]-NCP-----: OpenThread log level changed to 4
May 24 09:23:55 otbr-agent[2975558]: 58d.06:43:05.808 [W] Platform------: Wait for response timeout
May 24 09:23:55 otbr-agent[2975558]: 58d.06:43:05.808 [C] Platform------: HandleRcpTimeout() at radio_spinel_impl.hpp:2273: RadioSpinelNoResponse
May 24 09:23:55 systemd[1]: otbr-agent.service: Main process exited, code=exited, status=6/NOTCONFIGURED
May 24 09:23:55 systemd[1]: otbr-agent.service: Failed with result 'exit-code'.

Crash if there are nothing to onboarding

Crash occurs if there are no device requiring to Auto-onboarding

Traceback (most recent call last):
File "/home/iot/ioter/src/main.py", line 196, in start_auto_onboarding
self.auto_onboarding = self.create_dialog(self.auto_onboarding, auto_onboardingWindow)
File "/home/iot/ioter/src/main.py", line 163, in create_dialog
obj = cls_name(self)
File "/home/iot/ioter/src/auto_onboarding/auto_onboardingmain.py", line 140, in init
self.init_ui_setting()
File "/home/iot/ioter/src/auto_onboarding/auto_onboardingmain.py", line 166, in init_ui_setting
self.objs[0].combo_device_type.width())
IndexError: list index out of range

Sometimes 'main.py is not responding' message comes out

[Step to reproduce]

  1. on ioter, Select a device type and click 'Start'
  2. After device onboarding, Try to close the device window (or click Power on button)
  3. 'main.py is not responding' message comes out

[Cause]
Awaiting for the subprocess to exit, the delay could make the UI not operate, resulting in the error dialog shows up. But in this case, the device window and the error dialog would be disappeared shortly.

[Enhancement]
If there are any progress dialog shows during that time, user would feel comfortable

Default version is needed

There are SW version in Help > About. But it only works the environment that git is installed
ioter needs to have default version value

Support macOS

Currently, it is only available in Ubuntu.
Need to support macOS.

sync project-chip/connectedhomeip

We are using matter stack for ioter project. The "third_party/ioter-stable" submodule points out that.
But, the problem is that the base commit of it's submodule is not up to date (Sep 21, 2022).
So, we need to synchronize the latest code to apply some bug fixes with known patches.

Only one device can be onboarded at a time

Only one device can be onboarded at a time
The case of using multiple BLE dongles was not considered.
If it can be supported, multiple device can be onboarded at the same time.

Sometimes LightWindow crashes

When I start or close with Light bulb, it sometimes crashes
Here is a call stack;
Traceback (most recent call last):
File "/home/iot/ioter/src/things/light.py", line 311, in eventFilter
if (obj is self.spinboxDimming or obj is self.spinboxColorTemp) and event.type() == QEvent.KeyPress:
AttributeError: 'LightWindow' object has no attribute 'spinboxDimming'
Aborted (core dumped)

add CONTRIBUTING.md

There is no contributing guide. We need to create the guidelines that anyone can able to follow for ioter.

Wireless connection support

The device which is SmartThings app is installed should be connected via wire to do auto-onboarding currently.
If wireless connection is supported, it would be awesome.

[BUG] Brightness value is incorrect

The illuminance value is displayed in the ST app one less than the set value
if you set it to 999 in the ioter, it is displayed as 998 lux in the ST app, but the display of the horizontal bar is displayed as a value close to 100000 >
It is necessary to check whether it is ioter problem or mobile app problem

RCP failure when start simulated node

Setup envionment based on Ubuntu 22.04.2 running in VMware, plugged bluetooth dongle and silabs RCP dongle. When I start the program, always have error for RCP:

[2023-07-12 16:33:37.806089][76397:76397] CHIP:DL: dlsym success : otMessageGetLength
[2023-07-12 16:33:37.806108][76397:76397] CHIP:DL: symbol lookup success
[2023-07-12 16:33:39.825636][76397:76404] openthread: 50d.02:22:22.319 [W] Platform------: Wait for response timeout
[2023-07-12 16:33:39.825772][76397:76404] openthread: 50d.02:22:22.319 [I] Platform------: Software reset RCP successfully
[2023-07-12 16:33:41.835388][76397:76404] openthread: 50d.02:22:24.329 [W] Platform------: Wait for response timeout
[2023-07-12 16:33:41.835481][76397:76404] openthread: 50d.02:22:24.329 [W] Platform------: RCP failure detected
[2023-07-12 16:33:41.835493][76397:76404] openthread: 50d.02:22:24.329 [W] Platform------: Trying to recover (1/2)
[2023-07-12 16:33:43.842434][76397:76404] openthread: 50d.02:22:26.336 [W] Platform------: Wait for response timeout
[2023-07-12 16:33:43.842487][76397:76404] openthread: 50d.02:22:26.336 [I] Platform------: Software reset RCP successfully
[2023-07-12 16:33:45.851543][76397:76404] openthread: 50d.02:22:28.345 [W] Platform------: Wait for response timeout
[2023-07-12 16:33:45.851601][76397:76404] openthread: 50d.02:22:28.345 [W] Platform------: RCP failure detected
[2023-07-12 16:33:45.851611][76397:76404] openthread: 50d.02:22:28.345 [W] Platform------: Trying to recover (2/2)
[2023-07-12 16:33:47.861611][76397:76404] openthread: 50d.02:22:30.355 [W] Platform------: Wait for response timeout
[2023-07-12 16:33:47.861673][76397:76404] openthread: 50d.02:22:30.355 [I] Platform------: Software reset RCP successfully
[2023-07-12 16:33:49.867179][76397:76404] openthread: 50d.02:22:32.361 [W] Platform------: Wait for response timeout
[2023-07-12 16:33:49.867244][76397:76404] openthread: 50d.02:22:32.361 [W] Platform------: RCP failure detected
[2023-07-12 16:33:49.867266][76397:76404] openthread: 50d.02:22:32.361 [C] Platform------: Too many rcp failures, exiting
[2023-07-12 16:33:49.867277][76397:76404] openthread: 50d.02:22:32.361 [C] Platform------: RecoverFromRcpFailure() at radio_spinel_impl.hpp:2074: Failure
[2023-07-12 16:33:49.885752][76397:76404] CHIP:DL: dlclose success

Automation running fail

After 1 device onboarding, when launch automation, it fails.
See the below error

File "/home/constant/github/ioter/src/main.py", line 133, in start_automation
    self.automation = self.create_dialog(self.automation, automationWindow)
  File "/home/constant/github/ioter/src/main.py", line 116, in create_dialog
    obj = cls_name(self)
TypeError: automationWindow.__init__() missing 1 required positional argument: 'use_test_window'

[BUG] Set the Initial Value after Device Onboarding

There is a function that sets StartUpValue in the Matter code.
It seems to be necessary to synchronize values on the UI of Mobile App and Things after onboarding.
Previously, all-clusters-app initially set the initial value by initing the device manager,
The action of modifying this value is also delivered to the UI app, so the code was removed due to malfunction.
It would be desirable to lower the command to set the initial value after the onboarding success in the UI app.

[AutoOnboarding] Device dialog is closed when phone disconnects with ioter PC

Device dialog is closed when phone disconnects with ioter PC

state 4 comport ttyACM1 device_num 0
quit deviceNumber: 0 port:ttyACM1
exit_dialog : ttyACM1
terminateProcessTree : starting pid : 2349515
get child pid :  2349535
try to terminate :  2349535
[2023-06-29 13:37:01.062622][0] abort
[2023-06-29 13:37:01.063171][0] abort
get child pid :  2349534
get child pid :  2349533
get child pid :  2349532
PID change from 2349515 to -1

230629-1330-ioter.log
Uploading 230629-1335-onoffplugin-0.log…

Battery information is not supported

Contact Sensor, Temperature, and Humidity Sensor have a battery capability and it is being exposed at Routine on SmartThings. But it is not provided on plugins and ioter either

Delete things device

When deleting a connected device from the ST app, there is no related notification from the ioter.

[AutoOnboarding] Result dialog issue

After a repeat test ends, appearing result dialog shows 'Save and quit' and 'Quit', 'Save and quit' button doesn't save and doesn't quit

  1. Go to 'Auto onboarding'
  2. Select a device
  3. Repeat 10 times
  4. Wait

If another repeat test starts again, result dialog issue show up during test with wrong value

  1. Close result dialog
  2. Repeat 10 times again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.