BresserWeatherSensorReceiver
Bresser 5-in-1/6-in-1/7-in-1 868 MHz Weather Sensor Radio Receiver for Arduino based on CC1101 or SX1276/RFM95W
Loading...
Searching...
No Matches
WeatherSensor Class Reference

Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receiving FSK modulated signal at 868 MHz. More...

#include <WeatherSensor.h>

Classes

struct  AirCO2
 
struct  AirPM
 
struct  AirVOC
 
struct  Leakage
 
struct  Lightning
 
struct  Sensor
 sensor data and status flags More...
 
struct  Soil
 
struct  Weather
 

Public Types

typedef struct Sensor sensor_t
 Shortcut for struct Sensor.
 

Public Member Functions

int16_t begin (uint8_t max_sensors_default=MAX_SENSORS_DEFAULT, bool init_filters=true, double frequency_offset=0.0)
 Presence check and initialization of radio module.
 
void radioReset (void)
 Reset radio transceiver.
 
void sleep (void)
 Set transceiver into sleep mode.
 
bool getData (uint32_t timeout, uint8_t flags=0, uint8_t type=0, void(*func)()=NULL)
 Wait for reception of data or occurrence of timeout. With BRESSER_6_IN_1, data is distributed across two different messages. Reception of entire data is tried if 'complete' is set.
 
DecodeStatus getMessage (void)
 Tries to receive radio message (non-blocking) and to decode it. Timeout occurs after a multitude of expected time-on-air.
 
DecodeStatus decodeMessage (const uint8_t *msg, uint8_t msgSize)
 Decode message Tries the available decoders until a decoding was successful.
 
bool genMessage (int i, uint32_t id=0xff, uint8_t s_type=1, uint8_t channel=0, uint8_t startup=0)
 Generates data otherwise received and decoded from a radio message.
 
void clearSlots (uint8_t type=0xFF)
 Clear sensor data.
 
int findId (uint32_t id)
 
int findType (uint8_t type, uint8_t channel=0xFF)
 
void setSensorsInc (uint8_t *bytes, uint8_t size)
 
void setSensorsExc (uint8_t *bytes, uint8_t size)
 
void setSensorsCfg (uint8_t max_sensors, uint8_t rx_flags, uint8_t en_decoders=0xFF)
 
uint8_t getSensorsInc (uint8_t *payload)
 
uint8_t getSensorsExc (uint8_t *payload)
 
uint8_t convSensorsJson (std::vector< uint32_t > &ids, String json, uint8_t *buf)
 
void setSensorsIncJson (String json)
 
void setSensorsExcJson (String json)
 
String getSensorsJson (std::vector< uint32_t > &ids)
 
String getSensorsIncJson (void)
 
String getSensorsExcJson (void)
 
void getSensorsCfg (uint8_t &max_sensors, uint8_t &rx_flags, uint8_t &en_decoders)
 

Public Attributes

std::vector< sensor_tsensor
 sensor data array
 
float rssi = 0.0
 received signal strength indicator in dBm
 
uint8_t rxFlags
 receive flags (see getData())
 
uint8_t enDecoders = 0xFF
 enabled Decoders

 

Detailed Description

Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receiving FSK modulated signal at 868 MHz.

Member Function Documentation

◆ begin()

int16_t WeatherSensor::begin ( uint8_t  max_sensors_default = MAX_SENSORS_DEFAULT,
bool  init_filters = true,
double  frequency_offset = 0.0 
)

Presence check and initialization of radio module.

Returns
RADIOLIB_ERR_NONE on success (otherwise does never return).

◆ clearSlots()

void WeatherSensor::clearSlots ( uint8_t  type = 0xFF)
inline

Clear sensor data.

If 'type' is not specified, all slots are cleared. If 'type' is specified, only slots containing data of the given sensor type are cleared.

Parameters
typeSensor type

◆ convSensorsJson()

uint8_t WeatherSensor::convSensorsJson ( std::vector< uint32_t > &  ids,
String  json,
uint8_t *  buf 
)

Convert sensor IDs from JSON string to byte array

Parameters
idslist of sensor IDs
jsonJSON string
bufbuffer for storing sensor IDs
Returns
size in bytes

◆ decodeMessage()

DecodeStatus WeatherSensor::decodeMessage ( const uint8_t *  msg,
uint8_t  msgSize 
)

