-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from boneIO-eu/dev
v0.7.0
- Loading branch information
Showing
42 changed files
with
1,820 additions
and
834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
boneio/example_config/adc.yaml → boneio/example_config/adc_v0_4.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
- id: adc1 | ||
pin: P9_39 | ||
pin: P9_33 | ||
- id: adc2 | ||
pin: P9_40 | ||
pin: P9_36 | ||
- id: adc3 | ||
pin: P9_37 | ||
pin: P9_35 | ||
- id: adc4 | ||
pin: P9_38 | ||
- id: adc5 | ||
pin: P9_35 | ||
pin: P9_37 | ||
- id: adc6 | ||
pin: P9_36 | ||
pin: P9_40 | ||
- id: adc7 | ||
pin: P9_33 | ||
pin: P9_39 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- id: IN_47 | ||
pin: P8_12 | ||
kind: sensor | ||
detection_type: "old" | ||
- id: IN_48 | ||
pin: P8_11 | ||
kind: sensor | ||
detection_type: "new" | ||
- id: IN_49 | ||
pin: P8_10 | ||
kind: sensor | ||
|
||
- id: IN_50 | ||
pin: P8_9 | ||
kind: sensor | ||
- id: IN_51 | ||
pin: P8_8 | ||
kind: sensor | ||
- id: IN_52 | ||
pin: P8_7 | ||
kind: sensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
- id: OUT_01 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 9 | ||
output_type: light | ||
|
||
- id: OUT_02 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 8 | ||
output_type: light | ||
|
||
- id: OUT_03 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 1 | ||
output_type: light | ||
|
||
- id: OUT_04 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 0 | ||
output_type: light | ||
|
||
- id: OUT_05 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 13 | ||
output_type: light | ||
|
||
- id: OUT_06 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 12 | ||
output_type: light | ||
|
||
- id: OUT_07 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 11 | ||
output_type: light | ||
|
||
- id: OUT_08 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 10 | ||
output_type: light | ||
|
||
- id: OUT_09 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 14 | ||
output_type: light | ||
|
||
- id: OUT_10 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 15 | ||
output_type: light | ||
|
||
- id: OUT_11 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 13 | ||
output_type: light | ||
|
||
- id: OUT_12 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 12 | ||
output_type: light | ||
|
||
- id: OUT_13 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 6 | ||
output_type: light | ||
|
||
- id: OUT_14 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 5 | ||
output_type: light | ||
|
||
- id: OUT_15 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 4 | ||
output_type: light | ||
|
||
- id: OUT_16 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 3 | ||
output_type: light | ||
|
||
- id: OUT_17 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 2 | ||
output_type: light | ||
|
||
- id: OUT_18 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 0 | ||
output_type: light | ||
|
||
- id: OUT_19 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 1 | ||
output_type: light | ||
|
||
- id: OUT_20 | ||
kind: mcp | ||
mcp_id: mcp1 | ||
pin: 7 | ||
output_type: light | ||
|
||
- id: OUT_21 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 8 | ||
output_type: light | ||
|
||
- id: OUT_22 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 9 | ||
output_type: light | ||
|
||
- id: OUT_23 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 11 | ||
output_type: light | ||
|
||
- id: OUT_24 | ||
kind: mcp | ||
mcp_id: mcp2 | ||
pin: 10 | ||
output_type: light |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Group classes.""" | ||
from .output import OutputGroup | ||
|
||
__all__ = ["OutputGroup"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
"""Cover module.""" | ||
from __future__ import annotations | ||
import logging | ||
import asyncio | ||
from typing import List | ||
|
||
from boneio.const import COVER, SWITCH, ON, OFF | ||
from boneio.relay.basic import BasicRelay | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class OutputGroup(BasicRelay): | ||
"""Cover class of boneIO""" | ||
|
||
def __init__( | ||
self, | ||
members: List[BasicRelay], | ||
output_type: str = SWITCH, | ||
restored_state: bool = True, | ||
**kwargs, | ||
) -> None: | ||
"""Initialize cover class.""" | ||
self._loop = asyncio.get_event_loop() | ||
super().__init__( | ||
**kwargs, output_type=output_type, restored_state=restored_state, topic_type="group" | ||
) | ||
self._group_members = [x for x in members if x.output_type != COVER] | ||
self._timer_handle = None | ||
for member in self._group_members: | ||
self._event_bus.add_output_listener(member.id, self.event_listener) | ||
|
||
async def event_listener(self, relay_id=None) -> None: | ||
"""Listen for events called by children relays.""" | ||
state = OFF | ||
for x in self._group_members: | ||
if x.state == ON: | ||
state = ON | ||
break | ||
if state != self._state or not relay_id: | ||
self._state = state | ||
self._loop.call_soon_threadsafe(self.send_state) | ||
|
||
def turn_on(self) -> None: | ||
"""Call turn on action.""" | ||
for x in self._group_members: | ||
asyncio.create_task(x.async_turn_on()) | ||
|
||
def turn_off(self) -> None: | ||
"""Call turn off action.""" | ||
for x in self._group_members: | ||
asyncio.create_task(x.async_turn_off()) | ||
|
||
def toggle(self) -> None: | ||
"""Toggle group.""" | ||
_LOGGER.debug("Toggle relay.") | ||
if self._state == ON: | ||
self.turn_off() | ||
else: | ||
self.turn_on() | ||
|
||
def send_state(self) -> None: | ||
"""Send state to Mqtt on action.""" | ||
self._send_message(topic=self._send_topic, payload=self.payload(), retain=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.