Jump to content

SENSBLUE ATLAS/MQTT Actors: Difference between revisions

No edit summary
Line 4,139: Line 4,139:
After STOP, the buzzer is forced to OFF.
After STOP, the buzzer is forced to OFF.


=== 12. INA232 actor ===
=== 12. Power Monitor actor ===


==== 12.1 Overview ====
==== 12.1 Overview ====
The '''INA Actor''' is responsible for reading the ATLAS INA232 power monitor and publishing the measuredelectrical values through MQTT.
The '''Power Monitor actor''' is responsible for reading the ATLAS INA232 power monitor and publishing the measuredelectrical values through MQTT.


The actor publishes:
The actor publishes:
Line 4,164: Line 4,164:
The INA232 is a current, voltage, and power monitor with an I²C/SMBus interface. It reports current, busvoltage, and power values through internal registers. The calibration register must be configured to obtainvalid current and power results.
The INA232 is a current, voltage, and power monitor with an I²C/SMBus interface. It reports current, busvoltage, and power values through internal registers. The calibration register must be configured to obtainvalid current and power results.


==== 12.2 Actor Behaviour ====
==== 12.2 Runtime domain ====
The INA Actor shall:
'''- Automatic Runtime Publication'''
 
1. Start with a valid INA configuration.
 
2. Configure the INA232 device.
 
3. Read voltage, current and power once per second.
 
4. Publish the values to: '''ina/runtime/out'''
 
The actor does '''not''' need a request every second.
 
The publication is automatic and periodic.
 
==== 12.3 Required Configuration ====
The actor requires a small configuration to correctly read and convert the INA232 measurements.
{| class="wikitable"
|'''Field'''
|'''Type'''
|'''Required'''
|'''Description'''
|-
|enabled
|boolean
|Yes
|Enables or disables the INA actor
|-
|address
|string /integer
|Yes
|I²C address of the INA232 device
|-
|shunt_ohm
|number
|Yes
|Value of the shunt resistor in ohms
|-
|max_current_a
|number
|Yes
|Maximum expected current, used forcalibration
|-
|adcrange
|integer
|No
|INA232 shunt voltage range selection
|-
|publish_interval_ms
|integer
|Yes
|Runtime publish interval in milliseconds
|-
|rail_name
|string
|No
|Logical name of the monitored power rail
|}
 
* '''Default configuration'''
<syntaxhighlight lang="json" line="1">
{
  "enabled": true,
  "address": "0x40",
  "shunt_ohm": 0.020,
  "publish_interval_ms": 1000,
  "rail_name": "atlas_input_power"
}
</syntaxhighlight>
 
==== 12.4 Configuration domain ====
Configuration messages are sent to:
 
'''ina/config/in'''
 
Configuration replies are published on:
 
'''ina/config/out'''
 
'''- GET_CONFIG'''
 
Returns the current INA Actor configuration
 
'''Request'''<syntaxhighlight lang="json" line="1">
{
  "id": "<TIMESTAMP>",
  "origin": "APP",
  "task": {
    "action": "GET_CONFIG"
  }
}
</syntaxhighlight>'''Response'''<syntaxhighlight lang="json" line="1">
{
  "id": "<TIMESTAMP>",
  "origin": "INA",
  "task": {
    "action": "GET_CONFIG",
    "taskResult": {
      "success": true,
      "configured": true,
      "enabled": true,
      "address": "0x40",
      "shunt_ohm": 0.020,
      "publish_interval_ms": 1000
    }
  }
}
</syntaxhighlight>
 
==== 12.5 Runtime domain ====
Runtime messages are sent to:
 
'''ina/runtime/in'''
 
Runtime replies are published on:
 
'''ina/runtime/out'''
 
'''- Manual Runtime read'''
 
'''Request'''<syntaxhighlight lang="json" line="1">
{
  "id": "<TIMESTAMP>",
  "origin": "APP",
  "task": {
    "action": "GET_POWER"
  }
}
</syntaxhighlight>'''Response'''<syntaxhighlight lang="json" line="1">
{
  "id": "<TIMESTAMP>",
  "origin": "INA",
  "task": {
    "action": "GET_POWER",
    "taskResult": {
      "success": true,
      "voltage_v": 24.12,
      "current_a": 0.481,
      "power_w": 11.6
    }
  }
}
</syntaxhighlight>'''- Automatic Runtime Publication'''


Publish topic:
Publish topic: