Hello! @marielle and I are interested in integrating YoLink devices via the YoLink API into PyLabRobot, and we wanted to open up a discussion about this. The YoLink API allows users to read from and write to a wide range of YoLink devices, and we believe it holds significant potential for affordable and versatile lab automation. The API is also OS-agnostic and open-source.
What is YoLink?
YoLink is a smart home and IoT platform that specializes in long-range, low-power wireless devices. They offer a diverse ecosystem of sensors and controllers, including:
- Environmental Sensors: Temperature and humidity sensors, water leak sensors, motion sensors, and more.
- Actuators/Controllers: Smart power strips, in-wall outlets, water shut-off valves, and various relay modules.
- Security Devices: Door/window sensors, sirens, and remote controls.
The core of the YoLink system is the YoLink Hub, which acts as a bridge between the devices and the internet. Devices communicate with the hub using LoRa technology, enabling better range and penetration compared to Wi-Fi or Bluetooth.
The YoLink API allows developers to interact with their devices remotely in Python. Through the API, you can:
- Read data from various sensors (e.g., current temperature, water leak status).
- Send commands to control specific devices (e.g., turn a power strip outlet on/off, open/close a water valve).
Why is YoLink useful for Lab Automation?
The combination of affordable devices, long-range communication, and a robust API makes YoLink appealing for lab automation. Here are a few examples of potential applications:
- Temperature Control: Imagine using YoLink temperature sensors to monitor the environment within an incubator or a specific experiment. You could then integrate these readings with YoLink smart power strips connected to space heaters or cooling pads to precisely maintain desired temperatures, creating a cost-effective and flexible environmental control system.
- Liquid Level Management: YoLinkâs water leak sensors and smart water valves could be used to monitor and control liquid levels in reservoirs, bioreactors, or chemical dispensing systems, preventing overflows or ensuring accurate dispensing.
- General Device Control & Monitoring: Remotely power cycling equipment, monitoring room conditions, or even setting up basic safety interlocks can all be setup with YoLink.
The low cost of YoLink devices, combined with their strong support network, makes them an attractive alternative to more specialized and expensive lab equipment for certain applications.
Integrating YoLink into PyLabRobot
Weâre particularly interested in discussing the best approach for integrating the YoLink API into PyLabRobot. Our initial thoughts are:
- IO Layer Integration: The YoLink API would likely sit within PyLabRobotâs IO layer, allowing for direct communication with YoLink devices.
- Device Abstraction: How should individual YoLink devices be represented?
- One option is to create a separate class for each type of YoLink device (e.g.,
YoLinkTemperatureSensor
,YoLinkSmartPowerStrip
). This might become unwieldy with the wide range of devices. - Alternatively, we could primarily focus on integrating the YoLink Hub as its own class within PyLabRobot. This hub class would then expose methods to interact with the connected YoLink devices.
- API Handling for Read vs. Write:
- For purely reading data from sensors, the YoLink API can often handle this straightforwardly. PyLabRobot would simply make the appropriate API calls and parse the responses.
- For writing commands to devices (e.g., controlling a smart power strip or water valve), we envision creating a more structured interface or âsetupâ within PyLabRobot that allows users to define and interact with these writable devices in a consistent manner. For instance, it could inherit from the machine class in PyLabRobot.
We would love to hear your thoughts and advice on these points and any other considerations for integrating YoLink into PyLabRobot.
Looking forward to your feedback!