heyOOCSI! entity information
These lines will add the real functionality to your prototype, pick one you are interested in!
Sensor
Create a sensor.
prototypename.addSensor(Name, OOCSI Channel, Type, Unit, Default value, icon)
Name | description | Value type | allowed values |
---|---|---|---|
Name | Device name | Required, String | Any |
OOCSI Channel | the OOCSI Channel we will use to communicate with the entity. | Required, String | An unique name per device. |
Type | What kind of sensor is it? | Optional, String | https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes |
Unit | The unit of output. | Required, String | https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes |
Default value | Value of sensor when idle. | Optional, String | Any. |
Icon | The icon displayed in HA. | Optional, String | https://materialdesignicons.com/ Copy the title of the icon page |
Number input
Create a number input.
prototypename.addNumber(Name, OOCSI Channel, Min-Max, Unit, Default value, icon)
Name | description | Tags | allowed |
---|---|---|---|
Name | Device name. | Required, String | Any. |
OOCSI Channel | The OOCSI Channel we will use to communicate with the entity. | Required, String | An unique name per device. |
Min and Max value | The minimum and maximum value the number input can take. | Array, Float | Any float, default 0 to 100 |
Unit | The unit of input. | String | https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes |
Default value | Value of sensor when starting. | Float | Any. |
Mode | The way of input. | TBD. | Â |
Icon | The icon displayed in HA. | String | https://materialdesignicons.com/ Copy the title of the icon page |
Binary sensor
Create a binary sensor.
prototypename.addBinarySensor(Name, OOCSI Channel, Sensortype, Default state, icon)
Name | description | Tags | allowed |
---|---|---|---|
Name | Device name. | Required, String | Any. |
OOCSI Channel | The OOCSI Channel we will use to communicate with the entity. | Required, String | An unique name per device. |
Type | The type of binary sensor. | Optional, String | https://developers.home-assistant.io/docs/core/entity/binary-sensor#available-device-classes |
Default value | Value of sensor when starting. | Boolean, Required | Value of sensor when starting. |
Icon | The icon displayed in HA. | Optional, String | https://materialdesignicons.com/ Copy the title of the icon page |
Switch
Create a digital switch.
prototypename.addSwitch(Name, Switchchannel, Switchtype, Default state, icon)
Name | description | Tags | allowed |
---|---|---|---|
Name | Device name. | Required, String | Any. |
OOCSI Channel | The OOCSI Channel we will use to communicate with the entity. | Required, String | An unique name per device. |
Type | The type of binary sensor. | Optional, String | https://developers.home-assistant.io/docs/core/entity/switch#available-device-classes |
Default value | Value of sensor when starting. | Boolean, Required | Value of sensor when starting. |
Icon | The icon displayed in HA. | Optional, String | https://materialdesignicons.com/ Copy the title of the icon page |
 |  |  |  |
Light
Create a digital light.
prototypename.addLight(Name, OOCSI Channel, Ledtype, Spectrum, Default state, Default brightness, Miredminmax, icon)
Name | description | Tags | allowed |
---|---|---|---|
Name | Device name. | Required, String | Any. |
OOCSI Channel | The OOCSI Channel we will use to communicate with the entity. | Required, String | An unique name per device. |
Led type | what type of lamp are you using? | Required, String | RGB, RGBW, RGBWW, CCT, DIMMABLE, ONOFF |
Spectrum | what spectrum(s) do you want your light to display only needed when using rgb lights | Optional, Required, String array | CCT, WHITE, RGB |
Default state | State of lamp when starting. | Boolean, Optional | Value of light when starting. default = off |
Default brightness | brightness value of light when starting. | Int | The default brightness when switching on. Value from 0 to 255 |
Mired Min and Max, These are only required when using CCT only leds | The maximum and minimum values of the colour temperature | Int array, Optional | Any integer your light supports, this is meant for colour accuracy |
Icon | The icon displayed in HA. | Optional, String | https://materialdesignicons.com/ Copy the title of the icon page |
Reference
# when using RGB/RGBW/RGBWW strips and a rgb spectrum
"colourRGB":<R,G,B>,
"colourRGBW":<R,G,B,W>,
"colourRGBWW":<R,G,B,WarmWhite,ColdWhite>
# when using RGB/RGBW strips and a cct spectrum
"colorTempInRGB":<R,G,B>
# when using white lights
"brightnessWhite":<brightness white state>
# when using cct lights
"colorTemp": <warm, cold>
# combined with state and brightness
{"brightness":<brightness>,"colourRGB()":<R,G,B>,state:<True/False>}
Full example in Python
from oocsi import OOCSI
import time
# oocsiConnection
o = OOCSI('testHeyOOCSI', 'localhost')
# create OOCSIDevice -----------------------------------------------------------------------------
# default name for device:
device = o.heyOOCSI()
# named device (for multiple digital oocsiDevices):
# device = o.heyOOCSI("my_first_device")
# create entities for the device:
# TODO document calls
device.add_binary_sensor_brick("sensor_name", "sensor_channel", "sensor_type", "sensor_default")
# TODO document calls
device.add_binary_sensor_brick("sensor_name2", "sensor_channel2", "sensor_type", "sensor_default")
# TODO document calls
device.add_switch_brick("switchname", "sensor_channel", "switch", "false", "lightbulb")
# TODO add all remaining calls
# TODO add example for property
# TODO add example for location
# don't forget to send the description off to the OOCSI server
device.sayHi()
# -----------------------------------------------------------------------------------------------
# run normal device-OOCSI communication
while 1:
message = {}
message['state'] = True
o.send('sensor_channel', message)
time.sleep(2)
message2 = {}
message2['state'] = False
o.send('sensor_channel', message2)
time.sleep(2)
# wait and continue