Decode message Tries the available decoders until a decoding was successful.

Returns
DecodeStatus

◆ findId()

int WeatherSensor::findId ( uint32_t  id)

Find slot of required data set by ID

Parameters
idsensor ID
Returns
slot (or -1 if not found)

◆ findType()

int WeatherSensor::findType ( uint8_t  type,
uint8_t  channel = 0xFF 
)

Find slot of required data set by type and (optionally) channel

Parameters
typesensor type
channelsensor channel (0xFF: don't care)
Returns
slot (or -1 if not found)

◆ genMessage()

bool WeatherSensor::genMessage ( int  i,
uint32_t  id = 0xff,
uint8_t  s_type = 1,
uint8_t  channel = 0,
uint8_t  startup = 0 
)

Generates data otherwise received and decoded from a radio message.

Returns
Always true (for compatibility with getMessage())

◆ getData()

bool WeatherSensor::getData ( uint32_t  timeout,
uint8_t  flags = 0,
uint8_t  type = 0,
void(*)()  func = NULL 
)

Wait for reception of data or occurrence of timeout. With BRESSER_6_IN_1, data is distributed across two different messages. Reception of entire data is tried if 'complete' is set.

Parameters
timeouttimeout in ms.
flagsDATA_COMPLETE / DATA_TYPE / DATA_ALL_SLOTS
typesensor type (combined with FLAGS==DATA_TYPE)
funcCallback function for each loop iteration. (default: NULL)
Returns
false: Timeout occurred. true: Reception (according to parameter 'complete') successful.

◆ getMessage()

DecodeStatus WeatherSensor::getMessage ( void  )

Tries to receive radio message (non-blocking) and to decode it. Timeout occurs after a multitude of expected time-on-air.

Returns
DecodeStatus

◆ getSensorsCfg()

void WeatherSensor::getSensorsCfg ( uint8_t &  max_sensors,
uint8_t &  rx_flags,
uint8_t &  en_decoders 
)

Get maximum number of sensors from Preferences

Parameters
max_sensorsmaximum number of sensors
rx_flagsreceive flags (see getData())
en_decodersenabled decoders

◆ getSensorsExc()

uint8_t WeatherSensor::getSensorsExc ( uint8_t *  payload)

Get sensors exclude list (Preferences/defaults)

Parameters
payloadbuffer for storing sensor IDs
Returns
size size in bytes

◆ getSensorsExcJson()

String WeatherSensor::getSensorsExcJson ( void  )

Get sensors exclude list as JSON string

Returns
JSON string

◆ getSensorsInc()

uint8_t WeatherSensor::getSensorsInc ( uint8_t *  payload)

Get sensors include list (Preferences/defaults)

Parameters
payloadbuffer for storing sensor IDs
Returns
size size in bytes

◆ getSensorsIncJson()

String WeatherSensor::getSensorsIncJson ( void  )

Get sensors include list as JSON string

Returns
JSON string

◆ getSensorsJson()

String WeatherSensor::getSensorsJson ( std::vector< uint32_t > &  ids)

Get sensors include/exclude list as JSON string

Parameters
idslist of sensor IDs
Returns
JSON string

◆ setSensorsCfg()

void WeatherSensor::setSensorsCfg ( uint8_t  max_sensors,
uint8_t  rx_flags,
uint8_t  en_decoders = 0xFF 
)

Set maximum number of sensors and store it in Preferences

Parameters
max_sensorsmaximum number of sensors
rx_flagsreceive flags (see getData())
en_decodersenabled decoders

◆ setSensorsExc()

void WeatherSensor::setSensorsExc ( uint8_t *  bytes,
uint8_t  size 
)

Set sensors include list in Preferences

Parameters
bytessensor IDs
sizebuffer size in bytes

◆ setSensorsExcJson()

void WeatherSensor::setSensorsExcJson ( String  json)

Set sensors exclude list from JSON string

Parameters
jsonJSON string

◆ setSensorsInc()

void WeatherSensor::setSensorsInc ( uint8_t *  bytes,
uint8_t  size 
)

Set sensors include list in Preferences

Parameters
bytessensor IDs
sizebuffer size in bytes

◆ setSensorsIncJson()

void WeatherSensor::setSensorsIncJson ( String  json)

Set sensors include list from JSON string

Parameters
jsonJSON string

The documentation for this class was generated from the following files: