Closed bockha closed 6 years ago
for IUNO-TDM/MixerControl#117 we need a interface in the pumpcontrol to read and write GPIO Pins.
reading and writing should be possible via the REST API. There should also be events, triggered by changing read signals. this should be implemented in the websocket interface
Configuration and API design should be discussed before implementing the feature
The user of PumpControl (like the MixerControl) should not know the GPIO PIN numbers. These should be configured in the settings file with the following keys:
io = gpio
io-config = <config as single-lined json>
where the single-lined json config string has a structure like this (not single lined for better readability:
[
{
"name":"start_button",
"pin":23,
"type":"input_pullup",
"polarity":"active_low"
},
{
"name":"start_button_illumination",
"pin":24,
"type":"output",
"polarity":"active_high"
},
{
"name":"cabinet_door_switch",
"pin":4,
"type":"input_pullup",
"polarity":"active_low"
},
{
"name":"juice_door_switch",
"pin":22,
"type":"input_pullup",
"polarity":"active_low"
}
]
The REST interface should be extended by the following routes:
general:
GET /io-description returns:
[
{
"name":"cabinet_door_switch",
"type":"input"
},
{
"name:"juice_door_switch",
"type":"input"
},
{
"name":"start_button",
"type":"input"
},
{
"name":"start_button_illumination",
"type":"output"
}
]
for output-pins:
PUT /io/<name> body:[on|off]
GET /io/<name> returns:[on|off]
for input-pins:
GET /io/<name> returns:[on|off]
The websocket interface should send messages, when an input value changes or on initial connection. Message format:
input: {
"name":"start_button"
"value":false
}
The new MotorShield contains three input connectors and one output connector. The inputs are thought to be connected to a startbutton and door switches, the output is thought to control the illumination of the startbutton.
The pump control shall be enhanced to publish changes of the inputs using the websocket interface. It shall also be enhanced to enable the control of the startbutton illumination over the websocket.
GPIO23 GPIO04GPIO23GPIO22GPIO04GPIO04 GPIO23GPIO22