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

Home Assistant MQTT Sensors #11

Open
chrifey opened this issue Oct 1, 2022 · 0 comments
Open

Home Assistant MQTT Sensors #11

chrifey opened this issue Oct 1, 2022 · 0 comments

Comments

@chrifey
Copy link

chrifey commented Oct 1, 2022

For everyone who is using Home Assistant, I created the configuration for a few sensors within HA [1] based on the MQTT data.

My setup is using a local mosquitto instance on the raspberry pi where bb_mqtt is running, that is configured as bridge to publish the topics to another mosquitto instance running on my Home Assistant machine (the connection to there is via user/password over secure channel).

configuration.yaml

mqtt:
  sensor:
    - name: "Bluebattery_battery_voltage_V"
      state_topic: "service/bluebattery/live/measurement"
      unit_of_measurement: "V"
      value_template: "{{ value_json.battery_voltage_V | round(2)}}"
    - name: "Bluebattery_solar_charge_current_A"
      state_topic: "service/bluebattery/live/measurement"
      unit_of_measurement: "A"
      value_template: "{{ value_json.solar_charge_current_A | round(2)}}"
    - name: "Bluebattery_battery_current_A"
      state_topic: "service/bluebattery/live/measurement"
      unit_of_measurement: "A"
      value_template: "{{ value_json.battery_current_A | round(2)}}"
    - name: "Bluebattery_battery_charge_Ah"
      state_topic: "service/bluebattery/live/battery_comp_1"
      unit_of_measurement: "Ah"
      value_template: "{{ value_json.battery_charge_Ah }}"
    - name: "Bluebattery_state_of_charge_percent"
      state_topic: "service/bluebattery/live/battery_comp_1"
      unit_of_measurement: "%"
      value_template: "{{ value_json.state_of_charge_percent }}"
    - name: "Bluebattery_total_charge_day_Ah"
      state_topic: "service/bluebattery/live/battery_comp_2"
      unit_of_measurement: "Ah"
      value_template: "{{ value_json.total_charge_day_Ah | round(2)}}"
    - name: "Bluebattery_total_discharge_day_Ah"
      state_topic: "service/bluebattery/live/battery_comp_2"
      unit_of_measurement: "Ah"
      value_template: "{{ value_json.total_discharge_day_Ah | round(2)}}"
    - name: "Bluebattery_temperature_deg_C"
      state_topic: "service/bluebattery/live/battery_comp_2"
      unit_of_measurement: "°C"
      value_template: "{{ value_json.temperature_deg_C }}"
    - name: "Bluebattery_solar_module_voltage_V"
      state_topic: "service/bluebattery/live/solar_charger"
      unit_of_measurement: "V"
      value_template: "{{ value_json.solar_module_voltage_V }}"
    - name: "Bluebattery_max_solar_current_day_A"
      state_topic: "service/bluebattery/live/solar_charger"
      unit_of_measurement: "A"
      value_template: "{{ value_json.max_solar_current_day_A | round(2)}}"      
    - name: "Bluebattery_max_solar_watt_day_W"
      state_topic: "service/bluebattery/live/solar_charger"
      unit_of_measurement: "W"
      value_template: "{{ value_json.max_solar_watt_day_W | round(0)}}" 

[1] https://www.home-assistant.io/integrations/sensor.mqtt/

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

1 participant