TCP/IP - Outdoor Weather Bricklet

This is the description of the TCP/IP protocol for the Outdoor Weather Bricklet. General information and technical specifications for the Outdoor Weather Bricklet are summarized in its hardware description.

API

A general description of the TCP/IP protocol structure can be found here.

Basic Functions

BrickletOutdoorWeather.get_station_identifiers_low_level
Function ID:

1

Request:

empty payload

Response:
  • identifiers_length -- uint16
  • identifiers_chunk_offset -- uint16
  • identifiers_chunk_data -- uint8[60]

Returns the identifiers (number between 0 and 255) of all stations that have been seen since the startup of the Bricklet.

Each station gives itself a random identifier on first startup.

BrickletOutdoorWeather.get_sensor_identifiers_low_level
Function ID:

2

Request:

empty payload

Response:
  • identifiers_length -- uint16
  • identifiers_chunk_offset -- uint16
  • identifiers_chunk_data -- uint8[60]

Returns the identifiers (number between 0 and 255) of all sensors that have been seen since the startup of the Bricklet.

Each sensor gives itself a random identifier on first startup.

BrickletOutdoorWeather.get_station_data
Function ID:

3

Request:
  • identifier -- uint8
Response:
  • temperature -- int16
  • humidity -- uint8
  • wind_speed -- uint32
  • gust_speed -- uint32
  • rain -- uint32
  • wind_direction -- uint8
  • battery_low -- bool
  • last_change -- uint16

Returns the last received data for a station with the given identifier. Call get_station_identifiers_low_level for a list of all available identifiers.

The return values are:

  • Temperature in °C/10,
  • Humidity in %RH,
  • Wind Speed in m/10s,
  • Gust Speed in m/10s,
  • Rain Fall in mm/10,
  • Wind Direction (N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW),
  • Battery Low (true or false) and
  • Last Change (time in seconds since the reception of this data).

The following meanings are defined for the parameters of this function:

  • 0: n, for wind_direction
  • 1: nne, for wind_direction
  • 2: ne, for wind_direction
  • 3: ene, for wind_direction
  • 4: e, for wind_direction
  • 5: ese, for wind_direction
  • 6: se, for wind_direction
  • 7: sse, for wind_direction
  • 8: s, for wind_direction
  • 9: ssw, for wind_direction
  • 10: sw, for wind_direction
  • 11: wsw, for wind_direction
  • 12: w, for wind_direction
  • 13: wnw, for wind_direction
  • 14: nw, for wind_direction
  • 15: nnw, for wind_direction
  • 255: error, for wind_direction
BrickletOutdoorWeather.get_sensor_data
Function ID:

4

Request:
  • identifier -- uint8
Response:
  • temperature -- int16
  • humidity -- uint8
  • last_change -- uint16

Returns the last measured data for a sensor with the given identifier. Call get_sensor_identifiers_low_level for a list of all available identifiers.

The return values are:

  • Temperature in °C/10,
  • Humidity in %RH and
  • Last Change (time in seconds since the last reception of data).

Advanced Functions

BrickletOutdoorWeather.get_spitfp_error_count
Function ID:

234

Request:

empty payload

Response:
  • error_count_ack_checksum -- uint32
  • error_count_message_checksum -- uint32
  • error_count_frame -- uint32
  • error_count_overflow -- uint32

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

  • ACK checksum errors,
  • message checksum errors,
  • framing errors and
  • overflow errors.

The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.

BrickletOutdoorWeather.set_bootloader_mode
Function ID:

235

Request:
  • mode -- uint8
Response:
  • status -- uint8

Sets the bootloader mode and returns the status after the requested mode change was instigated.

You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.

The following meanings are defined for the parameters of this function:

  • 0: bootloader, for mode
  • 1: firmware, for mode
  • 2: bootloader wait for reboot, for mode
  • 3: firmware wait for reboot, for mode
  • 4: firmware wait for erase and reboot, for mode
  • 0: ok, for status
  • 1: invalid mode, for status
  • 2: no change, for status
  • 3: entry function not present, for status
  • 4: device identifier incorrect, for status
  • 5: crc mismatch, for status
BrickletOutdoorWeather.get_bootloader_mode
Function ID:

236

Request:

empty payload

Response:
  • mode -- uint8

Returns the current bootloader mode, see set_bootloader_mode.

The following meanings are defined for the parameters of this function:

  • 0: bootloader, for mode
  • 1: firmware, for mode
  • 2: bootloader wait for reboot, for mode
  • 3: firmware wait for reboot, for mode
  • 4: firmware wait for erase and reboot, for mode
BrickletOutdoorWeather.set_write_firmware_pointer
Function ID:

237

Request:
  • pointer -- uint32
