Skip to content

Commit

Permalink
Merge pull request #362 from bj00rn/patch-1
Browse files Browse the repository at this point in the history
Additional SSO Fault codes
  • Loading branch information
argoyle authored Jul 7, 2023
2 parents 76adf01 + a535c10 commit d2552ea
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 13 deletions.
18 changes: 9 additions & 9 deletions custom_components/ferroamp/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
FAULT_CODES_SSO = [
'Unknown fault code',
'Unknown fault code',
'Unknown fault code',
'Unknown fault code',
'UNDERVOLTAGE',
'OVERVOLTAGE',
'OVERHEAT',
'Unknown fault code',
'Unknown fault code',
'Unknown fault code',
'POWERLIMITING'
'Error, PV ground fault',
'Error, internal voltage unbalance',
'Warning, PV undervoltage, not possible to sustain MPPT operation',
'Warning, DC grid voltage too high, SSO will not connect to DC grid',
'Warning, Limiting current due to internal temperature',
'Error, Internal power electronics fault',
'Error, Internal relay test circuit has detected a fault',
'Error, Memory error, configuration parameters can not be read',
'Warning, SSO is limiting power, either because of internal temperature or DC grid voltage level'
]
113 changes: 109 additions & 4 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,48 @@ async def test_sso_fault_codes(hass, mqtt_mock):
0: 'No errors'
}

async_fire_mqtt_message(hass, topic, """{
"relaystatus": {"val": "0"},
"temp": {"val": "6.482"},
"wpv": {"val": "843516404273"},
"ts": {"val": "2021-03-08T08:22:42UTC"},
"udc": {"val": "769.872"},
"faultcode": {"val": "4"},
"ipv": {"val": "4.826"},
"upv": {"val": "653.012"},
"id": {"val": "12345678"}
}""")
await hass.async_block_till_done()

state = hass.states.get("sensor.ferroamp_sso_12345678_faultcode")
assert state.state == "4"
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
3: 'Error, PV ground fault'
}

async_fire_mqtt_message(hass, topic, """{
"relaystatus": {"val": "0"},
"temp": {"val": "6.482"},
"wpv": {"val": "843516404273"},
"ts": {"val": "2021-03-08T08:22:42UTC"},
"udc": {"val": "769.872"},
"faultcode": {"val": "8"},
"ipv": {"val": "4.826"},
"upv": {"val": "653.012"},
"id": {"val": "12345678"}
}""")
await hass.async_block_till_done()

state = hass.states.get("sensor.ferroamp_sso_12345678_faultcode")
assert state.state == "8"
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
4: 'Error, internal voltage unbalance'
}

async_fire_mqtt_message(hass, topic, """{
"relaystatus": {"val": "0"},
"temp": {"val": "6.482"},
Expand All @@ -1413,7 +1455,7 @@ async def test_sso_fault_codes(hass, mqtt_mock):
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
5: 'UNDERVOLTAGE'
5: 'Warning, PV undervoltage, not possible to sustain MPPT operation'
}

async_fire_mqtt_message(hass, topic, """{
Expand All @@ -1434,7 +1476,7 @@ async def test_sso_fault_codes(hass, mqtt_mock):
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
6: 'OVERVOLTAGE'
6: 'Warning, DC grid voltage too high, SSO will not connect to DC grid'
}

async_fire_mqtt_message(hass, topic, """{
Expand All @@ -1455,7 +1497,70 @@ async def test_sso_fault_codes(hass, mqtt_mock):
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
7: 'OVERHEAT'
7: 'Warning, Limiting current due to internal temperature'
}

async_fire_mqtt_message(hass, topic, """{
"relaystatus": {"val": "0"},
"temp": {"val": "6.482"},
"wpv": {"val": "843516404273"},
"ts": {"val": "2021-03-08T08:22:42UTC"},
"udc": {"val": "769.872"},
"faultcode": {"val": "80"},
"ipv": {"val": "4.826"},
"upv": {"val": "653.012"},
"id": {"val": "12345678"}
}""")
await hass.async_block_till_done()

state = hass.states.get("sensor.ferroamp_sso_12345678_faultcode")
assert state.state == "80"
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
8: 'Error, Internal power electronics fault'
}

async_fire_mqtt_message(hass, topic, """{
"relaystatus": {"val": "0"},
"temp": {"val": "6.482"},
"wpv": {"val": "843516404273"},
"ts": {"val": "2021-03-08T08:22:42UTC"},
"udc": {"val": "769.872"},
"faultcode": {"val": "100"},
"ipv": {"val": "4.826"},
"upv": {"val": "653.012"},
"id": {"val": "12345678"}
}""")
await hass.async_block_till_done()

state = hass.states.get("sensor.ferroamp_sso_12345678_faultcode")
assert state.state == "100"
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
9: 'Error, Internal relay test circuit has detected a fault'
}

async_fire_mqtt_message(hass, topic, """{
"relaystatus": {"val": "0"},
"temp": {"val": "6.482"},
"wpv": {"val": "843516404273"},
"ts": {"val": "2021-03-08T08:22:42UTC"},
"udc": {"val": "769.872"},
"faultcode": {"val": "200"},
"ipv": {"val": "4.826"},
"upv": {"val": "653.012"},
"id": {"val": "12345678"}
}""")
await hass.async_block_till_done()

state = hass.states.get("sensor.ferroamp_sso_12345678_faultcode")
assert state.state == "200"
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
10: 'Error, Memory error, configuration parameters can not be read'
}

async_fire_mqtt_message(hass, topic, """{
Expand All @@ -1476,7 +1581,7 @@ async def test_sso_fault_codes(hass, mqtt_mock):
assert state.attributes == {
'friendly_name': 'SSO 12345678 Faultcode',
'icon': 'mdi:traffic-light',
11: 'POWERLIMITING'
11: 'Warning, SSO is limiting power, either because of internal temperature or DC grid voltage level'
}

async_fire_mqtt_message(hass, topic, """{
Expand Down

0 comments on commit d2552ea

Please sign in to comment.