Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install info for beginners #10

Open
Jrmason25 opened this issue Nov 1, 2024 · 6 comments
Open

Install info for beginners #10

Jrmason25 opened this issue Nov 1, 2024 · 6 comments

Comments

@Jrmason25
Copy link

Jrmason25 commented Nov 1, 2024

First of all a big thank you for doing the leg work! I am new to esp32 and home assistant but managed to get this operational. Use api and not mqtt in your yaml files if possible for pushing data, it's much easier. I struggled to get mqtt data pushed correctly. Also make sure to move the .h file into your esphome directory within HA. Here's my code:

substitutions:
name: esphome-web-4c5ff8
friendly_name: RENOGYproxy2
ble_mac_address: FF:FF:FF:FF:FF

esphome:
name: ${name}
includes:
- renogy_rover_utilities.h
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev

esp32:
board: esp32dev
framework:
type: arduino

logger:

api:
encryption:
key: **********************

ota:

  • platform: esphome

improv_serial:

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

captive_portal:

dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
import_full_config: true

esp32_improv:
authorizer: none

esp32_ble_tracker:
scan_parameters:
active: true

text_sensor:

  • platform: template
    name: "Rover Load Status"
    id: load_status

  • platform: template
    name: "Rover Charging Status"
    id: charging_status

sensor:

  • platform: template
    name: "Rover Battery Percentage"
    id: battery_percentage
    device_class: "battery"
    unit_of_measurement: "%"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Battery Voltage"
    id: battery_voltage
    device_class: voltage
    unit_of_measurement: "V"
    accuracy_decimals: 1

  • platform: template
    name: "Rover Battery Current"
    id: battery_current
    device_class: "current"
    unit_of_measurement: "A"
    accuracy_decimals: 2

  • platform: template
    name: "Rover Battery Temperature"
    id: battery_temperature
    device_class: "temperature"
    unit_of_measurement: "°C"
    accuracy_decimals: 1

  • platform: template
    name: "Rover Controller Temperature"
    id: controller_temperature
    device_class: "temperature"
    unit_of_measurement: "°C"
    accuracy_decimals: 1

  • platform: template
    name: "Rover Load Voltage"
    id: load_voltage
    device_class: voltage
    unit_of_measurement: "V"
    accuracy_decimals: 1

  • platform: template
    name: "Rover Load Current"
    id: load_current
    device_class: current
    unit_of_measurement: "A"
    accuracy_decimals: 2

  • platform: template
    name: "Rover Load Power"
    id: load_power
    device_class: "power"
    unit_of_measurement: "W"
    accuracy_decimals: 0

  • platform: template
    name: "Rover PV Voltage"
    id: pv_voltage
    device_class: voltage
    unit_of_measurement: "V"
    accuracy_decimals: 1

  • platform: template
    name: "Rover PV Current"
    id: pv_current
    device_class: current
    unit_of_measurement: "A"
    accuracy_decimals: 2

  • platform: template
    name: "Rover PV Power"
    id: pv_power
    device_class: "power"
    unit_of_measurement: "W"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Max Charging Power Today"
    id: max_charging_power_today
    device_class: "power"
    unit_of_measurement: "W"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Max Discharging Power Today"
    id: max_discharging_power_today
    device_class: "power"
    unit_of_measurement: "W"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Charging Amp Hours Today"
    id: charging_amp_hours_today
    unit_of_measurement: "Ah"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Discharging Amp Hours Today"
    id: discharging_amp_hours_today
    unit_of_measurement: "Ah"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Power Generation Today"
    id: power_generation_today
    device_class: "energy"
    state_class: total_increasing
    unit_of_measurement: "Wh"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Power Consumption Today"
    id: power_consumption_today
    device_class: "energy"
    unit_of_measurement: "Wh"
    accuracy_decimals: 0

  • platform: template
    name: "Rover Power Generation Total"
    id: power_generation_total
    device_class: "energy"
    state_class: total_increasing
    unit_of_measurement: "kWh"
    accuracy_decimals: 1

  • platform: ble_client
    ble_client_id: renogy_rover_esp32_bc
    id: renogy_rover_esp32_sensor
    internal: true
    type: characteristic
    service_uuid: FFF0
    characteristic_uuid: FFF1
    notify: true
    update_interval: never

    on_notify:

    then:

    - lambda: |-

    ESP_LOGD("ble_client.notify", "x: %.2f", x);

    lambda: |-
    // A variable x of type esp32_ble_tracker::ESPBTDevice is passed to the automation for use in lambdas. (from docs)
    int receivedSize = x.size();
    ESP_LOGD("ble_client_lambda", "Received bytes size: %d", receivedSize);
    // Log each byte in the array
    for (size_t i = 0; i < receivedSize; ++i) {
    ESP_LOGD("main", "Response Byte %d: 0x%02X", i, x[i]);
    }
    if (receivedSize < 73) return NAN;

    HandleRoverData(x);
    return 0.0; // this sensor isn't actually used other than to hook into raw value and publish to template sensors

ble_client:

  • mac_address: ${ble_mac_address}
    name: Renogy Rover
    id: renogy_rover_esp32_bc
    auto_connect: true
    on_connect:
    then:
    - logger.log:
    format: "BLE client connected to rover"
    level: DEBUG
    on_disconnect:
    then:
    - logger.log:
    format: "BLE client disconnected from rover"
    level: DEBUG

interval:

  • interval: 30s
    then:
    • ble_client.ble_write:
      characteristic_uuid: "FFD1"
      service_uuid: "FFD0"

      id: renogy_rover_esp32_bc
      value: !lambda |-
      vector<uint8_t> request = GetRoverRequest();
      return request;

binary_sensor:

  • platform: ble_presence
    mac_address: ${ble_mac_address}
    name: "Renogy BLE Presence Rover"
    entity_category: "DIAGNOSTIC"

web_server:

ss

@Jrmason25
Copy link
Author

Jrmason25 commented Nov 2, 2024 via email

@riker65
Copy link

riker65 commented Nov 2, 2024

Hi, wondering where you pass the device id for the rover.
In my case it is 17 for device 16.
I assume it should be passed in getroverdata?

thx

@Jrmason25
Copy link
Author

Jrmason25 commented Nov 2, 2024 via email

@riker65
Copy link

riker65 commented Nov 4, 2024 via email

@riker65
Copy link

riker65 commented Nov 4, 2024

working now with my dievice id fixed - actual device id is 17.

wondering what issues you had with mqtt, esphome is automated sending the senser states

just define mqtt server and thats it.

topc: topicprefix/sensor/rover_load_power/state 0

image

@Jrmason25
Copy link
Author

Jrmason25 commented Nov 4, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants