muwerk mupplet Sensor Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications for sensors
|
Power, Voltage and Current sensor BL0397. More...
#include <mup_power_bl0397.h>
Public Member Functions | |
PowerBl0937 (String name, uint8_t pin_CF, uint8_t pin_CF1, uint8_t pin_SELi, int8_t interruptIndex_CF, uint8_t interruptIndex_CF1) | |
Power, Voltage and Current sensor BL0397.
The power_bl0397 mupplet measures current voltage (V), current (A) and power consumption (W) using a chinese BL0397 sensor as used in Gosund SP-1 switches.
topic | message body | comment |
---|---|---|
<mupplet-name>/sensor/voltage | <current-voltage> | Current voltage (V) as string. |
<mupplet-name>/sensor/current | <current-current> | Current current (A) as string. |
<mupplet-name>/sensor/power | <current-power> | Current power usage (W) as string. |
topic | message body | comment |
---|---|---|
<mupplet-name>/sensor/state/get | - | Causes current voltage, current, and power messages to be sent. |
<mupplet-name>/sensor/voltage/get | - | Causes current voltage message to be sent. |
<mupplet-name>/sensor/current/get | - | Causes current current message to be sent. |
<mupplet-name>/sensor/power/get | - | Causes current power message to be sent. |
|
inline |
Creates a new instance of BL0937 based power meter
name | Friendly name of the meter. |
pin_CF | BL0937 pin CF. BL0937 outputs a 50% duty PWM signal with frequency proportional to power usage |
pin_CF1 | BL0937 pin CF1. BL0937 outputs a 50% duty PWM signal with frequency eithe proportical to voltage (SELi high) or current (SELi low). |
pin_SELi | BL0937 pin SELi. If set to high, BL0937 outputs voltage proportional frequncy on CF1, low: current-proportional. |
interruptIndex_CF | Should be unique interrupt index 0..USTD_MAX_BLP_PIRQS. Used to assign a unique interrupt service routine. |
interruptIndex_CF1 | IRQ service index for CF1, Should be unique interrupt index 0..USTD_MAX_BLP_PIRQS. Used to assign a unique interrupt service routine. |