Link Search Menu Expand Document

heyOOCSI! entity information

These lines will add the real functionality to your prototype, pick one you are interested in!

  1. Sensor
  2. Number input
  3. Binary sensor
  4. Switch
  5. Light
  6. Full example in Python

Sensor

Create a sensor.

prototypename.addSensor(Name, OOCSI Channel, Type, Unit, Default value, icon)
NamedescriptionValue typeallowed values
NameDevice nameRequired, StringAny
OOCSI Channelthe OOCSI Channel we will use to communicate with the entity.Required, StringAn unique name per device.
TypeWhat kind of sensor is it?Optional, Stringhttps://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes
UnitThe unit of output.Required, Stringhttps://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes
Default valueValue of sensor when idle.Optional, StringAny.
IconThe icon displayed in HA.Optional, Stringhttps://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)
NamedescriptionTagsallowed
NameDevice name.Required, StringAny.
OOCSI ChannelThe OOCSI Channel we will use to communicate with the entity.Required, StringAn unique name per device.
Min and Max valueThe minimum and maximum value the number input can take.Array, FloatAny float, default 0 to 100
UnitThe unit of input.Stringhttps://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes
Default valueValue of sensor when starting.FloatAny.
ModeThe way of input.TBD. 
IconThe icon displayed in HA.Stringhttps://materialdesignicons.com/ Copy the title of the icon page

Binary sensor

Create a binary sensor.

prototypename.addBinarySensor(Name, OOCSI Channel, Sensortype, Default state, icon)
NamedescriptionTagsallowed
NameDevice name.Required, StringAny.
OOCSI ChannelThe OOCSI Channel we will use to communicate with the entity.Required, StringAn unique name per device.
TypeThe type of binary sensor.Optional, Stringhttps://developers.home-assistant.io/docs/core/entity/binary-sensor#available-device-classes
Default valueValue of sensor when starting.Boolean, RequiredValue of sensor when starting.
IconThe icon displayed in HA.Optional, Stringhttps://materialdesignicons.com/ Copy the title of the icon page

Switch

Create a digital switch.

prototypename.addSwitch(Name, Switchchannel, Switchtype, Default state, icon)
NamedescriptionTagsallowed
NameDevice name.Required, StringAny.
OOCSI ChannelThe OOCSI Channel we will use to communicate with the entity.Required, StringAn unique name per device.
TypeThe type of binary sensor.Optional, Stringhttps://developers.home-assistant.io/docs/core/entity/switch#available-device-classes
Default valueValue of sensor when starting.Boolean, RequiredValue of sensor when starting.
IconThe icon displayed in HA.Optional, Stringhttps://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)
NamedescriptionTagsallowed
NameDevice name.Required, StringAny.
OOCSI ChannelThe OOCSI Channel we will use to communicate with the entity.Required, StringAn unique name per device.
Led typewhat type of lamp are you using?Required, StringRGB, RGBW, RGBWW, CCT, DIMMABLE, ONOFF
Spectrumwhat spectrum(s) do you want your light to display only needed when using rgb lightsOptional, Required, String arrayCCT, WHITE, RGB
Default stateState of lamp when starting.Boolean, OptionalValue of light when starting. default = off
Default brightnessbrightness value of light when starting.IntThe default brightness when switching on. Value from 0 to 255
Mired Min and Max, These are only required when using CCT only ledsThe maximum and minimum values of the colour temperatureInt array, OptionalAny integer your light supports, this is meant for colour accuracy
IconThe icon displayed in HA.Optional, Stringhttps://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

Copyright © 2013-2024 Mathias Funk. test