Files
esphome-dev/esphome/components/ruuvi_ble/ruuvi_ble.h
T
Alexander Leisentritt 3e8fd48dc0 implemented ruuvi_ble and ruuvitag with RAWv1 and RAWv2 protocol (#810)
* implemented ruuvi_ble and ruuvitag with RAWv1 protocol

fixes esphome/feature-requests#313

* lint

* updated data calculations

* cpp lint

* use string directly in message

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* add RAWv2 protocol support

* fix ICON_SIGNAL

* typo

* calculation correction and cleaning

* c++ lint

* added acceleration and fixed typo

* removed remote_receiver to reduce firmware size

remote_receiver also in test1.yaml
2019-11-07 22:10:09 +01:00

38 lines
1006 B
C++

#pragma once
#include "esphome/core/component.h"
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
#ifdef ARDUINO_ARCH_ESP32
namespace esphome {
namespace ruuvi_ble {
struct RuuviParseResult {
optional<float> humidity;
optional<float> temperature;
optional<float> pressure;
optional<float> acceleration;
optional<float> acceleration_x;
optional<float> acceleration_y;
optional<float> acceleration_z;
optional<float> battery_voltage;
optional<float> tx_power;
optional<float> movement_counter;
optional<float> measurement_sequence_number;
};
bool parse_ruuvi_data_byte(uint8_t data_type, const uint8_t *data, uint8_t data_length, RuuviParseResult &result);
optional<RuuviParseResult> parse_ruuvi(const esp32_ble_tracker::ESPBTDevice &device);
class RuuviListener : public esp32_ble_tracker::ESPBTDeviceListener {
public:
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
};
} // namespace ruuvi_ble
} // namespace esphome
#endif