Response:

no response

Sets the firmware pointer for write_firmware. The pointer has to be increased by chunks of size 64. The data is written to flash every 4 chunks (which equals to one page of size 256).

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.

BrickletOutdoorWeather.write_firmware
Function ID:

238

Request:
  • data -- uint8[64]
Response:
  • status -- uint8

Writes 64 Bytes of firmware at the position as written by set_write_firmware_pointer before. The firmware is written to flash every 4 chunks.

You can only write firmware in bootloader mode.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.

BrickletOutdoorWeather.set_status_led_config
Function ID:

239

Request:
  • config -- uint8
Response:

no response

Sets the status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets.

You can also turn the LED permanently on/off or show a heartbeat.

If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.

The following meanings are defined for the parameters of this function:

  • 0: off, for config
  • 1: on, for config
  • 2: show heartbeat, for config
  • 3: show status, for config
BrickletOutdoorWeather.get_status_led_config
Function ID:

240

Request:

empty payload

Response:
  • config -- uint8

Returns the configuration as set by set_status_led_config

The following meanings are defined for the parameters of this function:

  • 0: off, for config
  • 1: on, for config
  • 2: show heartbeat, for config
  • 3: show status, for config
BrickletOutdoorWeather.get_chip_temperature
Function ID:

242

Request:

empty payload

Response:
  • temperature -- int16

Returns the temperature in °C as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.

BrickletOutdoorWeather.reset
Function ID:243
Request:empty payload
Response:no response

Calling this function will reset the Bricklet. All configurations will be lost.

After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!

BrickletOutdoorWeather.write_uid
Function ID:

248

Request:
  • uid -- uint32
Response:

no response

Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first.

We recommend that you use Brick Viewer to change the UID.

BrickletOutdoorWeather.read_uid
Function ID:

249

Request:

empty payload

Response:
  • uid -- uint32

Returns the current UID as an integer. Encode as Base58 to get the usual string version.

BrickletOutdoorWeather.get_identity
Function ID:

255

Request:

empty payload

Response:
  • uid -- char[8]
  • connected_uid -- char[8]
  • position -- char
  • hardware_version -- uint8[3]
  • firmware_version -- uint8[3]
  • device_identifier -- uint16

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c' or 'd'.

The device identifier numbers can be found here

Callback Configuration Functions

BrickletOutdoorWeather.set_station_callback_configuration
Function ID:

5

Request:
  • enable_callback -- bool
Response:

no response

Turns callback for station data on or off. Default is off.

BrickletOutdoorWeather.get_station_callback_configuration
Function ID:

6

Request:

empty payload

Response:
  • enable_callback -- bool

Returns the configuration as set by set_station_callback_configuration.

BrickletOutdoorWeather.set_sensor_callback_configuration
Function ID:

7

Request:
  • enable_callback -- bool
Response:

no response

Turns callback for sensor data on or off. Default is off.

BrickletOutdoorWeather.get_sensor_callback_configuration
Function ID:

8

Request:

empty payload

Response:
  • enable_callback -- bool

Returns the configuration as set by set_sensor_callback_configuration.

Callbacks

BrickletOutdoorWeather.CALLBACK_STATION_DATA
Function ID:

9

Response:
  • identifier -- uint8
  • temperature -- int16
  • humidity -- uint8
  • wind_speed -- uint32
  • gust_speed -- uint32
  • rain -- uint32
  • wind_direction -- uint8
  • battery_low -- bool

Reports the station data every time a new data packet is received. See get_station_data for information about the data.

For each station the callback will be triggered about every 45 seconds.

Turn the callback on/off with set_station_callback_configuration (by default it is turned off).

The following meanings are defined for the parameters of this function:

  • 0: n, for wind_direction
  • 1: nne, for wind_direction
  • 2: ne, for wind_direction
  • 3: ene, for wind_direction
  • 4: e, for wind_direction
  • 5: ese, for wind_direction
  • 6: se, for wind_direction
  • 7: sse, for wind_direction
  • 8: s, for wind_direction
  • 9: ssw, for wind_direction
  • 10: sw, for wind_direction
  • 11: wsw, for wind_direction
  • 12: w, for wind_direction
  • 13: wnw, for wind_direction
  • 14: nw, for wind_direction
  • 15: nnw, for wind_direction
  • 255: error, for wind_direction
BrickletOutdoorWeather.CALLBACK_SENSOR_DATA
Function ID:

10

Response:
  • identifier -- uint8
  • temperature -- int16
  • humidity -- uint8

Reports the sensor data every time a new data packet is received. See get_sensor_data for information about the data.

For each station the callback will be called about every 45 seconds.

Turn the callback on/off with set_sensor_callback_configuration (by default it is turned off).