[689] Hyperion integration

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

[689] Hyperion integration

Post by deennoo »

Hello,

Just set up an Hyperion solution.

Hyperion is a DIY Ambilight for TV/movie etc etc.

This well documented : https://github.com/tvdzwan/hyperion/wiki and really stable

It's works as a web server.

Using it with XBMC is a real pleasure, and adding a video grabber you can appli Hyperion to your ISPTVbox or DVB reciever (if not inclued on your TV).

Hyperion can be use as "light" with Android/ios/webapp, and got some cool effect, of course we can use script to drive it for "effects", but not really user friendly for RGB color.

As this solution, is stable, well documented, can give a real WAF to our home automation, this can be really cool if it can be Drive by Domoticz :

Somes exemples :
- When Movie/tv show is end, turn TV and all accessorie OFF
- When it's lover time, set hyperion on a charming candel mode (using a 433 Remote or NFC Tag, or any thing you can use to define this).
- When is party (defin by a google calendar event) set Hyperion on disco mode
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
iMars
Posts: 8
Joined: Tuesday 17 November 2015 21:51
Target OS: Linux
Domoticz version: Latest
Contact:

Re: [689] Hyperion integration

Post by iMars »

With the following commands you can change the effect/color:

Code: Select all

echo '{ "command": "effect", "effect": {"name": "Full color mood blobs"}, "priority": 100 }' | nc x.x.x.x 19444
echo '{ "command": "clear", "priority": 100 }' | nc x.x.x.x 19444
echo '{ "command": "color", "color": [255,255,255], "priority": 100 }' | nc x.x.x.x 19444
Edit: wrong button, submit instead of preview :oops:

With "runcommand" in a LUA script you can execute a command:

Code: Select all

runcommand = "echo '{ "command": "color", "color": [255,255,255], "priority": 100 }' | nc x.x.x.x 19444"
Where x.x.x.x is ofcourse the IP of hyperion
Create a device this way: http://blog.quindorian.org/2015/01/esp8 ... -of-x.html
And use the following script (not the one on the page mentioned above):

Code: Select all

pi@domoticz:~$ cat domoticz/scripts/lua/script_device_MoodLight.lua
commandArray = {}

DomDevice = 'MoodLight' --name device
IP = 'x.x.x.x' -- ip address hyperion
Port = '19444'
-- default color (one color, dimmable)
DomR = 255 --RED
DomG = 31  --GREEN
DomB = 0   --BLUE

if devicechanged[DomDevice] then
        if(devicechanged[DomDevice]=='Off') then
                DomValue = 0;
                print('Turn '..DomDevice..' off...')
        elseif(devicechanged[DomDevice]=='On') then
                DomValue = 31;
                print('Turn '..DomDevice..' on...')
        else
                DomValue = (otherdevices_svalues[DomDevice]);
        end
        print('DomValue for '..DomDevice..' changed to:'..DomValue)
        DomR = math.ceil(DomValue / 31 * DomR)
        DomG = math.ceil(DomValue / 31 * DomG)
        DomB = math.ceil(DomValue / 31 * DomB)
        runcommand = "echo  '{ \"color\": [" .. DomR .. "," .. DomG .. "," .. DomB .. "], \"command\": \"color\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
        print (runcommand);
        os.execute(runcommand);
end

