Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-mqtt-gpio
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Alexander Wellbrock
python-mqtt-gpio
Commits
d87770d9
Commit
d87770d9
authored
Oct 17, 2020
by
Ellis Percival
Browse files
Options
Downloads
Patches
Plain Diff
Publish initial output value. #125
parent
283d9ad5
Branches
Branches containing commit
Tags
18.3.0
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.schema.yml
+7
-0
7 additions, 0 deletions
config.schema.yml
pi_mqtt_gpio/__init__.py
+4
-0
4 additions, 0 deletions
pi_mqtt_gpio/__init__.py
pi_mqtt_gpio/server.py
+9
-0
9 additions, 0 deletions
pi_mqtt_gpio/server.py
with
20 additions
and
0 deletions
config.schema.yml
+
7
−
0
View file @
d87770d9
...
...
@@ -275,6 +275,10 @@ digital_outputs:
type
:
boolean
required
:
no
default
:
no
publish_initial
:
type
:
boolean
required
:
no
default
:
no
sensor_inputs
:
type
:
list
...
...
@@ -306,6 +310,9 @@ sensor_inputs:
required
:
no
default
:
2
min
:
0
unit_of_measurement
:
type
:
string
required
:
no
stream_reads
:
type
:
list
...
...
This diff is collapsed.
Click to expand it.
pi_mqtt_gpio/__init__.py
+
4
−
0
View file @
d87770d9
...
...
@@ -279,6 +279,10 @@ digital_outputs:
type: boolean
required: no
default: no
publish_initial:
type: boolean
required: no
default: no
sensor_inputs:
type: list
...
...
This diff is collapsed.
Click to expand it.
pi_mqtt_gpio/server.py
+
9
−
0
View file @
d87770d9
...
...
@@ -1110,6 +1110,15 @@ def main(args):
for
out_conf
in
digital_outputs
:
initialise_digital_output
(
out_conf
,
GPIO_MODULES
[
out_conf
[
"
module
"
]])
# If configured to do so, publish the initial states of the outputs
initial_setting
=
out_conf
.
get
(
"
initial
"
)
if
initial_setting
is
not
None
and
out_conf
.
get
(
"
publish_initial
"
,
False
):
payload
=
out_conf
[
"
on_payload
"
if
initial_setting
else
"
off_payload
"
]
client
.
publish
(
"
%s/%s/%s
"
%
(
topic_prefix
,
OUTPUT_TOPIC
,
out_conf
[
"
name
"
]),
retain
=
out_conf
[
"
retain
"
],
payload
=
payload
,
)
for
sens_conf
in
sensor_inputs
:
try
:
...
...
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
sign in
to comment