Table of Contents

add_role

WattmonOS 3.12+

Add a role to the system roles, or modify an existing role based on its role ID.

Library

/lib/uphp/system.inc

Description

add_role ( int $id , string $role_name , int $role_group , int $role_type , int $role_show , int $role_def , string $role_devices )

Add a role to the system roles, or modify an existing role based on its role ID.

Parameters

$id: Role ID to update or -1 to add a new role

$role_name: Role name

$role_type: Role Type from any of the below

Role Type Description
0 Digital Output
1 Digital Input
2 Read Only Register (Modbus)
3 Read Write Register (Modbus)
4 OneWire Sensor role
5 Global Variable (name of the role is the variable name)

$role_show: Show (1) or Hide (0) the role where appropriate

$role_def: Role definition index. See table below.

Role Definition Description
0 Value (no processing)
1 Current
2 Voltage
3 Temperature
4 Pressure
5 Flow Rate
6 Wind Speed
7 Watts
8 Kilowatts

$role_devices: Comma-separated list of device type ids that this role can be linked to, if appropriate, or else “0”

Return Values

none