cancel
Showing results for 
Search instead for 
Did you mean: 
NicolasArgente
Contributor II

Hi there!

If you are reading this post it probably means that you are a coffee addict. Or a OneStream addict. Or both!


Before starting the explanation on how to make coffee with OneStream, I would like to say I had the idea of making this while reading the OneStream Foundation Handbook – I recommend this book, it is fun to read and they are lots of good stuff in it! For example, page 21 where Greg Bankston (@GregB) said “I have joked on numerous occasions that OneStream can probably even automate a customer’s coffee maker for them if they can find one that accepts the right commands. While it is indeed a joke, it is not too far from the truth either.

NicolasArgente_0-1642266111808.jpeg

To make coffee with OneStream you will need to

  1. Buy a Philips hue system and connect your coffee machine to it.
  2. Connect the api of the Philips Hue to OS
  3. Create a powershell script
  4. Open some firewall ports
  5. Create a DM job that links the dashboard with the BR
  6. Create a BR that launches a script
  7. Create a dashboard – just because life is nicer with a dashboard!

For the 2 first steps, after buying your Philips Hue System you should read this blog : https://developers.meethue.com/develop/get-started-2/#turning-a-light-on-and-off
The idea here is to generate a remote username.

Now you should test the api connection using a powershell script like the one below. When it is working then you should save this script on your OneStream server. You can notice that the power plug connected to the Philips Hue is seen as a light as it has only an On/Off state.

# Hue Bridge
$hueBridge = "http://192.168.109.10:80/api"
# Username
$username = '4HNMsqH9n5NwMH9n5NFVLY9n5NzZrml-45e'
# Command to Turn on
$apicontent= '{"on":true}'
# Command to Turn off – activate it on another script
# $apicontent= '{"on":false}'
# Invoke commands
Invoke-WebRequest -Method put -Uri "$($hueBridge)/$($username)/lights/21/state" -Body $apicontent

As the script is sitting on your server, I would recommend that you run it with powershell directly on the server. It is a good way to test and check that all firewall ports are open.

Once you have the powershell script running it should already turn on your coffee from the server. Do not forget to add the script to turn it off too.

 

Now you need to go to your OneStream application to create a Extender business rules. It should call for the powershell script on your server. It will look like this :

Namespace OneStream.BusinessRule.Extender.PlugOn
            Public Class MainClass
                        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
                                    Try
'                                               Process.Start("powershell", "-File C:\TurnOnHue")
                                                Shell("powershell -ExecutionPolicy Bypass  ""C:\TurnOnPlug")
                                                Return Nothing
                                    Catch ex As Exception
                                                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
                                    End Try
                        End Function
            End Class
End Namespace



Now you need to create a Data Management job that will kick your Extender BR.

NicolasArgente_1-1642266111811.png

And last but not least you end up with your Dashboard!

NicolasArgente_2-1642266524084.png

 

NicolasArgente_3-1642266589254.jpeg

NicolasArgente_4-1642266634583.jpeg

 




 

 

 

9 Comments

Now that is creative. I will get rid of Google home and start using DM jobs for lights and TV. That way, my kids will not switch on lights in the middle of the night and switch on the TV.

Let's hope for a decent mobile interface.

NicolasArgente
Contributor II

Next challenge : "OK Google, consolidate entity Houston" 🙂

Maybe that is a Splash presentation :). I planned to report my Smart Home analytics in OneStream using BI Viewer and then dropped the plan. 

Kathryn_Watkins
New Contributor

I always joke it could make julienned fries (from Aladdin ... https://getyarn.io/yarn-clip/484013e5-1195-48e1-ab13-53a565eaea41)   Do you have a solution for that? 😀

ChrisCross
New Contributor

@NicolasArgente wrote:

Hi there!

If you are reading this post it probably means that you are a coffee addict. Or a OneStream addict. Or both!


Before starting the explanation on how to make coffee with OneStream, I would like to say I had the idea of making this while reading the OneStream Foundation Handbook – I recommend this book, it is fun to read and they are lots of good stuff in it! For example, page 21 where Greg Bankston (@GregB) said “I have joked on numerous occasions that OneStream can probably even automate a customer’s coffee maker for them if they can find one that accepts the right commands. While it is indeed a joke, it is not too far from the truth either.

NicolasArgente_0-1642266111808.jpeg

To make coffee with OneStream you will need to

  1. Buy a Philips hue system and connect your coffee machine to it.
  2. Connect the api of the Philips Hue to OS
  3. Create a powershell script
  4. Open some firewall ports
  5. Create a DM job that links the dashboard with the BR
  6. Create a BR that launches a script
  7. Create a dashboard – just because life is nicer with a dashboard!

For the 2 first steps, after buying your Philips Hue System you should read this blog : https://developers.meethue.com/develop/get-started-2/#turning-a-light-on-and-off
The idea here is to generate a remote username.

Now you should test the api connection using a powershell script like the one below. When it is working then you should save this script on your OneStream server. You can notice that the power plug connected to the Philips Hue is seen as a light as it has only an On/Off state.

 

# Hue Bridge
$hueBridge = "http://192.168.109.10:80/api"
# Username
$username = '4HNMsqH9n5NwMH9n5NFVLY9n5NzZrml-45e'
# Command to Turn on
$apicontent= '{"on":true}'
# Command to Turn off – activate it on another script
# $apicontent= '{"on":false}'
# Invoke commands
Invoke-WebRequest -Method put -Uri "$($hueBridge)/$($username)/lights/21/state" -Body $apicontent

 

As the script is sitting on your server, I would recommend that you run it with powershell directly on the server. It is a good way to test and check that all firewall ports are open.

Once you have the powershell script running it should already turn on your coffee from the server. Do not forget to add the script to turn it off too.

 

Now you need to go to your OneStream application to create a Extender business rules. It should call for the powershell script on your server. It will look like this :

 

Namespace OneStream.BusinessRule.Extender.PlugOn
            Public Class MainClass
                        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
                                    Try
'                                               Process.Start("powershell", "-File C:\TurnOnHue")
                                                Shell("powershell -ExecutionPolicy Bypass  ""C:\TurnOnPlug")
                                                Return Nothing
                                    Catch ex As Exception
                                                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
                                    End Try
                        End Function
            End Class
End Namespace

 



Now you need to create a Data Management job that will kick your Extender BR.

NicolasArgente_1-1642266111811.png

And last but not least you end up with your Dashboard!

NicolasArgente_2-1642266524084.png

 

NicolasArgente_3-1642266589254.jpeg

NicolasArgente_4-1642266634583.jpeg

 




Nice one Nic, presume it can also work with a smart plug converter that uses IFTTT. Love your creativity 

 


 

NicolasArgente
Contributor II

Funny..., I did not know about those julienned fries. 😀 Thanks Kathryn 

Vivian_Viljoen
New Contributor

This is awesome 😄 
The possibilities are endless !!

Great job Nic

SteveM
New Contributor

We have a customer that built a voice command UI to kick off consols. it was really just part of a hackathon amonst their developers, but yes this is possible.Great post by the way,

Beverly
New Contributor II

Love it!