diff --git a/.gitbook/assets/bildschirmaufnahme-2021-01-24-um-11.47.30.mov b/.gitbook/assets/bildschirmaufnahme-2021-01-24-um-11.47.30.mov new file mode 100644 index 0000000..40d991a Binary files /dev/null and b/.gitbook/assets/bildschirmaufnahme-2021-01-24-um-11.47.30.mov differ diff --git a/README.md b/README.md index 66ba0b6..8a7a655 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ cbpi start ## Links -{% embed url="https://www.facebook.com/groups/craftbeerpi" %} +{% embed url="https://www.facebook.com/groups/craftbeerpi" caption="" %} -{% embed url="https://www.youtube.com/channel/UCy47sYaG8YLwJWw2iY5\_aNg" %} +{% embed url="https://www.youtube.com/channel/UCy47sYaG8YLwJWw2iY5\_aNg" caption="" %} -{% embed url="http://web.craftbeerpi.com" %} +{% embed url="http://web.craftbeerpi.com" caption="" %} diff --git a/development.md b/development.md index f441dc5..a106ead 100644 --- a/development.md +++ b/development.md @@ -19,27 +19,19 @@ python3 -m pip insatll cbpi ### 2. Create Folder structure - - ### 3. Add Custom Code - - ### 4. Test the Code - - ### 3. Build plugin - - ### 4. Upload the plugin ### Full Example [https://github.com/Manuel83/cbpi4-ui-plugin](https://github.com/Manuel83/cbpi4-ui-plugin) -## Sensor +## Sensor ```python # -*- coding: utf-8 -*- @@ -60,13 +52,13 @@ Make sure to extend CBPiSensor Property.Sensor(label="Param4"), Property.Actor(label="Param5")]) class CustomSensor(CBPiSensor): - + def __init__(self, cbpi, id, props): - + super(CustomSensor, self).__init__(cbpi, id, props) self.value = 0 - + @action(key="Test", parameters=[]) async def action1(self, **kwargs): ''' @@ -83,7 +75,7 @@ class CustomSensor(CBPiSensor): self.value = random.randint(0,50) self.push_update(self.value) await asyncio.sleep(1) - + def get_state(self): # return the current state of the sensor return dict(value=self.value) @@ -94,7 +86,7 @@ def setup(cbpi): ''' This method is called by the server during startup Here you need to register your plugins at the server - + :param cbpi: the cbpi core :return: ''' @@ -104,7 +96,6 @@ def setup(cbpi): ## Actor ```python - import logging from unittest.mock import MagicMock, patch @@ -141,10 +132,10 @@ class CustomActor(CBPiActor): print("ACTION !", kwargs) self.my_name = kwargs.get("name") pass - + def init(self): print("INIT") - + self.state = False pass @@ -157,9 +148,9 @@ class CustomActor(CBPiActor): self.state = False def get_state(self): - + return self.state - + async def run(self): pass @@ -168,7 +159,7 @@ def setup(cbpi): ''' This method is called by the server during startup Here you need to register your plugins at the server - + :param cbpi: the cbpi core :return: '''