Skip to content

Commit c60a8ce

Browse files
authored
Merge pull request #40 from plugwise/p1v4
P1v4 and auto-black
2 parents f26739c + e7a5853 commit c60a8ce

File tree

6 files changed

+841
-3
lines changed

6 files changed

+841
-3
lines changed

.github/workflows/verify.yml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,55 @@ jobs:
6464
. venv/bin/activate
6565
pre-commit install-hooks
6666
67+
black:
68+
runs-on: ubuntu-latest
69+
name: Black check and force
70+
needs: prepare
71+
steps:
72+
- name: Check out committed code
73+
uses: actions/checkout@v2
74+
with:
75+
persist-credentials: false
76+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
77+
id: python
78+
uses: actions/setup-python@v2
79+
with:
80+
python-version: ${{ env.DEFAULT_PYTHON }}
81+
- name: Restore base Python ${{ env.DEFAULT_PYTHON }} virtual environment
82+
id: cache-venv
83+
uses: actions/cache@v2
84+
with:
85+
path: venv
86+
key: >-
87+
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
88+
steps.python.outputs.python-version }}-${{
89+
hashFiles('requirements_test.txt') }}-${{
90+
hashFiles('setup.py') }}
91+
- name: Fail job if Python cache restore failed
92+
if: steps.cache-venv.outputs.cache-hit != 'true'
93+
run: |
94+
echo "Failed to restore Python ${{ env.DEFAULT_PYTHON }} virtual environment from cache"
95+
exit 1
96+
- name: Run black --check .
97+
run: |
98+
. venv/bin/activate
99+
black --check .
100+
- name: If needed, commit black changes to the pull request
101+
if: failure()
102+
run: |
103+
. venv/bin/activate
104+
black .
105+
git config --global user.name 'autoblack'
106+
git config --global user.email '[email protected]'
107+
git remote set-url origin https://x-access-token:${{ secrets.PAT_CT }}@github.com/$GITHUB_REPOSITORY
108+
git checkout $GITHUB_HEAD_REF
109+
git commit -am "fixup: ${GITHUB_REF##*/} Python code reformatted using Black"
110+
git push origin ${GITHUB_REF##*/}
67111
68112
commitcheck:
69113
runs-on: ubuntu-latest
70114
name: Check commit
71-
needs: prepare
115+
needs: black
72116
steps:
73117
- name: Check out committed code
74118
uses: actions/checkout@v2
@@ -77,8 +121,6 @@ jobs:
77121
uses: actions/setup-python@v2
78122
with:
79123
python-version: ${{ env.DEFAULT_PYTHON }}
80-
- name: Pre-black
81-
uses: psf/black@stable
82124
- name: Restore base Python ${{ env.DEFAULT_PYTHON }} virtual environment
83125
id: cache-venv
84126
uses: actions/cache@v2

userdata/p1v4/core.appliances.xml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<appliances>
3+
<appliance id='ba4de7613517478da82dd9b6abea36af'>
4+
<name>Gateway</name>
5+
<description>Container for variables logged about the Gateway in general.</description>
6+
<type>gateway</type>
7+
<created_date>2019-11-19T10:21:26.199+01:00</created_date>
8+
<modified_date>2020-11-03T18:32:55+01:00</modified_date>
9+
<deleted_date></deleted_date>
10+
<groups/>
11+
<logs>
12+
<point_log id='400e04683dd94718ada7ff8a8c1d7466'>
13+
<type>signal_strength</type>
14+
<unit>dBm</unit>
15+
<updated_date>2020-11-03T18:32:54.963+01:00</updated_date>
16+
<last_consecutive_log_date>2020-11-03T18:32:54.963+01:00</last_consecutive_log_date>
17+
<interval/>
18+
<signal_strength id='cb6934a63ceb43be9fb69db78f2065d0'/>
19+
<period start_date="2020-11-03T18:32:54.963+01:00" end_date="2020-11-03T18:32:54.963+01:00">
20+
<measurement log_date="2020-11-03T18:32:54.963+01:00">-73.00</measurement>
21+
</period>
22+
</point_log>
23+
<point_log id='4de35aefb34f498caf5cc595fc6df60b'>
24+
<type>link_quality</type>
25+
<unit></unit>
26+
<updated_date>2020-11-03T18:32:54.963+01:00</updated_date>
27+
<last_consecutive_log_date>2020-11-03T18:32:54.963+01:00</last_consecutive_log_date>
28+
<interval/>
29+
<link_quality id='332138ddfe334e4397b9523d67c05a56'/>
30+
<period start_date="2020-11-03T18:32:54.963+01:00" end_date="2020-11-03T18:32:54.963+01:00">
31+
<measurement log_date="2020-11-03T18:32:54.963+01:00">37</measurement>
32+
</period>
33+
</point_log>
34+
<point_log id='7c4e66de4d234a3ab161280d8d7e9ab3'>
35+
<type>wlan_state</type>
36+
<unit></unit>
37+
<updated_date>2020-11-03T18:32:54.964+01:00</updated_date>
38+
<last_consecutive_log_date>2020-11-01T03:03:00.285+01:00</last_consecutive_log_date>
39+
<interval/>
40+
<network_state id='4e078f2fae014cbab9f067ca66e80d55'/>
41+
<period start_date="2020-11-03T18:32:54.964+01:00" end_date="2020-11-03T18:32:54.964+01:00">
42+
<measurement log_date="2020-11-03T18:32:54.964+01:00">up</measurement>
43+
</period>
44+
</point_log>
45+
<point_log id='8032d845eee04dffab189be92589af0c'>
46+
<type>lan_state</type>
47+
<unit></unit>
48+
<updated_date>2020-11-03T18:32:55+01:00</updated_date>
49+
<last_consecutive_log_date>2020-03-12T16:40:25.650+01:00</last_consecutive_log_date>
50+
<interval/>
51+
<network_state id='11622002070241b088be817459e6180f'/>
52+
<period start_date="2020-11-03T18:32:55+01:00" end_date="2020-11-03T18:32:55+01:00">
53+
<measurement log_date="2020-11-03T18:32:55+01:00">down</measurement>
54+
</period>
55+
</point_log>
56+
<point_log id='d4524db60fee4a13b70c8c29f3b04b92'>
57+
<type>wlan_ip_address</type>
58+
<unit></unit>
59+
<updated_date>2020-11-03T18:32:54.964+01:00</updated_date>
60+
<last_consecutive_log_date>2020-11-03T03:01:37+01:00</last_consecutive_log_date>
61+
<interval/>
62+
<network_address id='cc36809b562c419686ebcaee95f36c7a'/>
63+
<period start_date="2020-11-03T18:32:54.964+01:00" end_date="2020-11-03T18:32:54.964+01:00">
64+
<measurement log_date="2020-11-03T18:32:54.964+01:00">127.0.0.1</measurement>
65+
</period>
66+
</point_log>
67+
</logs>
68+
<actuator_functionalities/>
69+
</appliance>
70+
</appliances>
71+
72+
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<direct_objects>
3+
<location id='a455b61e52394b2db5081ce025a430f3'>
4+
<name>Home</name>
5+
<description>A building with a smart meter.</description>
6+
<type>building</type>
7+
<created_date>2020-03-12T16:41:36.227+01:00</created_date>
8+
<modified_date>2020-11-03T18:35:22.436+01:00</modified_date>
9+
<deleted_date></deleted_date>
10+
<preset>home</preset>
11+
<clients/>
12+
<appliances/>
13+
<logs>
14+
<point_log id='104e84a3e0364545a889270deee21e94'>
15+
<type>electricity_consumed</type>
16+
<unit>W</unit>
17+
<updated_date>2020-11-03T18:35:18+01:00</updated_date>
18+
<last_consecutive_log_date>2020-11-03T18:35:18+01:00</last_consecutive_log_date>
19+
<interval/>
20+
<electricity_point_meter id='b0618815236d47a2b093a1a7ba83991d'/>
21+
<period start_date="2020-11-03T18:35:18+01:00" end_date="2020-11-03T18:35:18+01:00">
22+
<measurement log_date="2020-11-03T18:35:18+01:00" tariff="nl_offpeak">0.00</measurement>
23+
<measurement log_date="2020-11-03T18:35:18+01:00" tariff="nl_peak">543.00</measurement>
24+
</period>
25+
</point_log>
26+
<cumulative_log id='32b0afe1dd324aea87f46d2e699dbd56'>
27+
<type>electricity_produced</type>
28+
<unit>Wh</unit>
29+
<updated_date>2020-11-03T18:35:00+01:00</updated_date>
30+
<last_consecutive_log_date>2020-11-03T18:35:00+01:00</last_consecutive_log_date>
31+
<interval/>
32+
<electricity_cumulative_meter id='1fa5f5772e464e5cbcb595101adaf8e5'/>
33+
<period start_date="2020-11-03T18:35:00+01:00" end_date="2020-11-03T18:35:00+01:00">
34+
<measurement log_date="2020-11-03T18:35:00+01:00" tariff="nl_peak">0.00</measurement>
35+
<measurement log_date="2020-11-03T18:35:00+01:00" tariff="nl_offpeak">0.00</measurement>
36+
</period>
37+
</cumulative_log>
38+
<point_log id='6b58aa7f2cd0406bacdc53ac7ecae168'>
39+
<type>electricity_produced</type>
40+
<unit>W</unit>
41+
<updated_date>2020-11-03T18:35:18+01:00</updated_date>
42+
<last_consecutive_log_date>2020-11-03T07:00:00+01:00</last_consecutive_log_date>
43+
<interval/>
44+
<electricity_point_meter id='b0618815236d47a2b093a1a7ba83991d'/>
45+
<period start_date="2020-11-03T18:35:18+01:00" end_date="2020-11-03T18:35:18+01:00">
46+
<measurement log_date="2020-11-03T18:35:18+01:00" tariff="nl_peak">0.00</measurement>
47+
<measurement log_date="2020-11-03T18:35:18+01:00" tariff="nl_offpeak">0.00</measurement>
48+
</period>
49+
</point_log>
50+
<cumulative_log id='7b7ad634b0b647f0bbf848ac5657ea8f'>
51+
<type>electricity_consumed</type>
52+
<unit>Wh</unit>
53+
<updated_date>2020-11-03T18:35:00+01:00</updated_date>
54+
<last_consecutive_log_date>2020-11-03T18:35:00+01:00</last_consecutive_log_date>
55+
<interval/>
56+
<electricity_cumulative_meter id='1fa5f5772e464e5cbcb595101adaf8e5'/>
57+
<period start_date="2020-11-03T18:35:00+01:00" end_date="2020-11-03T18:35:00+01:00">
58+
<measurement log_date="2020-11-03T18:35:00+01:00" tariff="nl_peak">9067554.00</measurement>
59+
<measurement log_date="2020-11-03T18:35:00+01:00" tariff="nl_offpeak">11915899.00</measurement>
60+
</period>
61+
</cumulative_log>
62+
<interval_log id='859d091cb8e444b5bc084a41a9fd401c'>
63+
<type>electricity_produced</type>
64+
<unit>Wh</unit>
65+
<updated_date>2020-11-03T18:00:00+01:00</updated_date>
66+
<last_consecutive_log_date>2020-11-03T17:00:00+01:00</last_consecutive_log_date>
67+
<interval>PT1H</interval>
68+
<electricity_interval_meter id='b3e07d45b7354d189cd0d5d41a4f80d7'/>
69+
<period start_date="2020-11-03T18:00:00+01:00" end_date="2020-11-03T18:00:00+01:00" interval="PT1H">
70+
<measurement log_date="2020-11-03T18:00:00+01:00" tariff="nl_peak">0.00</measurement>
71+
<measurement log_date="2020-11-03T18:00:00+01:00" tariff="nl_offpeak">0.00</measurement>
72+
</period>
73+
</interval_log>
74+
<interval_log id='babf35c6d9c746179475a6c0ce086f37'>
75+
<type>electricity_consumed</type>
76+
<unit>Wh</unit>
77+
<updated_date>2020-11-03T18:00:00+01:00</updated_date>
78+
<last_consecutive_log_date>2020-11-03T17:00:00+01:00</last_consecutive_log_date>
79+
<interval>PT1H</interval>
80+
<electricity_interval_meter id='b3e07d45b7354d189cd0d5d41a4f80d7'/>
81+
<period start_date="2020-11-03T18:00:00+01:00" end_date="2020-11-03T18:00:00+01:00" interval="PT1H">
82+
<measurement log_date="2020-11-03T18:00:00+01:00" tariff="nl_peak">335.00</measurement>
83+
<measurement log_date="2020-11-03T18:00:00+01:00" tariff="nl_offpeak">0.00</measurement>
84+
</period>
85+
</interval_log>
86+
</logs>
87+
<actuator_functionalities/>
88+
</location>
89+
<appliance id='ba4de7613517478da82dd9b6abea36af'>
90+
<name>Gateway</name>
91+
<description>Container for variables logged about the Gateway in general.</description>
92+
<type>gateway</type>
93+
<created_date>2019-11-19T10:21:26.199+01:00</created_date>
94+
<modified_date>2020-11-03T18:32:55+01:00</modified_date>
95+
<deleted_date></deleted_date>
96+
<groups/>
97+
<logs>
98+
<point_log id='400e04683dd94718ada7ff8a8c1d7466'>
99+
<type>signal_strength</type>
100+
<unit>dBm</unit>
101+
<updated_date>2020-11-03T18:32:54.963+01:00</updated_date>
102+
<last_consecutive_log_date>2020-11-03T18:32:54.963+01:00</last_consecutive_log_date>
103+
<interval/>
104+
<signal_strength id='cb6934a63ceb43be9fb69db78f2065d0'/>
105+
<period start_date="2020-11-03T18:32:54.963+01:00" end_date="2020-11-03T18:32:54.963+01:00">
106+
<measurement log_date="2020-11-03T18:32:54.963+01:00">-73.00</measurement>
107+
</period>
108+
</point_log>
109+
<point_log id='4de35aefb34f498caf5cc595fc6df60b'>
110+
<type>link_quality</type>
111+
<unit></unit>
112+
<updated_date>2020-11-03T18:32:54.963+01:00</updated_date>
113+
<last_consecutive_log_date>2020-11-03T18:32:54.963+01:00</last_consecutive_log_date>
114+
<interval/>
115+
<link_quality id='332138ddfe334e4397b9523d67c05a56'/>
116+
<period start_date="2020-11-03T18:32:54.963+01:00" end_date="2020-11-03T18:32:54.963+01:00">
117+
<measurement log_date="2020-11-03T18:32:54.963+01:00">37</measurement>
118+
</period>
119+
</point_log>
120+
<point_log id='7c4e66de4d234a3ab161280d8d7e9ab3'>
121+
<type>wlan_state</type>
122+
<unit></unit>
123+
<updated_date>2020-11-03T18:32:54.964+01:00</updated_date>
124+
<last_consecutive_log_date>2020-11-01T03:03:00.285+01:00</last_consecutive_log_date>
125+
<interval/>
126+
<network_state id='4e078f2fae014cbab9f067ca66e80d55'/>
127+
<period start_date="2020-11-03T18:32:54.964+01:00" end_date="2020-11-03T18:32:54.964+01:00">
128+
<measurement log_date="2020-11-03T18:32:54.964+01:00">up</measurement>
129+
</period>
130+
</point_log>
131+
<point_log id='8032d845eee04dffab189be92589af0c'>
132+
<type>lan_state</type>
133+
<unit></unit>
134+
<updated_date>2020-11-03T18:32:55+01:00</updated_date>
135+
<last_consecutive_log_date>2020-03-12T16:40:25.650+01:00</last_consecutive_log_date>
136+
<interval/>
137+
<network_state id='11622002070241b088be817459e6180f'/>
138+
<period start_date="2020-11-03T18:32:55+01:00" end_date="2020-11-03T18:32:55+01:00">
139+
<measurement log_date="2020-11-03T18:32:55+01:00">down</measurement>
140+
</period>
141+
</point_log>
142+
<point_log id='d4524db60fee4a13b70c8c29f3b04b92'>
143+
<type>wlan_ip_address</type>
144+
<unit></unit>
145+
<updated_date>2020-11-03T18:32:54.964+01:00</updated_date>
146+
<last_consecutive_log_date>2020-11-03T03:01:37+01:00</last_consecutive_log_date>
147+
<interval/>
148+
<network_address id='cc36809b562c419686ebcaee95f36c7a'/>
149+
<period start_date="2020-11-03T18:32:54.964+01:00" end_date="2020-11-03T18:32:54.964+01:00">
150+
<measurement log_date="2020-11-03T18:32:54.964+01:00">127.0.0.1</measurement>
151+
</period>
152+
</point_log>
153+
</logs>
154+
<actuator_functionalities/>
155+
</appliance>
156+
</direct_objects>
157+
158+

0 commit comments

Comments
 (0)