Hello all,
This is my first post, I’ve scoured the blogs for the answers, not finding them. But I’m having a few problems.
First, I have a OutbackPower Inverter/Charge Controller, Mate3s Hub PV Setup and can connect to the Mate3s to get JSON output.
My system is small so far, but it will grow. Currently 2kw with 6 panels. And I have a 75kw battery - all running at 48Volts.
Here are the details: Mate3s is living at 10.0.0.150
The Json delivered is in example below.
It runs fine, and I get “Unavailable” occasionally.
The data shows up ok for a while. then shows unavailable, then connects again and shows ok…
The problem may be timeouts to the http resource.
I’d like the data to stay static on the screen, even if it hiccups when getting the data.
Here is what my Lovelace page looks when working (note, this is when the sun was just coming up, so the values are small)
Here is the json example:
{"devstatus": {
"Gateway_Type": "Mate3s","Sys_Time": 1601009672,
"Sys_Batt_V": 54.1,
"ports": [
{ "Port": 1, "Dev": "FXR","Type": "60Hz","Inv_I_L2": 0,"Chg_I_L2": 0,"Buy_I_L2": 0,"Sell_I_L2": 0,"VAC1_in_L2": 0,"VAC2_in_L2": 0,"VAC_out_L2": 122,"AC_Input": "Grid","Batt_V": 54.0,"AC_mode": "NO AC","INV_mode": "Inverting","Warn": ["none"],"Error": ["none"],"AUX": "disabled"},
{ "Port": 2, "Dev": "CC","Type": "FM80","Out_I": 12.9,"In_I": 9,"Batt_V": 54.6,"In_V": 79.6,"Out_kWh": 0.2,"Out_AH": 4,"CC_mode": " ","Error": ["none"],"Aux_mode": "Manual","AUX": "disabled"},
{ "Port": 3, "Dev": "FNDC","Enabled": ["A","B"],"Shunt_A_I": -1.0,"Shunt_A_AH": -17,"Shunt_A_kWh": -0.880,"Shunt_B_I": 12.8,"Shunt_B_AH": 7,"Shunt_B_kWh": 0.420,"SOC": 93,"Min_SOC": 90,"Days_since_full": 2.8,"CHG_parms_met": false,"In_AH_today": 5,"Out_AH_today": 5,"In_kWh_today": 0.250,"Out_kWh_today": 0.260,"Net_CFC_AH": -10,"Net_CFC_kWh": -0.480,"Batt_V": 54.1,"Batt_temp": "###","Aux_mode": "manual","AUX": "disabled"}
]}}
And finally, here is my yaml sensor file:
#######################
# Some sensors for the Outback Mate3s
# Coming from the OutbackPower OpticeRE System.
#
# The mate3s controller lives at 10.0.0.150
# The api is: http://10.0.0.150/Dev_status.cgi?&Port=0
# It is a json output... so, lets get some data.
#
# Json looks like this (as of 2020-09-25)
# {"devstatus": {
# "Gateway_Type": "Mate3s","Sys_Time": 1601009672,
# "Sys_Batt_V": 54.1,
# "ports": [
# { "Port": 1, "Dev": "FXR","Type": "60Hz","Inv_I_L2": 0,"Chg_I_L2": 0,"Buy_I_L2": 0,"Sell_I_L2": 0,"VAC1_in_L2": 0,"VAC2_in_L2": 0,"VAC_out_L2": 122,"AC_Input": "Grid","Batt_V": 54.0,"AC_mode": "NO AC","INV_mode": "Inverting","Warn": ["none"],"Error": ["none"],"AUX": "disabled"},
# { "Port": 2, "Dev": "CC","Type": "FM80","Out_I": 12.9,"In_I": 9,"Batt_V": 54.6,"In_V": 79.6,"Out_kWh": 0.2,"Out_AH": 4,"CC_mode": " ","Error": ["none"],"Aux_mode": "Manual","AUX": "disabled"},
# { "Port": 3, "Dev": "FNDC","Enabled": ["A","B"],"Shunt_A_I": -1.0,"Shunt_A_AH": -17,"Shunt_A_kWh": -0.880,"Shunt_B_I": 12.8,"Shunt_B_AH": 7,"Shunt_B_kWh": 0.420,"SOC": 93,"Min_SOC": 90,"Days_since_full": 2.8,"CHG_parms_met": false,"In_AH_today": 5,"Out_AH_today": 5,"In_kWh_today": 0.250,"Out_kWh_today": 0.260,"Net_CFC_AH": -10,"Net_CFC_kWh": -0.480,"Batt_V": 54.1,"Batt_temp": "###","Aux_mode": "manual","AUX": "disabled"}
# ]}}
#
# Port 0 = Inverter (FXR - 60hz)
# Port 1 = Charge Controller (CC - FM80)
# Port 2 = FNDC
#######################
# When ready, include this file into configuration.yaml
# sensors: !include sensors_outback_opticsre.yaml
#
# Notes:
# For rest connections, we could do multiple "resource" connections, each to get a specific value,
# Example below works for charge controller batter voltage, but if we do this for each sensor,
# we will flood the rest service and also cause multiple issues on the mate3s.
# In fact, too many calls too quickly will crash port 80 on the mate3s. So don't do it this way:
#
# - platform: rest
# name: "PV CC Battery Voltage"
# resource: "http://10.0.0.150/Dev_status.cgi?&Port=0"
# value_template: "{{ value_json.devstatus.ports.1['Batt_V'] | float (2) }}"
# method: GET
# unit_of_measurement: "Vdc"
# scan_interval: 30
#
# - platform: rest
# name: "PV Gateway Type"
# resource: "http://10.0.0.150/Dev_status.cgi?&Port=0"
# value_template: "{{ value_json.devstatus.Gateway_Type }}"
# method: GET
# scan_interval: 30
#
# More notes:
# I can get the JSON data multiple ways... ecamples for charge controller battery voltage are:
# # value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Batt_V"] }}'
# # value_template: '{{ state_attr("sensor.mate3s_report", "devstatus") ["ports"][1]["Batt_V"] }}'
#
####
# Instead of using multiple resource connections,
# Lets get all the data into attributes of a RESTful sensor and create a set of
# template sensors that monitor the attributes and present the values in a
# usable form.
#
# Note, some sensors commented out, because I want to keep the size as small as possible,
# and we are not currently needing those values for our reporting.
#
- platform: rest
name: MATE3S_REPORT
json_attributes:
- devstatus
- ports
- Out_kWh
- Batt_V
resource: "http://10.0.0.150/Dev_status.cgi?&Port=0"
value_template: 'OK'
scan_interval: 30
- platform: template
sensors:
# pv_gateway_type:
# friendly_name: 'PV Gateway Type'
# entity_id: sensor.mate3s_report
# value_template: '{{ state_attr("sensor.mate3s_report", "devstatus") ["Gateway_Type"] }}'
pv_sys_batt_v:
friendly_name: 'PV Sys Battery Voltage'
entity_id: sensor.mate3s_report
value_template: '{{ state_attr("sensor.mate3s_report", "devstatus") ["Sys_Batt_V"] }}'
unit_of_measurement: "Vdc"
#################################
# Inverter Values on "ports[0]"
#################################
pv_inv_batt_v:
friendly_name: 'Inv Battery Voltage'
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][0]["Batt_V"] }}'
unit_of_measurement: "Vdc"
# pv_inv_chg_i_l2:
# friendly_name: 'Inv Chg I L2'
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][0]["Chg_I_L2"] }}'
# pv_inv_inv_i_l2:
# friendly_name: 'Inv Inv I L2'
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][0]["Inv_I_L2"] }}'
pv_inv_mode:
friendly_name: 'Inv Mode'
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][0]["INV_mode"] }}'
pv_inv_vac_out_l2:
friendly_name: 'Inv VAC Out L2'
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][0]["VAC_out_L2"] }}'
unit_of_measurement: "Vac"
########################################
# Charge Controller values on "ports[1]"
########################################
pv_cc_batt_v:
friendly_name: 'CC Battery Voltage'
######## The following was my first attempt of dealing with "unavailable"... this didn't work.
# value_template: >
# {% if value_json.devstatus is defined and 'ports' in value_json.devstatus %}
# {{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Batt_V"] }}
# {% else %}
# {{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Batt_V"].status }}
# {% endif %}
######## End of attempt.
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Batt_V"] }}'
unit_of_measurement: "Vdc"
# pv_cc_in_i:
# friendly_name: 'CC In I'
# entity_id: sensor.mate3s_report
# value_template: '{{ sensor.mate3s_report.attributes["devstatus"]["ports"][1]["In_I"] }}'
pv_cc_in_v:
friendly_name: 'CC In Volts'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["In_V"] }}'
unit_of_measurement: "Vdc"
pv_cc_out_ah:
friendly_name: 'CC Out AH'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Out_AH"] }}'
unit_of_measurement: "AH"
# pv_cc_out_I:
# friendly_name: 'CC Out I'
# entity_id: sensor.mate3s_report
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Out_I"] }}'
pv_cc_out_kwh:
friendly_name: 'CC kWh OUT'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Out_kWh"] }}'
unit_of_measurement: "kWh"
# pv_cc_type:
# friendly_name: 'CC Type'
# entity_id: sensor.mate3s_report
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][1]["Type"] }}'
########################################
# FlexNet DC values on "ports[2]"
########################################
pv_fndc_batt_v:
friendly_name: 'FNDC Battery Voltage'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Batt_V"] }}'
unit_of_measurement: "Vdc"
# pv_fndc_chg_params_met:
# friendly_name: 'FNDC Charge Parameters Met'
# entity_id: sensor.mate3s_report
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Chg_params_met"] }}'
pv_fndc_days_since_full:
friendly_name: 'FNDC Days Since Full'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Days_since_full"] }}'
unit_of_measurement: "Days"
# pv_fndc_dev:
# friendly_name: 'FNDC Dev'
# entity_id: sensor.mate3s_report
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["dev"] }}'
pv_fndc_in_ah_today:
friendly_name: 'FNDC In AH Today'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["In_AH_today"] }}'
unit_of_measurement: "AH"
pv_fndc_in_kwh_today:
friendly_name: 'FNDC In kWh Today'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["In_kWh_today"] }}'
unit_of_measurement: "kWh"
pv_fndc_min_soc:
friendly_name: 'FNDC Min SOC'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Min_SOC"] }}'
unit_of_measurement: "Percent"
# pv_fndc_net_cfc_ah:
# friendly_name: 'FNDC Net CFC AH'
# entity_id: sensor.mate3s_report
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Net_CFC_AH"] }}'
# unit_of_measurement: "AH"
# pv_fndc_net_cfc_kwk:
# friendly_name: 'FNDC Net CFC KWH'
# entity_id: sensor.mate3s_report
# value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Net_CFC_kWh"] }}'
# unit_of_measurement: "kWh"
pv_fndc_out_ah_today:
friendly_name: 'FNDC Out AH Today'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Out_AH_today"] }}'
unit_of_measurement: "AH"
pv_fndc_out_kwh_today:
friendly_name: 'FNDC Out kWh Today'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Out_kWh_today"] }}'
unit_of_measurement: "kWh"
pv_fndc_soc:
friendly_name: 'FNDC SOC'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["SOC"] }}'
unit_of_measurement: "Percent"
pv_fndc_shunt_b_i:
friendly_name: 'FNDC Shunt B Input'
entity_id: sensor.mate3s_report
value_template: '{{ states.sensor.mate3s_report.attributes["devstatus"]["ports"][2]["Shunt_B_I"] }}'
unit_of_measurement: "AH"
#####################################################################
# Calculate total PV Watts In (pv_fndc_shunt_b_i * pv_cc_batt_v)
#####################################################################
- platform: template
sensors:
pv_energy_from_panels:
unit_of_measurement: 'Watts'
friendly_name: "PV Energy From Panels"
value_template: >
{% set amps_now = states('sensor.pv_fndc_shunt_b_i') %}
{% set volts_now = states('sensor.pv_cc_batt_v') %}
{{ (float(amps_now) | float(2) * float(volts_now) | float(2)) | round(2) }}
Any help would be appreciated on
a) why am I getting “unavailable”
b) how to I check for it and provide previous sensor value instead of the word “unavailable”. (see what I tried in code above).
Thanks!!!