Giter Site home page Giter Site logo

agent88-ha / mate3_homeassistant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chinezbrun/mate3_homeassistant

0.0 0.0 0.0 94 KB

Query MATE3/MATE3S using ModBus protocol, gets data, send MQTT and returns a json file that is used for HomeAssitant integration

Shell 0.47% Python 99.53%

mate3_homeassistant's Introduction

mate3_homeassistant

OutBackPower Mate3 integration with Home Assistant

Home Assistant

How does this software work?

This integration is based on ReadMateStatusModBus.py (RMS) output.

  • RMS creates a JSON file with almost all useful parameters extracted from Mate3 and send MQTT data for integrated ones. More functionalities of RMS can be configured in config file - ReadMateStatusModBus.cfg.
  • HA needs to be configured to receive MQTT or to decode the JSON file

ReadMateStatusModBus.py

  • Query MATE3/MATE3S, gets data, format, register in the database (optional), push MQTT data and returns a JSON file.
  • ReadMateStatusModBus.py script should run every X minute -- task should be created (windows or Linux)
  • ReadMateStatusModBus.cfg is the config file for this script -- should be configured based on your needs
  • same script is used also in https://github.com/chinezbrun/MonitorMate_ModBus

ReadMateStatusModBus.sh (is not mandatory)

Example of LINUX script that can be used to start ReadMateStatusModBus.py. The script should run with desire update frequency (ex. every minute) See your specific OS/distributions documentation for setting up daemons/tasks.

Home Assistant configuration

A new folder "data" should be created in "www" folder located in home-assistant (where the ex: \home-assistant\www\data). In this folder, the JSON file will be saved by RMS.

Integration variants:

  1. MQTT - predefined parameters
  2. MQTT - access to all parameters, option avalailable as of v1.0.1 topic: home-assistant/solar/mate, payload: json with all data
  3. JSON file decoding - access to all parameters

sensors should be defined in configuration.yaml

  1. variant MQTT - predefined sensors -- add below sensors in configuration.yaml:
# Example configuration.yaml entry
mqtt:    
  sensor:
    - name: "solar_ac_input"
      state_topic: "home-assistant/solar/solar_ac_input"
      unit_of_measurement: "V"
      state_class: "measurement"
    - name: "solar_ac_output"
      state_topic: "home-assistant/solar/solar_ac_output"
      unit_of_measurement: "V"
      state_class: "measurement"    
    - name: "solar_grid_status"
      state_topic: "home-assistant/solar/solar_ac_mode"
    - name: "solar_grid_input_mode"
      state_topic: "home-assistant/solar/solar_grid_input_mode"
    - name: "solar_charger_mode"
      state_topic: "home-assistant/solar/solar_charger_mode"
    - name: "solar_charge_mode"
      state_topic: "home-assistant/solar/solar_charge_mode"
    - name: "solar_ops_mode"
      state_topic: "home-assistant/solar/solar_operational_mode"
    - name: "solar_soc"
      state_topic: "home-assistant/solar/solar_soc"
      unit_of_measurement: "%"
      state_class: "measurement"
    - name: "solar_bat_voltage"
      state_topic: "home-assistant/solar/solar_bat_voltage"
      value_template: "{{value | round(1) }}"
      unit_of_measurement: "V"
      state_class: "measurement"   
    - name: "solar_bat_temp"
      state_topic: "home-assistant/solar/solar_bat_temp"
      unit_of_measurement: "grd"
      state_class: "measurement"
    - name: "solar_pv_watts"
      state_topic: "home-assistant/solar/solar_pv_watts"
      unit_of_measurement: "W"
      state_class: "measurement"
    - name: "solar_divert_amp"
      state_topic: "home-assistant/solar/solar_divert_amp"
      unit_of_measurement: "A" 
      state_class: "measurement"
    - name: "solar_used_amp"
      state_topic: "home-assistant/solar/solar_used_amp"
      unit_of_measurement: "A"
      state_class: "measurement"
    - name: "solar_since_charge_met"
      state_topic: "home-assistant/solar/solar_since_charge_met"
      unit_of_measurement: "days" 
      value_template: '{{value | round(2)}}'
    - name: "solar_charge_met"
      state_topic: "home-assistant/solar/solar_charge_met"
      unit_of_measurement: "" 
    - name: "solar_today_net_input_kwh"
      state_topic: "home-assistant/solar/solar_today_net_input_kwh"
      unit_of_measurement: "KWh" 
      value_template: '{{value | round(2)}}'
    - name: "solar_today_net_output_kwh"
      state_topic: "home-assistant/solar/solar_today_net_output_kwh"
      unit_of_measurement: "KWh" 
      value_template: '{{value | round(2)}}'
    - name: "solar_power_diversion_uptime"
      state_topic: "home-assistant/solar/power_diversion_uptime"
      unit_of_measurement: "days"
    - name: "mqtt_client_uptime"
      state_topic: "home-assistant/solar/mqtt_client_uptime"
      unit_of_measurement: "days"
  1. variant MQTT - add sensors like as per your needs, below example for one sensor:
# Example configuration.yaml entry
mqtt:    
  sensor:
    - name: solar_ac_input_file
	  state_topic: "home-assistant/solar/mate"
	  value_template: '{{ value_json.devices[0].ac_input_voltage }}'
  1. variant JSON decoding - add sensors like as per your needs, below are some examples:
# Example configuration.yaml entry
sensor:
  - platform: file
    name: solar_ac_input_file
    file_path: /config/www/data/status.json
    value_template: '{{ value_json.devices[0].ac_input_voltage }}'
    unit_of_measurement: 'v'  
  - platform: file
    name: solar_ac_output_file
    file_path: /config/www/data/status.json
    value_template: '{{ value_json.devices[0].ac_output_voltage }}'
    unit_of_measurement: 'v'

mate3_homeassistant's People

Contributors

chinezbrun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.