ledenet_api icon indicating copy to clipboard operation
ledenet_api copied to clipboard

Http control Ufo

Open Dylantje opened this issue 8 years ago • 8 comments

Dear is see you have hacked the ufo rgbw controller.. Great job!!!!

I wil try to use this controller for my Home automation, Domoticz. Is there perhaps a option that i can use your way with Http commands? Domoticz can use the Http commands directly... Or perhaps a script, domoticz can work with different types.

I did install the ledenet api, only now i am stuc. Did install it on my RPi.

How can i use the api on a simple way. I do not understand where i can place/put the api [ in putty is get strange values ] Perhaps you have some examples, of your nice work

I am not ict expert... :-( Hope you will help me with your nice hack... I do not have a Ufo j@ this moment [ orderd 2 ] only i will learn before i got 1...

Thanks!!

Dylantje avatar Nov 06 '16 23:11 Dylantje

You could use ha_gateway. Allows you to set up a RESTful API and has an integration with ledenet_api.

sidoh avatar Nov 06 '16 23:11 sidoh

mm Thanks Ha is on the RPi.. Like i say... no ict expert :-)

I read that need the HW adres [ i do not have yet ] this is the mac? what is the name for? so i now what controller? or the name in my lan? Can i ad more controller in the config file?

Only i do not understand how i give a command...

Dylantje avatar Nov 07 '16 00:11 Dylantje

Yeah, hardware address is MAC address. Are you looking at the example config file?

      # There are a couple of ways you can specify which device you'd like
      # to control:
      #   1. Specify no params. Control an arbitrary (maybe the only?) LEDENET
      #      device on your network.
      #   2. Specify a hardware address. ha_gateway will attempt to resolve
      #      the host from the hw addr using a discovery protocol. This is
      #      preferable if you don't have a hostname or static IP for the
      #      LEDENET device.
      #   3. Specify a host directly.
      hw_addr: 00:00:00:00:00:00
      host: ledenet1

You can also use host if you want to hardcode a local IP address or hostname. hw_addr is just more robust to network changes.

sidoh avatar Nov 07 '16 00:11 sidoh

exactly the example is where i am looking at. [[ i use the mac and set the ip, when i got 1 :-) ] This is the easy part... :-)

What do i need to do more.... Can i create now a simple http command? Perhaps you have a example ?

Dylantje avatar Nov 07 '16 00:11 Dylantje

ha_gateway is a little REST server. You start it on some port (defined on the config), and then you can send REST commands at it. For example:

$ curl -vvv -X PUT -d'status=on'  http://192.168.1.100:8000/lights/light_name

where 192.168.1.100 is whatever IP the server is running on, and light_name is whatever you called the light in the YAML config.

The full HTTP spec is defined in the README of ha_gateway.

sidoh avatar Nov 07 '16 00:11 sidoh

going to try when i get the controller.. [ hard to get on this way ] Only i do not understand the way this working. Is it correct that the Ha_gateway is a kind of bridge? So it is possible to give command from a other device to the Wifi controller?

I need your code and the Ha_gateway... When i see your code i can control the whole range, rgb and fade etc. When i see the Ha gateway i see only on/off.

This part curl -vvv -X PUT -d'status=on' http://192.168.1.100:8000/lights/light_name that i can use in a script file? Only when i will activate the: SEVEN_COLOR_CROSS_FADE?

Do i need to place your example in a script file? What type are possible?Lua? Like my hue scrips:

#!/bin/sh
curl -H "Accept: application/json" -X PUT --data '{"on":false}' http://192.168.5.36/api/newdeveloper/lights/4/state

When i install HA-gateway, and reboot my rpi, is this server running? Or do i need to start it manual? Is there a crontab or something to check?

[ cannot wait until i get the controller. ]

Dylantje avatar Nov 07 '16 07:11 Dylantje

The full API documentation for ha_gateway is in the README. Here's the section for light devices:

https://github.com/sidoh/ha_gateway#put-lightlight_name

You can currently control on/off, RGB, and "level" (brightness). Would be easy enough to add additional parameters.

That's just the structure of an HTTP request to ha_gateway. You can obviously send it requests in a lot of ways.

sidoh avatar Nov 07 '16 08:11 sidoh

dear... Do have the wifi ufo @ home. Did connect to my Wifi. So i have the mac and a Ip... What are my next steps???

Dylantje avatar Dec 03 '16 19:12 Dylantje