Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xAAL
Code
Python
Commits
90f27028
Commit
90f27028
authored
2 months ago
by
KERDREUX Jerome
Browse files
Options
Downloads
Patches
Plain Diff
Fix refresh rate due to Meross request (email)
parent
d67be14f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
devices/protocols/Meross/xaal/meross/gw.py
+20
-19
20 additions, 19 deletions
devices/protocols/Meross/xaal/meross/gw.py
with
20 additions
and
19 deletions
devices/protocols/Meross/xaal/meross/gw.py
+
20
−
19
View file @
90f27028
import
aiohttp
from
xaal.lib
import
tools
from
meross_iot.http_api
import
MerossHttpClient
...
...
@@ -15,6 +14,7 @@ logger = logging.getLogger(PACKAGE_NAME)
# disable internal logging
logging
.
getLogger
(
"
meross_iot
"
).
setLevel
(
logging
.
WARNING
)
class
GW
(
object
):
def
__init__
(
self
,
engine
):
self
.
engine
=
engine
...
...
@@ -23,9 +23,9 @@ class GW(object):
engine
.
on_start
(
self
.
setup
)
engine
.
on_stop
(
self
.
_exit
)
# refresh devices state
engine
.
add_timer
(
self
.
refresh
,
6
0
)
# dis
engine
.
add_timer
(
self
.
discover
,
6
0
)
engine
.
add_timer
(
self
.
refresh
,
12
0
)
# dis
cover
engine
.
add_timer
(
self
.
discover
,
30
0
)
def
config
(
self
):
cfg
=
tools
.
load_cfg
(
PACKAGE_NAME
)
...
...
@@ -33,7 +33,7 @@ class GW(object):
cfg
=
tools
.
new_cfg
(
PACKAGE_NAME
)
cfg
[
'
config
'
]
=
{
'
addr
'
:
tools
.
get_random_uuid
(),
'
login
'
:
''
,
'
password
'
:
''
}
cfg
[
'
devices
'
]
=
{}
logger
.
warn
(
"
Created an empty config file
"
)
logger
.
warn
ing
(
"
Created an empty config file
"
)
cfg
.
write
()
self
.
cfg
=
cfg
...
...
@@ -79,7 +79,7 @@ class GW(object):
# find a class to handle this device
klass
=
bindings
.
find_class
(
m_dev
)
if
not
klass
:
logger
.
warn
(
f
"
No binding for
{
m_dev
.
type
}
"
)
logger
.
warn
ing
(
f
"
No binding for
{
m_dev
.
type
}
"
)
continue
# search config
conf
=
devices_config
.
get
(
m_dev
.
uuid
,
None
)
...
...
@@ -109,6 +109,7 @@ class GW(object):
logger
.
info
(
'
Saving configuration file
'
)
self
.
cfg
.
write
()
def
setup
(
eng
):
GW
(
eng
)
return
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment