Mote Light LEDs - versatile, variable and discrete. Plus Home Assitant Switches, groups & API

Method has changed a fair bit since this was first posted, should be easier to play around with now

https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-mote

I love these things, and all easily controlled with Home Assistant,

I bought two strips to replace the lights in an old Stereo Cabinet that houses a Raspberry Pi running Moode: http://moodeaudio.org/ , and the Mote lights of course. Really breathed modern life into the great old thing :slight_smile:

My code above expands on the manufacturer’s API with a Larson Scanner (cylon), Rainbow, Swipe, and Tiedye effects.

I’ve tweaked the API a bit so it’s easier to use as building blocks in Home Assistant for later patterns & colours etc.

To install:

  • Follow Pimoroni’s install instructions (will need to be a Debain base, hence Moode is a good music pick).

  • Copy these two files:

onto each Pi + Mote you want to control.

  • Taking the switches_mote_example.yaml as the starting point:

and build as many switches and combinations as you like:

The curl command layout is:

command_on: curl -s http://[mote IP]:5000/mote/api/v1.0/ …

larsonloop / 1200 / 0 / ee7600 /0.1/ 1 /1

[effect type] / [channel_selection] / [direction] / [hex colour] / [pause_time] / [ persistence] / [repeats]

There’s more detail on what they mean in the API file:

The overall control / play-around screen looks like this:

  • One final he script turns all the input_sliders etc. into a curl command:

It’s still a bit clunky, but really does get the job done.

My old music cabinet is now a visual-notification system, as well Pimped out stereo.

If there’s anyone with Motes, could you give this a try and let me know what you think?

Next task: learn AppDaemon which I imagine can take a lot of the messing out, make an overall MoteEffects class & hopefully get that merged into Pimoroni’s branch, and then make this a component in Home Assistant.


Some close ups inside the lamps:

My gif making skills are dreadful, and they don’t do the Motes justice - but here they are:

I’ll probably be receiving my strips this week so I hope you are ready to help me if I get stuck :smile:

Will do :slight_smile:

I must update the guide tomorrow, some improvements!

1 Like

Cool. I just got them in the mail so I will start to play with them :slight_smile:

1 Like

I’ve just updated the top post, all ready to install :slight_smile:

Hope it’s going well for you, I’ve to go away for a few hours but I’ll be around for longer later on.

So any problems or questions let me know!

For quick testing from another machine, you can try things like:

curl -s http://[RPi IP]:5000/mote/api/v1.0/rainbow/1234

curl -s http://[RPi IP]:5000/mote/api/v1.0/tiedye/1004

Enjoy!

Thanks :slight_smile:

I’m a total noob so I think I need more guidence on this.

I’ve copied your yaml files and receive this error:

17-03-14 13:52:17 ERROR (MainThread) [homeassistant.config] Invalid config for [input_slider]: expected a dictionary for dictionary value @ data[‘input_slider’][‘max’]. Got 254
expected a dictionary for dictionary value @ data[‘input_slider’][‘min’]. Got 0
expected a dictionary for dictionary value @ data[‘input_slider’][‘mote_value_red’]. Got None
expected a dictionary for dictionary value @ data[‘input_slider’][‘name’]. Got ‘Red’
expected a dictionary for dictionary value @ data[‘input_slider’][‘step’]. Got 1. (See /home/hass/.homeassistant/configuration.yaml, line 214). Please check the docs at Input Number - Home Assistant
17-03-14 13:52:17 ERROR (MainThread) [homeassistant.setup] Setup failed for input_slider: Invalid config.

I also need help in creating the on/off switch I see in your picture.

Thanks again for helping!

1 Like

So I got the sliders to show in the frontend, but none of the buttons or sliders are doing anything.

1 Like

I’m back now, you’re doing well I see :slight_smile:

So can you connect from the machine your Hass runs on to the machine your Motes run on?

In other words, a terminal command from the Hass machine to the Mote machine, such as:

curl -s http://[insert RPi IP here]:5000/mote/api/v1.0/rainbow/1234

should give you a light show?

If it does then great, the issue is with the Hass config.

