Chapter 18 - Odoo 15 Development Book

List Connected Devices

After successfully connecting the devices and the IoT box with Odoo, we can see the connected devices from the IoT App > Devices. By default, it will display the list of devices grouped by the IoT Box. We can also see the connection status, whether it is connected or not, and the connection type, like over WiFi, USB, or Bluetooth.


We can see more details about the device by clicking any of the tiles.


Input from device

The IoT Devices that are popularly used is QR code scanners, cameras, etc. Odoo IoT Box may not support all the devices out there, so we may have to provide support for the device to communicate with the IoT box. You can find the list of supported devices on this page If your desired device is not on the list, we have to develop its driver.

Let’s say we are trying to connect a camera to the IoT box for capturing the image of incoming products in our shop. After connecting the device to the IoT Box and loading the drivers, the camera will be ready to go. Now we have to fetch the image from the camera. For that, we can add a new field on the stock.picking model.

class StockPicking(models.Model):
	_inherit = 'stock.picking'
	device_id = fields.Many2one('iot.device', string='IoT
                     Device',domain="[('type', '=', 'camera')]")
      ip_device = fields.Char(related="device_id.iot_id.ip")
      device_identifier = fields.Char(related='device_id.identifier')
	input_picture = fields.Binary()

There is a quality_iot module that is part of the Enterprise edition, and it contains a widget that allows us to request an image from the camera through an IoT box. We can use this widget to capture the image. So we can add this module to our depends list. We can also create our own widget if we want.

	depends : [ 'quality_iot'],

Now we can use the widget in the form view of the receipt transfer,

	<field name="device_id" required="1"/>
	<field name="ip_device" invisible="1"/>
	<field name="device_identifier" invisible="1"/>
	<field name="input_picture" widget="iot_picture"  options="{'ip_field': 'ip', 'identifier': 'device_identifier'}"/>

The user should select the Camera from the list of devices, and the IP and identifier of the device are necessary for the widget to communicate with the camera.

Install and update the module, and you will get a button to capture the image in the Receipt transfer form view. Clicking the button will request the IoT box to capture an image and will return the image data as a response. It will be saved in the binary field.

Access IOT box with SSH

The Odoo IoT Box is a raspberry pi based device running on the Raspbian OS, and we can access the IoT Box using SSH.

First, we have to make sure that the IoT Box and the computer are on the same WiFi network. We need the IP address of the IoT Box, which can be fetched from the form view of the box. For this example, let’s take as the IP address of the IoT Box.

    1. In the terminal, execute the command,

    $ ssh pi@

    pi@’s password:

    2. raspberry is the password, enter this into the prompt.

    3. After entering the password, the shell will be accessible. Now you can access the directory. The entire filesystem will now be ready to explore.

We can use this SSH connection to perform any debugging with the IoT Box. In most cases, the IoT box does not shut down properly, so to avoid corruption of the system, the IoT Box filesystem is read-only.

As the IoT Box is connected only to the local machine, we cannot remotely access the IoT box through SSH. For that, we have to use the ‘ngrok’ service. The ngrok authentication key has to be provided on the Remote debugging page of the IoT Box.



Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message