Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hauptbahnhof
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stustanet
hauptbahnhof
Commits
c78bdd21
Commit
c78bdd21
authored
6 years ago
by
Johannes Walcher
Browse files
Options
Downloads
Patches
Plain Diff
running fixes
parent
aa1e5255
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hauptbahnhof/hauptbahnhof.py
+3
-2
3 additions, 2 deletions
hauptbahnhof/hauptbahnhof.py
rupprecht/rupprecht.py
+11
-6
11 additions, 6 deletions
rupprecht/rupprecht.py
with
14 additions
and
8 deletions
hauptbahnhof/hauptbahnhof.py
+
3
−
2
View file @
c78bdd21
...
@@ -75,15 +75,16 @@ class Hauptbahnhof:
...
@@ -75,15 +75,16 @@ class Hauptbahnhof:
self
.
loop
.
cancel
()
self
.
loop
.
cancel
()
raise
raise
await
self
.
connected
.
wait
()
await
self
.
connected
.
wait
()
self
.
log
.
info
(
"
Successfully connected to %s
"
,
self
.
_config
[
'
host
'
])
self
.
log
.
info
(
"
Successfully connected to %s
"
,
self
.
_config
[
'
host
'
])
for
topic
in
self
.
_subscriptions
:
for
topic
in
self
.
_subscriptions
:
mqtt
.
subscribe
(
topic
)
mqtt
.
subscribe
(
topic
)
self
.
_mqtt
=
mqtt
while
self
.
_mqtt_queue
:
while
self
.
_mqtt_queue
:
topic
,
msg
=
self
.
_mqtt_queue
.
pop
(
0
)
topic
,
msg
=
self
.
_mqtt_queue
.
pop
(
0
)
self
.
log
.
debug
(
"
Topic: %s
"
,
topic
)
self
.
log
.
debug
(
"
Topic: %s
"
,
topic
)
await
self
.
_mqtt
.
publish
(
topic
,
msg
)
self
.
_mqtt
.
publish
(
topic
,
msg
)
# Now we have mqtt available!
# Now we have mqtt available!
self
.
_mqtt
=
mqtt
self
.
_mqtt
=
mqtt
...
...
This diff is collapsed.
Click to expand it.
rupprecht/rupprecht.py
+
11
−
6
View file @
c78bdd21
...
@@ -34,16 +34,19 @@ class Rupprecht:
...
@@ -34,16 +34,19 @@ class Rupprecht:
self
.
space_is_open
=
False
self
.
space_is_open
=
False
try
:
try
:
r
=
RupprechtInterface
(
"
/dev/ttyACM0
"
)
self
.
rupprecht
=
RupprechtInterface
(
"
/dev/ttyACM0
"
)
except
serial
.
SerialException
:
except
serial
.
SerialException
:
r
=
RupprechtInterface
(
"
/tmp/rupprechtemulator
"
)
self
.
rupprecht
=
RupprechtInterface
(
"
/tmp/rupprechtemulator
"
)
r
.
subscribe_button
(
self
.
button_message
)
self
.
rupprecht
.
subscribe_button
(
self
.
button_message
)
self
.
imposed_ids
=
{
self
.
imposed_ids
=
{
'
rupprecht-table
'
:
rcswitch
.
Quigg1000
(
code
=
1337
,
subaddr
=
1
,
rupprecht
=
r
),
'
rupprecht-table
'
:
rcswitch
.
Quigg1000
(
code
=
1337
,
subaddr
=
1
,
'
rupprecht-alarm
'
:
rcswitch
.
Quigg1000
(
code
=
1337
,
subaddr
=
2
,
rupprecht
=
r
),
rupprecht
=
self
.
rupprecht
),
'
rupprecht-fan
'
:
rcswitch
.
Quigg1000
(
code
=
1337
,
subaddr
=
3
,
rupprecht
=
r
)
'
rupprecht-alarm
'
:
rcswitch
.
Quigg1000
(
code
=
1337
,
subaddr
=
2
,
rupprecht
=
self
.
rupprecht
),
'
rupprecht-fan
'
:
rcswitch
.
Quigg1000
(
code
=
1337
,
subaddr
=
3
,
rupprecht
=
self
.
rupprecht
)
}
}
async
def
teardown
(
self
):
async
def
teardown
(
self
):
...
@@ -65,9 +68,11 @@ class Rupprecht:
...
@@ -65,9 +68,11 @@ class Rupprecht:
if
msg
[
'
open
'
]
and
not
self
.
space_is_open
:
if
msg
[
'
open
'
]
and
not
self
.
space_is_open
:
self
.
space_is_open
=
True
self
.
space_is_open
=
True
await
self
.
hbf
.
publish
(
'
/haspa/status
'
,
json
.
dumps
({
'
haspa
'
:
'
open
'
}))
await
self
.
hbf
.
publish
(
'
/haspa/status
'
,
json
.
dumps
({
'
haspa
'
:
'
open
'
}))
self
.
rupprecht
.
text
(
"
Status: Open
"
)
elif
not
msg
[
'
open
'
]
and
self
.
space_is_open
:
elif
not
msg
[
'
open
'
]
and
self
.
space_is_open
:
self
.
space_is_open
=
False
self
.
space_is_open
=
False
await
self
.
hbf
.
publish
(
'
/haspa/status
'
,
json
.
dumps
({
'
haspa
'
:
'
closed
'
}))
await
self
.
hbf
.
publish
(
'
/haspa/status
'
,
json
.
dumps
({
'
haspa
'
:
'
closed
'
}))
self
.
rupprecht
.
text
(
"
Status: Closed
"
)
class
RupprechtInterface
:
class
RupprechtInterface
:
class
SerialProtocol
(
asyncio
.
Protocol
):
class
SerialProtocol
(
asyncio
.
Protocol
):
...
...
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