This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Power Strip - socket class - multiple onoff

i plan to code a driver for a power strip with individually controlled 4 outlets.

reading the documentation, socket class seemed logical but it only has one onoff capability. i looked at examples, search the forum but could not find an answer.

any tips on coding multiple onoffs?

Comments

  • Depends on the type of device. With Z-wave it is easy. Have a look at the Greenwave code for the Greenwave 6. Others is more difficult, but you can have a look at the code for the Xiaomi zigbee devices
  • thank you.
    i just got my homey yesterday :)

    to learn the platform i decided to use my esp8266 devices with homeyduino.
    my issue was already marked as bug on github.
  • I think that, conceptually, there are two solutions:
    • create a single device that has multiple `onoff` capabilities (`onoff.0`, `onoff.1`, `onoff.2`, ..., see the documentation, specifically "Using the same capability more than once").
    • or create a new device for each outlet, so adding your device, with 4 outlets, would create 4 Homey devices (during pairing, you can add an entry for each "device" in the array that's created in `Driver#onPairListDevices`).
    I've seen both solutions being implemented in apps, so from what I know, there isn't really one accepted solution.
  • @robertklep : homeyduino does not support dot followed by an identifier, yet.
    https://github.com/athombv/homey-arduino-library/issues/41

  • gn0st1c said:
    @robertklep : homeyduino does not support dot followed by an identifier, yet.
    https://github.com/athombv/homey-arduino-library/issues/41

    Oh, that sucks :( In that case, creating two different devices might be the best option. That's also what I want to use in my own Sonoff app.
  • Got the same problem, hope they solve it soon.

  • from the developer;

    I am currently busy with my graduation internship, because of this I do not have time to look any further into the issue you are experiencing.

    (My internship at Athom has ended over a month ago...)

  • Mmmm hopefully some new internship can pick this up because it will be very great to have!
  • fixing support for dot followed by an identifier was rather easy. but it took me almost half a day to realize that class selection limits the capabilities.

    there is no mention of this limitation in the documents; https://apps.developer.athom.com/tutorial-Drivers-Reference.html

    i was using the socket class and was wondering why my measure_temperature was not showing. changing the class to sensor fixed that. (for sonoff THxx)

    for multiple relays, i'm using relay1_set, relay2_set .. actions and relay1_state, relay2_state .. conditions. (again for socket class, even if you add a second onoff, it doesn't show up on device)

    and for one of my "wifi plugs" which has RGB leds that you can set, i had to use light class.

    i'm sure at one point they'll remove several of these restrictions so we can get rid of these work arounds.
  • robertkleprobertklep Member
    edited March 2018
    @gn0st1c you can add additional capabilities that don't belong to that device class, but if you want them to show up on the "mobile card" you have to add them yourself: https://developer.athom.com/docs/apps/tutorial-Drivers-Mobile.html (if you don't configure it, the default mobile card for that device class will be used, which won't include the extra capabilities you added).
  • @robertklep : thank you for the tip. i never use the mobile app but i guess i can give it a try now :)

  • @gn0st1c even though they are called "mobile cards", those are the cards that show the different capability values in the "Zones & Devices" view of the (desktop) app (or in the browser).
  • found this, i wish i've seen this earlier; https://github.com/athombv/homey/issues/2297

    this is good news:
    The capabilities are indeed not linked anymore (as preparation for Homey v2.0.0)


Sign In or Register to comment.