Skip to content

Commit

Permalink
Merge PR #96 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by etobella
  • Loading branch information
OCA-git-bot committed Sep 13, 2024
2 parents c7b5d65 + daeb53e commit 6b35169
Show file tree
Hide file tree
Showing 28 changed files with 2,308 additions and 0 deletions.
90 changes: 90 additions & 0 deletions iot_template_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
=============
IoT Templates
=============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5394ea1bd728715365f1e558616d5a5e729d3d022698dfc172f2a0a1e83b59b7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fiot-lightgray.png?logo=github
:target: https://github.com/OCA/iot/tree/17.0/iot_template_oca
:alt: OCA/iot
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/iot-17-0/iot-17-0-iot_template_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/iot&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Create a system of templates for IoT devices.

When we are using a template we can configure a device with a simple URL
configuration. The device will contact odoo and send the template name.
Odoo will create the device and respond with all the expected data.

**Table of contents**

.. contents::
:local:

Usage
=====

1. Create a template with a module or in Iot > Templates
2. Access Iot > Config Device
3. Confirm that you want to configurate a new device
4. Copy the URL
5. Access the device and send it the configuration url
6. The device will contact odoo and automatically configure itself.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/iot/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/iot/issues/new?body=module:%20iot_template_oca%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Creu Blanca

Contributors
------------

- Enric Tobella <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/iot <https://github.com/OCA/iot/tree/17.0/iot_template_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions iot_template_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import controller
from . import models
from . import wizards
19 changes: 19 additions & 0 deletions iot_template_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2018 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "IoT Templates",
"version": "17.0.1.0.0",
"category": "IoT",
"author": "Creu Blanca, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"summary": "IoT module for managing templates",
"depends": ["iot_input_oca", "iot_output_oca"],
"website": "https://github.com/OCA/iot",
"data": [
"security/ir.model.access.csv",
"wizards/iot_device_configure.xml",
"views/iot_template_views.xml",
],
"demo": ["demo/iot_template.xml"],
}
1 change: 1 addition & 0 deletions iot_template_oca/controller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import iot_controller
25 changes: 25 additions & 0 deletions iot_template_oca/controller/iot_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import json

from odoo import http


class CallIot(http.Controller):
@http.route(
["/iot/<serial>/configure"],
type="http",
auth="none",
methods=["POST"],
csrf=False,
)
def configure_iot(self, serial, template, **kwargs):
request = http.request
if not request.env:
return json.dumps(False)
return json.dumps(
request.env["iot.device.configure"]
.sudo()
.configure(serial, template, **kwargs)
)
17 changes: 17 additions & 0 deletions iot_template_oca/demo/iot_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="demo_template" model="iot.template">
<field name="name">demo_template</field>
</record>
<record id="demo_template_serial" model="iot.template.key">
<field name="template_id" ref="demo_template" />
<field name="key">serial</field>
</record>
<record id="demo_template_input" model="iot.template.input">
<field name="template_id" ref="demo_template" />
<field name="name">demo_input</field>
<field name="call_model_id" eval="False" />
<field name="call_function">test_input_device</field>
<field name="params">{}</field>
</record>
</odoo>
Loading

0 comments on commit 6b35169

Please sign in to comment.