return commandArray
pi@domoticz:~$
This create a dimmer which can fade only one color (I've got 4 dimmers for my Hyperion).

Note: Domoticz has priority 10, XBMC/Kodi has priority 1. When movie is playing, i've got ambilight, when movie stops, it goes back to the color set with domoticz ;)
User avatar
iMars
Posts: 8
Joined: Tuesday 17 November 2015 21:51
Target OS: Linux
Domoticz version: Latest
Contact:

Re: [689] Hyperion integration

Post by iMars »

Ofcourse a full integration would be even better! Or a dummy rgb dimmer, which can pass the corrosponding hex code to a LUA script, that combining my script would make it possible to have ONE switch for all kinds of colors :idea:
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

iMars wrote:Ofcourse a full integration would be even better! Or a dummy rgb dimmer, which can pass the corrosponding hex code to a LUA script, that combining my script would make it possible to have ONE switch for all kinds of colors :idea:
Thanks for your help !

I really love this idea, and a rolling menu to choose which effect we want when "planning" a scene.

Very Nice Blog !!

I plan to do some looks like of your Ikea Hack but with a DIY Philips Hue Bridge (who act as a bulb too : https://github.com/sticilface/Esp8266-Hue) + ws2812b + Wemos Mini D1 : bridge part is ok, and well reconnize by domoticz, waiting my ws2812b strip.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

First feedback : perfect !

Just one issue :
- i use v4l2 grabber, not kodi ones.

when turn "virtual dimmer" off that doesn't enable v4l2, my led strip stay off until i restart hyperion.

Any idea ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

Got a solution : sending clearall when dimmer is off, freeing v4l2 led strip.

Now have to know how set this on lua script
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
iMars
Posts: 8
Joined: Tuesday 17 November 2015 21:51
Target OS: Linux
Domoticz version: Latest
Contact:

Re: [689] Hyperion integration

Post by iMars »

deennoo wrote:Got a solution : sending clearall when dimmer is off, freeing v4l2 led strip.

Now have to know how set this on lua script
Use my script, and instead of color 0,0,0 > use echo '{ "command": "clear", "priority": 100 }' | nc x.x.x.x 19444

Code: Select all

commandArray = {}

DomDevice = 'MoodLight' --name device
IP = 'x.x.x.x' -- ip address hyperion
Port = '19444'
-- default color (one color, dimmable)
DomR = 255 --RED
DomG = 31  --GREEN
DomB = 0   --BLUE

if devicechanged[DomDevice] then
        if(devicechanged[DomDevice]=='Off') then
                --DomValue = 0;
                print('Turn '..DomDevice..' off...')
                runcommand = "echo  '{ \"command\": \"clear\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
                print (runcommand);
                os.execute(run command);
                return commandArray;
        elseif(devicechanged[DomDevice]=='On') then
                DomValue = 31;
                print('Turn '..DomDevice..' on...')
        else
                DomValue = (otherdevices_svalues[DomDevice]);
        end
        print('DomValue for '..DomDevice..' changed to:'..DomValue)
        DomR = math.ceil(DomValue / 31 * DomR)
        DomG = math.ceil(DomValue / 31 * DomG)
        DomB = math.ceil(DomValue / 31 * DomB)
        runcommand = "echo  '{ \"color\": [" .. DomR .. "," .. DomG .. "," .. DomB .. "], \"command\": \"color\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
        print (runcommand);
        os.execute(runcommand);
end

return commandArray
By the way... it isn't my blog, I've reused his information and adjusted it for hyperion.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

will try it ! thanks !

Good blog by the way !
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

It perfectly Works !

Thanks for your help !!
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

Next step ?

Get a "color picker"

Set One Dummy dimmer for each color who write on variable is value.
Set One Dummy dimmer for "lighting level" (Value variable for Hyperion remote / Level Variable for domoticz dimmer)

When Moving one of the dummy color slider it send to hyperion Red Dimmer + Blue Dimmer + Green Dimmer value to flollow :

Code: Select all

runcommand = "echo  '{ \"color\": [" .. DomR .. "," .. DomG .. "," .. DomB .. "], \"command\": \"color\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
Where DomR is value set last time you move slider
Where DomG is value set last time you move slider
Where DomB is value set last time you move slider
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
iMars
Posts: 8
Joined: Tuesday 17 November 2015 21:51
Target OS: Linux
Domoticz version: Latest
Contact:

Re: [689] Hyperion integration

Post by iMars »

deennoo wrote:Next step ?

Get a "color picker"

Set One Dummy dimmer for each color who write on variable is value.
Set One Dummy dimmer for "lighting level" (Value variable for Hyperion remote / Level Variable for domoticz dimmer)

When Moving one of the dummy color slider it send to hyperion Red Dimmer + Blue Dimmer + Green Dimmer value to flollow :

Code: Select all

runcommand = "echo  '{ \"color\": [" .. DomR .. "," .. DomG .. "," .. DomB .. "], \"command\": \"color\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
Where DomR is value set last time you move slider
Where DomG is value set last time you move slider
Where DomB is value set last time you move slider
I don't want to use this option, I've tried it, and its not handy. Only 31 red's, 31, blue's and 31 green's. Stil, you should be able to create 32.768 different colors, yet not do-able. I've created 4 sliders for the most used colors: light yellow for normal light, yellow, orange and red. All 4 with sliders like my first posted script.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

OK !

Thanks for your feedback

Next step again ?

Made my hyperion follow my Milight color value...

Looks crazy that we are only 2 using hyperion & domoticz
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
ab1976
Posts: 3
Joined: Friday 13 February 2015 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [689] Hyperion integration

Post by ab1976 »

I/m also using the solution from hyperion and was looking for a similair olution you are working on :-)
+++++++++++++++++++++++++++++
Raspberry Pi B+
RFXCOMe
Kaku switches
x10 Security System
My system also act as XBMC
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

Got a New probleme,

For fun i want some switch to load and stop effect :

Base on iMars elements i made this script, no lua error but no reaction from hyperion :

Code: Select all

commandArray = {}

DomDevice = 'Hyperion Arc en Ciel' --name device
IP = '192.168.0.245' -- ip address hyperion
Port = '19444'


if devicechanged[DomDevice] then
        if(devicechanged[DomDevice]=='Off') then
                
                print('Turn '..DomDevice..' off...')
                runcommand = "echo  '{ \"command\": \"clear\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
                print (runcommand);
                os.execute(runcommand);
                return commandArray;
        elseif(devicechanged[DomDevice]=='On') then
                print('Arc En ciel Rapide !')
                runcommand = "echo  '{ \"command\": \"effect\", \"effect\": {\"name\": \"Rainbow swirl fast\" }, \"priority\": 100 }' | " .. (IP) .. " " .. (Port) .. " ";
                os.execute(runcommand);
end
end

return commandArray
Any Idea please ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
iMars
Posts: 8
Joined: Tuesday 17 November 2015 21:51
Target OS: Linux
Domoticz version: Latest
Contact:

Re: [689] Hyperion integration

Post by iMars »

deennoo wrote:Got a New probleme,

For fun i want some switch to load and stop effect :

Base on iMars elements i made this script, no lua error but no reaction from hyperion :

Code: Select all

commandArray = {}

DomDevice = 'Hyperion Arc en Ciel' --name device
IP = '192.168.0.245' -- ip address hyperion
Port = '19444'


if devicechanged[DomDevice] then
        if(devicechanged[DomDevice]=='Off') then
                
                print('Turn '..DomDevice..' off...')
                runcommand = "echo  '{ \"command\": \"clear\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
                print (runcommand);
                os.execute(runcommand);
                return commandArray;
        elseif(devicechanged[DomDevice]=='On') then
                print('Arc En ciel Rapide !')
                runcommand = "echo  '{ \"command\": \"effect\", \"effect\": {\"name\": \"Rainbow swirl fast\" }, \"priority\": 100 }' | " .. (IP) .. " " .. (Port) .. " ";
                os.execute(runcommand);
end
end

return commandArray
Any Idea please ?
Take a good look at your code :geek:

You can run the command from a terminal (I work on a Mac, If you work on Windows, ssh with putty to domoticz or your hyperion linux ;) ).
I ran your command: echo '{ "command": "effect", "effect": {"name": "Rainbow swirl fast" }, "priority": 10 }' | <my ip> 19444 and it didn't work... because you've forgotten the "nc" right after the "|" before your <ip> :lol:
The right syntax is: echo '{ "command": "effect", "effect": {"name": "Rainbow swirl fast" }, "priority": 10 }' | nc <your ip> 19444

I fixed your code:

Code: Select all

commandArray = {}

DomDevice = 'Hyperion Arc en Ciel' --name device
IP = '192.168.0.245' -- ip address hyperion
Port = '19444'


if devicechanged[DomDevice] then
	if(devicechanged[DomDevice]=='Off') then
		print('Turn '..DomDevice..' off...')
		runcommand = "echo  '{ \"command\": \"clear\", \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
		print (runcommand);
		os.execute(runcommand);
		-- skip this, its not needed -- return commandArray;
	elseif(devicechanged[DomDevice]=='On') then
		print('Arc En ciel Rapide !')
		runcommand = "echo  '{ \"command\": \"effect\", \"effect\": {\"name\": \"Rainbow swirl fast\" }, \"priority\": 10 }' | nc " .. (IP) .. " " .. (Port) .. " ";
		os.execute(runcommand);
	end
end

return commandArray
Also use the same priority everywhere ;)
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

Thanks for this what mean "nc" ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
iMars
Posts: 8
Joined: Tuesday 17 November 2015 21:51
Target OS: Linux
Domoticz version: Latest
Contact:

Re: [689] Hyperion integration

Post by iMars »

deennoo wrote:Thanks for this what mean "nc" ?
Google is your friend ;)

The "|" sign pipes the output (the echo '...') to the nc command, which is used to talk to the ip of hyperion
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

Small improvement for those who run Domoticz on a Syno and want to use netcat command.

It appear that Netcat on a Syno stay ON and don't kill connection this give an error on Domoticz Log because LUA script run more than 10 secondes, and Domoticz freeze during this time.

You just have to had -c value to your netcat command, this give :

Code: Select all

runcommand = "echo  '{ \"command\": \"effect\", \"effect\": {\"name\": \"Rainbow swirl fast\" }, \"priority\": 10 }' | nc -c " .. (IP) .. " " .. (Port) .. " ";
No more error anymore
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
elgringo
Posts: 92
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

Re: [689] Hyperion integration

Post by elgringo »

I don't know if anybody is intereseted, but i made a python plugin (for the beta version):
https://github.com/ericstaal/domoticz/t ... n/hyperion

Allows you to control rgb values and select mode
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [689] Hyperion integration

Post by deennoo »

will test it this night ! thx !

Some question about it : did you parse effect from hyperion or did your already write on plugin usual effect ?

how to install it ? just paste the plugin.py file ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest