Skip to content

Commit ee1a0b5

Browse files
committed
2 parents 07cee47 + 8ac56ff commit ee1a0b5

File tree

9 files changed

+753
-17
lines changed

9 files changed

+753
-17
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] Your bug title"
5+
labels: not verified
6+
assignees: LarsK1
7+
8+
---
9+
10+
**Version of the plugin**
11+
The installed version of your plugin
12+
13+
**Home-Assistant Version**
14+
Your HomeAssistant-Version
15+
16+
**Enviroment (Docker, HAOS, ...)**
17+
The enviroment your HomeAssistant is running in
18+
19+
**Describe the bug**
20+
A clear and concise description of what the bug is.
21+
22+
**To Reproduce**
23+
Steps to reproduce the behavior:
24+
1. Go to '...'
25+
2. Click on '....'
26+
3. Scroll down to '....'
27+
4. See error
28+
29+
**Expected behavior**
30+
A clear and concise description of what you expected to happen.
31+
32+
**Screenshots**
33+
If applicable, add screenshots to help explain your problem.
34+
35+
**Additional context**
36+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE] Your idea"
5+
labels: not verified
6+
assignees: LarsK1
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/black.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: psf/black@stable
11+
with:
12+
options: "--check --verbose"

LICENSE

+674
Large diffs are not rendered by default.

custom_components/solvis_control/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Modul to integrate solvis heaters to.
33
4-
Version: 0.3.0-beta
4+
Version: 1.0.1-release
55
"""
66

77
"""Solvis integration."""

custom_components/solvis_control/const.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class ModbusFieldConfig:
2121
# 1 = INPUT, 2 = HOLDING
2222
register: int = 1
2323
negative: bool = False
24+
absolut_value: bool = False
2425
entity_category: str = None
2526
enabled_by_default: bool = True
2627
edit: bool = False
@@ -152,6 +153,7 @@ class ModbusFieldConfig:
152153
negative=True,
153154
multiplier=1,
154155
entity_category="diagnostic",
156+
absolut_value=True,
155157
),
156158
ModbusFieldConfig( # Ionisationsstrom
157159
name="ionisation_voltage",
@@ -294,7 +296,7 @@ class ModbusFieldConfig:
294296
unit="",
295297
device_class=None,
296298
state_class=None,
297-
multiplier=1
299+
multiplier=1,
298300
# data=("0", "1", "2", "3"),
299301
),
300302
ModbusFieldConfig( # Raumtemperatur_HKR1

custom_components/solvis_control/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"iot_class": "local_polling",
1010
"issue_tracker": "https://github.com/LarsK1/hass_solvis_control/issues",
1111
"requirements": ["pymodbus"],
12-
"version": "0.3.0-beta"
12+
"version": "1.0.1-release"
1313
}

custom_components/solvis_control/select.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ async def async_setup_entry(
3535
conf_host = entry.data.get(CONF_HOST)
3636
if conf_host is None:
3737
_LOGGER.error("Device has no address")
38-
3938
# Generate device info
39+
4040
device_info = DeviceInfo(
4141
identifiers={(DOMAIN, entry.data.get(CONF_HOST))},
4242
name=entry.data.get(CONF_NAME),
@@ -45,10 +45,11 @@ async def async_setup_entry(
4545
)
4646

4747
# Add sensors
48+
4849
sensors_to_add = []
4950

5051
for register in REGISTERS:
51-
if register.address not in (2818, ):
52+
if register.address not in (2818,):
5253
continue
5354
sensors_to_add.append(
5455
SolvisSensor(
@@ -61,7 +62,6 @@ async def async_setup_entry(
6162
register.address,
6263
)
6364
)
64-
6565
async_add_entities(sensors_to_add)
6666

6767

@@ -98,18 +98,15 @@ def _handle_coordinator_update(self) -> None:
9898
if self.coordinator.data is None:
9999
_LOGGER.warning("Data from coordinator is None. Skipping update")
100100
return
101-
102101
if not isinstance(self.coordinator.data, dict):
103102
_LOGGER.warning("Invalid data from coordinator")
104103
self._attr_available = False
105104
return
106-
107105
response_data = self.coordinator.data.get(self._response_key)
108106
if response_data is None:
109107
_LOGGER.warning("No data for available for (%s)", self._response_key)
110108
self._attr_available = False
111109
return
112-
113110
if (
114111
not isinstance(response_data, int)
115112
and not isinstance(response_data, float)
@@ -123,7 +120,6 @@ def _handle_coordinator_update(self) -> None:
123120
)
124121
self._attr_available = False
125122
return
126-
127123
self._attr_available = True
128124
self._attr_current_option = str(response_data)
129125
self.async_write_ha_state()

custom_components/solvis_control/sensor.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ async def async_setup_entry(
3333
conf_host = entry.data.get(CONF_HOST)
3434
if conf_host is None:
3535
_LOGGER.error("Device has no address")
36-
3736
# Generate device info
37+
3838
device_info = DeviceInfo(
3939
identifiers={(DOMAIN, entry.data.get(CONF_HOST))},
4040
name=entry.data.get(CONF_NAME),
@@ -43,12 +43,13 @@ async def async_setup_entry(
4343
)
4444

4545
# Add sensors
46+
4647
sensors_to_add = []
4748

4849
for register in REGISTERS:
4950
if register.edit:
5051
continue
51-
if register.address in (2818):
52+
if register.address in (2818,):
5253
continue
5354
sensors_to_add.append(
5455
SolvisSensor(
@@ -63,7 +64,6 @@ async def async_setup_entry(
6364
register.enabled_by_default,
6465
)
6566
)
66-
6767
async_add_entities(sensors_to_add)
6868

6969

@@ -104,18 +104,15 @@ def _handle_coordinator_update(self) -> None:
104104
if self.coordinator.data is None:
105105
_LOGGER.warning("Data from coordinator is None. Skipping update")
106106
return
107-
108107
if not isinstance(self.coordinator.data, dict):
109108
_LOGGER.warning("Invalid data from coordinator")
110109
self._attr_available = False
111110
return
112-
113111
response_data = self.coordinator.data.get(self._response_key)
114112
if response_data is None:
115113
_LOGGER.warning("No data for available for (%s)", self._response_key)
116114
self._attr_available = False
117115
return
118-
119116
if (
120117
not isinstance(response_data, int)
121118
and not isinstance(response_data, float)
@@ -129,7 +126,6 @@ def _handle_coordinator_update(self) -> None:
129126
)
130127
self._attr_available = False
131128
return
132-
133129
self._attr_available = True
134130
self._attr_native_value = response_data
135131
self.async_write_ha_state()

0 commit comments

Comments
 (0)