Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
compact-slowcontrol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Peter-Bernd Otte
compact-slowcontrol
Commits
8d99e244
Commit
8d99e244
authored
Aug 17, 2019
by
Peter-Bernd Otte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
camelCase for luxThreshold
parent
fa34e222
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
python/relais-control/default.yml
python/relais-control/default.yml
+1
-1
python/relais-control/relais-control.py
python/relais-control/relais-control.py
+6
-6
python/relais-control/relais.py
python/relais-control/relais.py
+3
-3
No files found.
python/relais-control/default.yml
View file @
8d99e244
...
@@ -16,7 +16,7 @@ testraum/testrelais:
...
@@ -16,7 +16,7 @@ testraum/testrelais:
toggleTopics
:
homie/enocean/test/schalter2
toggleTopics
:
homie/enocean/test/schalter2
inverseSwitchOnTopics
:
homie/enocean/test/schalter6
inverseSwitchOnTopics
:
homie/enocean/test/schalter6
prolongateStateTopics
:
homie/enocean/test/schalter5
prolongateStateTopics
:
homie/enocean/test/schalter5
lux
t
hreshold
:
200
#below this threshold, lights get switched on. Default=100
lux
T
hreshold
:
200
#below this threshold, lights get switched on. Default=100
testraum/testrelais2
:
testraum/testrelais2
:
MQTTRelaisTopic
:
homie/fsr-ww/3
MQTTRelaisTopic
:
homie/fsr-ww/3
...
...
python/relais-control/relais-control.py
View file @
8d99e244
...
@@ -123,11 +123,11 @@ for section in cfg:
...
@@ -123,11 +123,11 @@ for section in cfg:
if
x
.
MQTTRelaisTopic
==
cfg
[
section
][
"MQTTRelaisTopic"
]:
if
x
.
MQTTRelaisTopic
==
cfg
[
section
][
"MQTTRelaisTopic"
]:
logger
.
error
(
"MQTTRelaisTopic: "
+
str
(
cfg
[
section
][
"MQTTRelaisTopic"
])
+
" does already exist. Will not be added."
)
logger
.
error
(
"MQTTRelaisTopic: "
+
str
(
cfg
[
section
][
"MQTTRelaisTopic"
])
+
" does already exist. Will not be added."
)
continue
continue
lux
t
hreshold
=
100
lux
T
hreshold
=
100
if
"lux
t
hreshold"
in
cfg
[
section
]:
if
"lux
T
hreshold"
in
cfg
[
section
]:
lux
threshold
=
cfg
[
section
][
"luxt
hreshold"
]
lux
Threshold
=
cfg
[
section
][
"luxT
hreshold"
]
if
type
(
lux
threshold
)
is
not
int
:
luxt
hreshold
=
100
if
type
(
lux
Threshold
)
is
not
int
:
luxT
hreshold
=
100
logger
.
debug
(
"lux
threshold used: "
+
str
(
luxt
hreshold
))
logger
.
debug
(
"lux
Threshold used: "
+
str
(
luxT
hreshold
))
defaultTopics
=
cfg
[
section
][
"defaultTopics"
]
if
"defaultTopics"
in
cfg
[
section
]
and
isinstance
(
cfg
[
section
][
"defaultTopics"
],(
list
,
str
))
else
[]
defaultTopics
=
cfg
[
section
][
"defaultTopics"
]
if
"defaultTopics"
in
cfg
[
section
]
and
isinstance
(
cfg
[
section
][
"defaultTopics"
],(
list
,
str
))
else
[]
toggleTopics
=
cfg
[
section
][
"toggleTopics"
]
if
"toggleTopics"
in
cfg
[
section
]
and
isinstance
(
cfg
[
section
][
"toggleTopics"
],(
list
,
str
))
else
[]
toggleTopics
=
cfg
[
section
][
"toggleTopics"
]
if
"toggleTopics"
in
cfg
[
section
]
and
isinstance
(
cfg
[
section
][
"toggleTopics"
],(
list
,
str
))
else
[]
...
@@ -152,7 +152,7 @@ for section in cfg:
...
@@ -152,7 +152,7 @@ for section in cfg:
switchOffTopics
=
switchOffTopics
,
switchOffTopics
=
switchOffTopics
,
defaultTopics
=
defaultTopics
,
inverseSwitchOnTopics
=
inverseSwitchOnTopics
,
defaultTopics
=
defaultTopics
,
inverseSwitchOnTopics
=
inverseSwitchOnTopics
,
prolongateStateTopics
=
prolongateStateTopics
,
prolongateStateTopics
=
prolongateStateTopics
,
defaultSwitchOffTime
=
defaultSwitchOffTime
,
debug
=
debugItem
,
relaisType
=
relaisType
,
lux
threshold
=
luxt
hreshold
))
defaultSwitchOffTime
=
defaultSwitchOffTime
,
debug
=
debugItem
,
relaisType
=
relaisType
,
lux
Threshold
=
luxT
hreshold
))
logger
.
info
(
"Adding successfully."
)
logger
.
info
(
"Adding successfully."
)
...
...
python/relais-control/relais.py
View file @
8d99e244
...
@@ -22,11 +22,11 @@ class rLightDesire(Enum):
...
@@ -22,11 +22,11 @@ class rLightDesire(Enum):
class
relais
:
class
relais
:
def
__init__
(
self
,
MQTTClient
,
MQTTName
,
MQTTRelaisTopic
,
defaultTopics
=
None
,
toggleTopics
=
None
,
dimmTopics
=
None
,
def
__init__
(
self
,
MQTTClient
,
MQTTName
,
MQTTRelaisTopic
,
defaultTopics
=
None
,
toggleTopics
=
None
,
dimmTopics
=
None
,
switchOffTopics
=
None
,
switchOffTopics
=
None
,
inverseSwitchOnTopics
=
None
,
prolongateStateTopics
=
None
,
defaultSwitchOffTime
=
None
,
debug
=
False
,
relaisType
=
"relais"
,
lux
t
hreshold
=
100
):
inverseSwitchOnTopics
=
None
,
prolongateStateTopics
=
None
,
defaultSwitchOffTime
=
None
,
debug
=
False
,
relaisType
=
"relais"
,
lux
T
hreshold
=
100
):
self
.
MQTTname
=
MQTTName
#string
self
.
MQTTname
=
MQTTName
#string
self
.
type
=
relaisType
# possible: "relais" and "dimmer"
self
.
type
=
relaisType
# possible: "relais" and "dimmer"
self
.
debug
=
debug
self
.
debug
=
debug
self
.
lux
threshold
=
luxt
hreshold
#below this threshold in lux the PIR switches on
self
.
lux
Threshold
=
luxT
hreshold
#below this threshold in lux the PIR switches on
self
.
MQTTClient
=
MQTTClient
#object
self
.
MQTTClient
=
MQTTClient
#object
self
.
MQTTRelaisTopic
=
MQTTRelaisTopic
#string
self
.
MQTTRelaisTopic
=
MQTTRelaisTopic
#string
...
@@ -89,7 +89,7 @@ class relais:
...
@@ -89,7 +89,7 @@ class relais:
self
.
timeLastStateConfirm
=
time
.
time
()
self
.
timeLastStateConfirm
=
time
.
time
()
if
self
.
debug
:
print
(
self
.
MQTTname
,
"Check Motion Sensors"
)
if
self
.
debug
:
print
(
self
.
MQTTname
,
"Check Motion Sensors"
)
lux
=
msg
[
'lux'
]
if
'lux'
in
msg
else
100
lux
=
msg
[
'lux'
]
if
'lux'
in
msg
else
100
if
msg
[
'v'
]
>
0
and
self
.
lux
t
hreshold
>
lux
:
if
msg
[
'v'
]
>
0
and
self
.
lux
T
hreshold
>
lux
:
self
.
lockingPIRs
.
add
(
topic
)
self
.
lockingPIRs
.
add
(
topic
)
self
.
lightdesire
=
rLightDesire
.
lockedDueToPIR
self
.
lightdesire
=
rLightDesire
.
lockedDueToPIR
self
.
setV
(
1
,
reason
=
"PIR motion"
)
self
.
setV
(
1
,
reason
=
"PIR motion"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment