Author Topic: How to display messages on MD's  (Read 4818 times)

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
How to display messages on MD's
« on: December 28, 2007, 12:39:11 pm »
During the first initial run of my Insteon plugin, it could take a few minutes to 'spider' the insteon network...
I'd like to inform the user of two things:

1.  Insteon Configuration is processing...
and
2.  Insteon Configuration is finished...

What commands do I send to have these messages displayed on the MD's?

and How do I send the messages to ALL MDs?

Thanks again

Regards,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How to display messages on MD's
« Reply #1 on: December 28, 2007, 12:45:24 pm »
This would be very handy to display Insteon Devices Detected too.. (prior to initiating the wizard)

Once the initial configuration is complete, the configuration of the childs (lights, irrigation controllers, etc) are implemented as devices..
Once their implemented as devices, they have their current configuration saved with that device, and hence, REinitialization is quick..

So after the initial 'spider' initialization, (and associated configuration), further restarts should be less than one minute to complete.

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

kir

  • Guru
  • ****
  • Posts: 183
    • View Profile
Re: How to display messages on MD's
« Reply #2 on: January 15, 2008, 02:23:28 pm »
Just a small pointer: use CMD_Display_Alert command. Sample from Xine_Player:

1651 void Xine_Player::SendMessageToOrbiter(string sMessage)
1652 {
1653     DCE::CMD_Display_Alert cmd(m_dwPK_Device, m_pData->m_dwPK_Device_ControlledVia, sMessage, "xine_player_message", "10", interuptAlways);
1654     SendCommandNoResponse(cmd);
1655     LoggerWrapper::GetInstance()->Write(LV_CRITICAL,"Xine_Player::SendMessageToOrbiter sent message: %s", sMessage.c_str() );
1656 }

Here it sends message from Xine device (m_dwPK_Device) to controlling device - i.e. corresponding Orbiter (m_pData->m_dwPK_Device_ControlledVia). See the  Orbiter.cpp : header of function
void Orbiter::CMD_Display_Alert(string sText,string sTokens,string sTimeout,int iInterruption,string &sCMD_Result,Message *pMessage)
contains info about parameters (or just use webadmin/DCE stuff to read about that command - also you can use webui to send "Display Alert" message to Orbiter from browser).

See also my recent post about TailDCERouter.sh tool - you can use it to see which messages are passing.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How to display messages on MD's
« Reply #3 on: January 15, 2008, 03:33:00 pm »
kir,

Thank you for your reply.  I did figure that out (by trial and error)

Now, I'm trying to figure out how to enumerate a list of the orbiters... through ruby..

Best wishes,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: How to display messages on MD's
« Reply #4 on: January 15, 2008, 06:02:56 pm »
Hi,

I'm also interested about possibility to show overlayed screens on Orbiters, where user can choose between two or more buttons (for instance when some device is autodetected and then you press if you want to use it etc...). I remember reading about it somewhere (each button sends declared DCE message), but don't know where I could find that info...

AFAIK, alerts are those small windows on Orbiters, that show every now and then when LMCE is doing something , right ?

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

niz23

  • Guru
  • ****
  • Posts: 361
    • View Profile
Re: How to display messages on MD's
« Reply #5 on: January 15, 2008, 06:34:45 pm »
bulek.

Hi,

I'm also interested about possibility to show overlayed screens on Orbiters, where user can choose between two or more buttons (for instance when some device is autodetected and then you press if you want to use it etc...). I remember reading about it somewhere (each button sends declared DCE message), but don't know where I could find that info...

AFAIK, alerts are those small windows on Orbiters, that show every now and then when LMCE is doing something , right ?

regards,

Bulek.


Perhaps below command is what you refer to?
Since my 0710 beta2 does not work anymore I havenĀ“t tried it myself.
I wait for beta3 which seem to be available very soon now (see wiki recent changes).

http://wiki.linuxmce.org/index.php/DCE_from_commandline


/usr/pluto/bin/MessageSend localhost 0 64 1 741 10 "Whatever" 159 53 9 'A message|Ok|Remind me later' 137 '-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer yes"|-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer no"'

/niz23

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How to display messages on MD's
« Reply #6 on: January 15, 2008, 06:34:56 pm »
Bulek, I have done that... it's in the wiki somewhere..
Let me find it...
   /usr/pluto/bin/MessageSend localhost 0 64 1 741 10 "Whatever" 159 53 9 'A message|Ok|Remind me later' 137 '-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer yes"|-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer no"'

the wiki is at http://wiki.linuxmce.org/index.php/MessageSend

Of course, you'll need to adjust those values as per your configuration...
I've tested this on my orbiters, and it works well.

Regards,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: How to display messages on MD's
« Reply #7 on: January 15, 2008, 08:58:46 pm »
Bulek, I have done that... it's in the wiki somewhere..
Let me find it...
   /usr/pluto/bin/MessageSend localhost 0 64 1 741 10 "Whatever" 159 53 9 'A message|Ok|Remind me later' 137 '-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer yes"|-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer no"'

the wiki is at http://wiki.linuxmce.org/index.php/MessageSend

Of course, you'll need to adjust those values as per your configuration...
I've tested this on my orbiters, and it works well.

Regards,

Dan


Thanks for info... BTW, any easy way/sql query to get list of all Orbiters - or do we need that list or can we just say display on all ?

Regards,

Bulek.
Thanks in advance,

regards,

Bulek.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How to display messages on MD's
« Reply #8 on: January 15, 2008, 10:33:50 pm »
Bulek,

That's exactly what I want to do, is display on all...

As it stands, I cannot get the parent device ID, therefore, I can't even display on ONE...

ahh, still struggling...

Regards,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: How to display messages on MD's
« Reply #9 on: January 15, 2008, 10:35:18 pm »
I know there are certain virtual device #s, which correspond to things like Local Orbiter, All Orbiter, etc. If you look at DeviceTemplate, you'll see -1000, etc...

-Thom

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How to display messages on MD's
« Reply #10 on: January 15, 2008, 10:50:15 pm »
Thanks Thom!  That is probably what I'm looking for...
What do you mean by 'look at DeviceTemplate' ?

Thanks,

Dan
« Last Edit: January 15, 2008, 11:00:14 pm by ddamron »
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

rwilson131

  • Veteran
  • ***
  • Posts: 118
    • View Profile
Re: How to display messages on MD's
« Reply #11 on: January 16, 2008, 01:51:57 am »
Take a look at http://wiki.linuxmce.org/index.php/DCE_from_commandline

toward the bottom of the page.
Quote
As far as I can tell, the reason for '-1000' is to allow devices to broadcast events to the system as a whole rather than to a specific device, presumably for event-based devices that do not do a specific function. I shall look more into this... -AVJohn.

I put together the MessageSend page, and I have not really ever determined if this is indeed correct, but one can see the use of -1000 and -1001 for device to in MessageSend command through out the code.  It would be nice if we knew which was correct or if both are correct. 

I know this sends a message to every orbiter I have because it is annoying and happened on all my orbiters until I determined how much to tell MythTV to leave open.

Low Disc Space Message ( from DiskSpaceMonitor.sh)  This message is sent when the /home partition is over 95% full to fire event 64.

/usr/pluto/bin/MessageSend $DCERouter 0 -1001 2 64

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: How to display messages on MD's
« Reply #12 on: January 16, 2008, 02:05:16 am »
from src/DCE/Message.h
Code: [Select]
#define DEVICEID_NULL           -1  // Invalid device

// Some system devices
#define DEVICEID_DCEROUTER      -1000   // System commands for the router itself
#define DEVICEID_EVENTMANAGER   -1001   // Not a real device, just the destination of events
#define DEVICEID_LOGGER                 -1002
#define DEVICEID_MESSAGESEND    -1003   // The message send utility

// Virtual devices
#define DEVICEID_MASTERDEVICE   -2000
#define DEVICEID_CATEGORY       -2001
#define DEVICEID_LIST           -2002
#define DEVICEID_GROUP          -2003

// Other
#define DEVICEID_HANDLED_INTERNALLY -300
best regards,
Hari
rock your home - http://www.agocontrol.com home automation

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How to display messages on MD's
« Reply #13 on: January 16, 2008, 04:55:57 am »
Take a look at http://wiki.linuxmce.org/index.php/DCE_from_commandline

toward the bottom of the page.
Quote
As far as I can tell, the reason for '-1000' is to allow devices to broadcast events to the system as a whole rather than to a specific device, presumably for event-based devices that do not do a specific function. I shall look more into this... -AVJohn.

I put together the MessageSend page, and I have not really ever determined if this is indeed correct, but one can see the use of -1000 and -1001 for device to in MessageSend command through out the code.  It would be nice if we knew which was correct or if both are correct. 

I know this sends a message to every orbiter I have because it is annoying and happened on all my orbiters until I determined how much to tell MythTV to leave open.

Low Disc Space Message ( from DiskSpaceMonitor.sh)  This message is sent when the /home partition is over 95% full to fire event 64.

/usr/pluto/bin/MessageSend $DCERouter 0 -1001 2 64


-1000 is hardcoded for DCERouter Commands,
-1001 is hardcoded for DCERouter Events...
Hope that clears the confusion...
I did see your MessageSend page, and have found it quite useful..

Your suggestion with regards to sending an Event 64...

If you follow the DCERouter log, you can watch the event being fired.
After the event is fired, the CORE sends a DISPLAY ALERT command to all Orbiters AT THE SAME TIME..

THAT is what I want to be able to do...
The Display Alert command allows you to send text, and assign a token to the alert...

Regards,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

rwilson131

  • Veteran
  • ***
  • Posts: 118
    • View Profile
Re: How to display messages on MD's
« Reply #14 on: January 16, 2008, 06:58:00 am »
Thanks for the section of source code, I added it to the wiki page.  I wanted to also put a word out for bulek who posted several messages which I tried to consolidate to a single page.

I see you are trying to get the little box in the corner, and not a full page to pop up.

Am I missing something here, why can you not send something like this.

/usr/pluto/bin/MessageSend dcerouter -targetType category -bl 5 1 5 1 809 251 0 9 "TESTING DISPLAY ALERT" 182 15 70 "test"
server= dcerouter
targetType= Category (device category found on template page)
-bl= 5 broadcast level 5 or whole house
Device from= 1 is the core
Device to = 5 (actually device category 5 orbiters)
command 809 with it parameters

I was able to send this to all of my orbiters.  I did not play with the parameters much, but it worked.

I hope this is what you are looking for.
Rob