mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-19 06:32:05 +02:00
21 lines
661 B
Python
21 lines
661 B
Python
# Copyright 2020 Creu Blanca
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
from odoo import models
|
|
|
|
|
|
class IotDevice(models.Model):
|
|
_inherit = "iot.device"
|
|
|
|
def get_iot_configuration(self):
|
|
self.ensure_one()
|
|
return {
|
|
"host": self.env["ir.config_parameter"].sudo().get_param("web.base.url"),
|
|
"name": self.name,
|
|
"outputs": {
|
|
output.name: output.get_configuration() for output in self.output_ids
|
|
},
|
|
"inputs": {
|
|
iot_input.name: iot_input.get_configuration()
|
|
for iot_input in self.input_ids
|
|
},
|
|
}
|