Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Lazy.2 #258

Merged
merged 41 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0006c0f
remove strict recorder dependency
krahabb Feb 8, 2023
2faca51
fix with timeout() deprecation
krahabb Feb 9, 2023
f7d79f4
remove unused platform callbacks
krahabb Feb 9, 2023
7dd5079
streamline mqtt calls to be more pytest friendly
krahabb Feb 9, 2023
cd94b39
improve environment settings to support testing
krahabb Feb 9, 2023
188bc1f
support enable-disable debug log from HA UI
krahabb Feb 9, 2023
742a07d
refactor to support testing
krahabb Feb 9, 2023
1aff549
implement a working basic suite of tests
krahabb Feb 9, 2023
b7a43e7
upate git workflows to python 3.10
krahabb Feb 9, 2023
e086dbe
upload traces to repository to allow testing
krahabb Feb 9, 2023
0a05430
add missing dependency for recorder as optional
krahabb Feb 9, 2023
410d259
update github actions
krahabb Feb 10, 2023
21068ef
add missing import annotations
krahabb Feb 10, 2023
4ffc17a
remove aiohttp.web dependency from Emulator class
krahabb Feb 10, 2023
4410c1b
update emulator calls interface
krahabb Feb 10, 2023
b797bff
minor typing
krahabb Feb 12, 2023
01d0504
fix mqtt discovery flow unique_id
krahabb Feb 12, 2023
9adfa88
refactor to ease code coverage in tests
krahabb Feb 12, 2023
8107163
tz safety check (for testing with freezetime)
krahabb Feb 12, 2023
9f6a570
more testing traces
krahabb Feb 12, 2023
8ee436d
add comment to clarify coding choice
krahabb Feb 12, 2023
bc4594b
fix relative imports
krahabb Feb 12, 2023
392fc28
prevent linter complaints
krahabb Feb 12, 2023
c52f27d
parametrize tracing abilities delay
krahabb Feb 12, 2023
b0d9cbe
more tests on config_flow, diagnostics, other
krahabb Feb 12, 2023
c185a17
set justMyCode to false in test debugging
krahabb Feb 12, 2023
b4dbee6
add missing dependencies for CI host
krahabb Feb 12, 2023
6c224d6
add missing dependencies for CI host
krahabb Feb 12, 2023
8e76a55
add service response as a persistent_notification
krahabb Feb 12, 2023
f9b458a
add more context to http error logging
krahabb Feb 12, 2023
9f2b228
fix missing refresh after reconnection (#257)
krahabb Feb 12, 2023
705ee3f
try prevent md5 failure (#256)
krahabb Feb 12, 2023
b5cbe50
move mqtt requests to async
krahabb Feb 12, 2023
8e3d36e
add service response test
krahabb Feb 12, 2023
a66ed35
refine async migration for tests
krahabb Feb 12, 2023
df3b7d8
add missing error key for OptionFlow
krahabb Feb 16, 2023
aa73ece
relax callback typing
krahabb Feb 16, 2023
d3afa9b
manage garage open/close timeouts (#82)
krahabb Feb 16, 2023
68822ac
improve msg100 emulation
krahabb Feb 16, 2023
8b66cf3
add msg100 trace
krahabb Feb 16, 2023
67b2294
update readme for 3.0.2
krahabb Feb 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v2"
- uses: "actions/checkout@v3"

- name: HACS validation
uses: "hacs/action@main"
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name: Pull actions
on:
pull_request:

env:
DEFAULT_PYTHON: "3.10"

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v2"
- uses: "actions/checkout@v3"

- name: HACS validation
uses: "hacs/action@main"
Expand All @@ -23,10 +26,10 @@ jobs:
runs-on: "ubuntu-latest"
name: Check style formatting
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "3.9"
python-version: ${{ env.DEFAULT_PYTHON }}
- run: python3 -m pip install black
- run: black .

Expand All @@ -35,11 +38,11 @@ jobs:
name: Run tests
steps:
- name: Check out code from GitHub
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: Setup Python
uses: "actions/setup-python@v1"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install requirements
run: python3 -m pip install -r requirements_test.txt
- name: Run tests
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ on:
- master
- dev

env:
DEFAULT_PYTHON: "3.10"

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v2"
- uses: "actions/checkout@v3"

- name: HACS validation
uses: "hacs/action@main"
Expand All @@ -26,10 +29,10 @@ jobs:
runs-on: "ubuntu-latest"
name: Check style formatting
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "3.9"
python-version: ${{ env.DEFAULT_PYTHON }}
- run: python3 -m pip install black
- run: black .

Expand All @@ -38,11 +41,11 @@ jobs:
name: Run tests
steps:
- name: Check out code from GitHub
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: Setup Python
uses: "actions/setup-python@v1"
uses: "actions/setup-python@v4"
with:
python-version: "3.9"
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install requirements
run: python3 -m pip install -r requirements_test.txt
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pythonenv*
venv
.venv
.coverage
coverage.xml
*.secret
*.user
traces
Expand Down
10 changes: 9 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"-P",
"40000",
"custom_components.meross_lan.emulator:run",
"custom_components/meross_lan/traces/emulator",
"emulator_traces",
"-K pippo"
//"-U 01234567890123456789012345678901"
]
Expand Down Expand Up @@ -46,6 +46,14 @@
"remoteRoot": "/usr/src/homeassistant"
}
]
},
{
"name": "Python: Debug Tests",
"type": "python",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"justMyCode": false
}
]
}
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--disable=missing-function-docstring",
"--disable=missing-class-docstring",
"--disable=invalid-name",
"--disable=bare-except",
"--disable=broad-except"
],
"python.pythonPath": "/usr/local/bin/python",
"files.associations": {
Expand All @@ -18,5 +13,10 @@
},
"python.analysis.extraPaths": [
"./custom_components/meross_lan"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"."
]
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Most of this software has been developed and tested on my owned Meross devices w
- [MS100](https://www.meross.com/Detail/46/Smart%20Temperature%20and%20Humidity%20Sensor): Smart Temperature/Humidity Sensor
- Thermostats
- [MTS100](https://www.meross.com/Detail/30/Smart%20Thermostat%20Valve): Smart Thermostat Valve
- [MTS200](https://www.meross.com/Detail/116/Smart%20Wi-Fi%20Thermostat) [experimental]: Smart Wifi Thermostat
- [MTS200](https://www.meross.com/Detail/116/Smart%20Wi-Fi%20Thermostat): Smart Wifi Thermostat
- Covers
- [MRS100](https://www.meross.com/product/91/article/): Smart WiFi Roller Shutter
- [MSG100](https://www.meross.com/product/29/article/): Smart WiFi Garage Door Opener
Expand All @@ -101,8 +101,8 @@ In general, many device configuration options available in Meross app are not su

## Service

There is a service 'meross_lan.request' exposed to simplify communication with the device and play with it a bit. It basically requires the needed informations to setup a command request and send it over MQTT or HTTP without the hassle of signatures and timestamps computations. You can check it in the 'Developer Tools' of the HA instance, everything should be enough self-explanatory there.
I find it a bit frustrating that the HA service infrastructure does not allow to return anything from a service invocation so, the eventual reply from the device will get 'lost' in the mqtt flow. I've personally played a bit with the MQTT integration configuration pane to listen and see the mqtt responses from my devices but it's somewhat a pain unless you have a big screen to play with (or multiple monitors for the matter). Nevertheless you can use the service wherever you like to maybe invoke features at the device level or dig into it's configuration.
There is a service called `meross_lan.request` exposed to simplify communication with the device and play with it a bit. It basically requires the needed informations to setup a command request and send it over MQTT or HTTP without the hassle of signatures and timestamps computations. You can check it in the 'Developer Tools' of the HA instance, everything should be enough self-explanatory there.
Since version 3.0.2 the service allows you to publish the device response as a persistent_notification message in HA so you don't have to dig into logs in order to see the reply. The notification is optional and you have to add the `notifyresponse` key to the service call with a value of `true`

## Troubleshooting

Expand Down
Loading