Integrate Batrium into Home Assistant part 1


What do i need?

  • Enough resourses available to run Mosquitto brooker and Watchmonudplistener
  • Some skill and follow my guide
  • https://github.com/Batrium/WatchMonUdpListener

If you run Homeassistant Core and especially not on ARM go here and read!!

https://secondlifestorage.com/index.php?threads/esperyd-s-raspberry-pi-project.999/post-73412

 

First of all there are basically 2(or 5+) ways of installing this.

Either you install Portainer as an addon in Home assistant or you install the WatchmonUDPListener via docker compose via a terminal.

Plugins must have or systems needed to manage

  • Simple file editor
  • Portainer to manage containers
  • Mosquitto brooker to be able to send and recieve MQTT messages

Extra is to have InfluxDB installed.

 

The data to add into configuration.yml. Be ware to add them to the correct section!!!

 

Under Sensor:

For copy paste find the data here: https://pastebin.com/QYH1wfMq

– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “Volt”
value_template: “{{ value_json.MaxCellVolt }}”
name: “Batrium max Cellvolt”
– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “Volt”
value_template: “{{ value_json.MinCellVolt }}”
name: “Batrium min Cellvolt”
– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “Volt”
value_template: “{{ value_json.AvgCellVolt }}”
name: “Batrium avg Cellvolt”
– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “%”
value_template: “{{ value_json.ShuntSOC }}”
name: “Batrium SOC”
– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “Volt”
value_template: “{{ value_json.ShuntVoltage }}”
name: “Batrium shunt volt”
– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “Ampere”
value_template: “{{ value_json.ShuntCurrent | round(2) }}”
name: “Batrium shunt Current”
– platform: mqtt
state_topic: “Batrium/3913/5732”
unit_of_measurement: “Wattage”
value_template: “{{ value_json.ShuntCurrent * value_json.ShuntVoltage | round(1) }}”
name: “Batrium Shunt wattage”

Under binary_sensor:

Link: https://pastebin.com/0KKKmKSu

– platform: mqtt
state_topic: “Batrium/3913/4732”
value_template: “{{ value_json.isCriticalBattOKState }}”
name: “Batrium isCriticalBattOKState”
payload_on: 1
payload_off: 0
– platform: mqtt
state_topic: “Batrium/3913/4732”
value_template: “{{ value_json.hasCriticalShuntVoltLo }}”
name: “Batrium hasCriticalShuntVoltLo”
payload_on: 1
payload_off: 0
– platform: mqtt
state_topic: “Batrium/3913/4732”
value_template: “{{ value_json.hasCriticalShuntVoltHi }}”
name: “Batrium hasCriticalShuntVoltHi”
payload_on: 1
payload_off: 0
– platform: mqtt
state_topic: “Batrium/3913/4732”
value_template: “{{ value_json.hasCriticalCellVoltLo }}”
name: “Batrium hasCriticalCellVoltLo”
payload_on: 1
payload_off: 0
– platform: mqtt
state_topic: “Batrium/3913/4732”
value_template: “{{ value_json.hasCriticalCellVoltHi }}”
name: “Batrium hasCriticalCellVoltHi”
payload_on: 1
payload_off: 0

 

Instructions

  • Make sure you have a MQTT brooker installed like Mosquitto
  • If you run Home assistant fully install portainer and simple editor.
    • Install Watchmonudplistener through portainer
    • Configure Watchmonudplistener
  • If you want to have Watchmonudplistener on other host or in pure Raspbian OS
    • Either you install it and run it via node.js or you make sure you have docker and docker-composer installed
    • Download or clone the repo: https://github.com/Batrium/WatchMonUdpListener
    • Run docker-compose up -d
    • Check logs with docker ps and docker logs <pid>
    • If it complains over the config copy it to the correct folder mentioned in docker-compose.yml
    • Configure the mqtt and Influxdb host settings and credentials in config.json
    • If you run influxdb make sure to create the database batrium
  • Edit the configuration.yaml in Home Assistant to have batrium sensors. See links above
  • Add some cards on a dashboard with your Batrium data.
    • Feel free to add more sensors. Just look under the payload folder 🙂

 

Liked it? Take a second to support daromer on Patreon!