If it doesn’t, we’ll check how it’s running on the Mote machine.

Or are they on the same machine?

We’ll sort it out either way.

Yep, I’m able to do the curl command remotely.

In my Hass config folder I have the following files:

mote-hass-api-call.py

mote-on-off-state.py

The contents of these is the same as on your github.

The same with the yaml files.

I’m running the AiO Hass installer in a venv with letsencrypt.

Great! So it’s on the Hass side of things.

I’m sure this is my direction, but you have this python file running as well?

Look out for the import MoteEffects as moeff line, that’s the freshest version - the one you want to have.

Also, the mote-on-off-state.py file isn’t needed anymore.

I’m wondering if the bits I’ve changed since this morning are changed from when you downloaded them.

Plus, there might be little pieces of my individual set-up still left in the code on github.

It seems like you’re very close, and it’s probably bits I haven’t noticed in my code + hass config that are the problem.

Shouldn’t take long, I imagine :slight_smile:

Ok, I’ll check all the files. Should code be the same as on github?

Yeah, it’s all up to date!

There might be parts I’ve missed, but we can comment them out.

Are the Mote, and your Home Assistant install on the same Pi ?

Ok, there seems to be some parts missing regarding:

  • input_boolean.mote_channel_1
  • input_boolean.mote_channel_2
  • input_boolean.mote_channel_3
  • input_boolean.mote_channel_4

Should I just create them myself?

The mote is running on a separate Pi.

Oh, apologies! I’ve made them, forgot to put them up :blush:

Also, I’ve missed the snippet for your configuration.yaml file:

input_boolean: !include input_booleans.yaml
input_slider: !include input_slider.yaml
input_select: !include input_select.yaml

Or if you have such sections already, then cut & paste the contents of my yamls into your sections.

Sorry about these missing bits!

No worries :slight_smile: I got those in place now.

I think maybe you need to update the switch yaml?

  • platform: command_line
    switches:
    wooden_stereo_lights:
    command_on: curl -s http://[mote IP]:5000/mote/api/v1.0/larsonloop/1200/0/ee7600/0.1/1/1
    command_off: curl -s http://[mote IP]:5000/mote/api/v1.0/larsonloop/1200/1/000000/0.11/1/1
    command_state: curl -s http://[mote IP]:5000/mote/api/v1.0/led_lit | grep ‘on’
    friendly_name: Stereo Cabinet

The command_state seems to be updating the correct state, but the command on/off isn’t doing anything.

Good to hear! Those commands work for mine, so we’ll have to check configs.

Could you post your switches.yaml section for the Mote light, and if you use the formatting feature <\> (to the right from Bold, Italic etc.) on what you paste, it will be formatted as HA expects, and I’ll be better able to compare it to mine.

Should be the same I think

switch:
  - platform: command_line
    switches:
      wooden_stereo_lights:
        command_on: curl -s http://192.168.1.58:5000/mote/api/v1.0/larsonloop/1200/0/ee7600/0.1/1/1
        command_off: curl -s http://192.168.1.58:5000/mote/api/v1.0/larsonloop/1200/1/000000/0.11/1/1
        command_state: curl -s http://192.168.1.58:5000/mote/api/v1.0/led_lit | grep 'on'
        friendly_name: Stereo Cabinet

All looks good there.

So to move to the next likely place, how does this look in mote-hass-api-call.py

response = get('http://[Home Assistant IP]:8123/api/states/input_select.mote_device_choice')
device = str(response.json()['state'])
if device == "Stereo":
    device = "http://[mote lights IP #1]:5000/mote/api/v1.0"

Sorry if we have to go around a few spots checking configs out.

Oh, I forgot to update that file. Doing that now.

Is there anything else I need to do with that file other than have in my Hass config folder?

You can comment-out this part if you’ve only one Mote:

elif device == "Square Circle":
    device = "http://[mote lights IP #2]:5000/mote/api/v1.0"
elif device == "Ceramic Oval":
    device = "http://[mote lights IP #3]:5000/mote/api/v1.0"

That’s from my set-up certainly.