LinuxMCE Forums

General => Users => Topic started by: Armor Gnome on August 15, 2012, 03:48:18 am

Title: New Template [IR Controlled Electronic Fireplace]
Post by: Armor Gnome on August 15, 2012, 03:48:18 am
I have recently acquired a usb-uirt to do this template the right way, it will arrive in the next few days so I am getting started on the template now.  If anyone has a similar device, please let me know about any additional commands I need to add to incorporate special features.  This will be very very basic IR to device template with no device feedback, in similar fashion to a generic VCR with less commands and without the media screens. 

GHP EF26 26" ELEC FP
IR Controlled Electronic Fireplace
Operational as lighting only, heater only, or light and heat
IR controlled (will get pronto codes from usb-uirt)
-Template would also work for EF22, EF26FG, EF33 & EF36

Current IR functions and limitations: (from original remote)

Lighting Function (flickering flames)
Lighting On (no saved state, it turns on at 10% brightness)
Lighting + (increase current brightness by 10%)
Lighting - (decrease current brightness by 10%)
  -issues1:  I would love to write this into controlled by lighting plug-in so that the lighting effect can respond to events as any other dimmer light.  The dim can not be sent as 60% though, it has
   to be sent as 5 separate "+" commands with no state memory.  As response to an event calling for 50% it could execute (on, +, +, +, +) buttons on the orbiter {+} and {-} would also work but
   the specific percentages without state information would be difficult if not impossible at this time to make functional.
  -issues2:  The command for On is the same as Off. This is definitely going to be problematic and possibly require me to create a current state memory for the device.  Otherwise an ALL_OFF to
   lights would turn this on.   


*Edit.  After controlling this more and reviewing the manual, The various lighting {+} and {-} buttons are not adjusting brightness levels, they adjust the flame effect speed.  So to simplify the template I will add control for "fire effect on/off" and will leave the speed setting for individual adjustment via OEM remote. 

Heater Function - Electric space heater
Heater On (no saved state, turns on at 10% output)
Heat + (increase current heat output by 10%)
Heat - (increase current heat output by 10%)
  -issues1: Unattended space-heaters cause a huge percentage of house fires, I am uncertain still to even write this template..
  -issues2: Pulling this into the climate plug-in could add comfort control in the immediate area.  It would be user input only however and would function similar to a thermostat with + or - control.
  -issues3: Once again the On/Off is a toggle and LMCE would not have state memory unless devised and placed into the template as a field.  A poorly written lighting command that incorrectly
   toggles a light on results in a bulb or string of bulbs wasting electricity, an unwanted or unexpected space-heater turning on has much more costly possibilities.

*Edit.  I was incorrect about saved state on this.  The device does remember the last heat setting.  There is also an integrated thermostat that switches off at different internal temperatures dependent on the users defined output setting.  This is a common feature of most electronic space-heaters.

Incandescent Light - a brighter output light from the inside ceiling of the fireplace "box"
Light On
  -issues1: Use of this light requires that the flickering flame function be On already, sending this command does nothing if not preceded by Light on (above)
  -issues2: Turning off the flickering flame lighting also turns off this light.

So as you can see by this outline of features I have some challenges and things to consider before continuing.  I would love to tie in the lighting so that a playing media event could turn off room lights (via z-wave) and also toggle the fireplace light effects via IR.  I would be not as happy to get an inbox message from someone whose house burned down because I tried to automate their space-heater...

Input welcome.
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: tschak909 on August 15, 2012, 05:10:49 am
Right now, I am not sure that the Lighting Plugin can properly handle devices controlled via IR. We'll have to see.

-Thom
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: Armor Gnome on August 21, 2012, 09:20:30 pm
I spent a little time on this yesterday between other projects.  I tried lots of different template ideas to use the lighting plugin to control via IR.  I thought I had it a few times but after I stopped for the night I realized the big mistake I was making.

I was doing my testing with the usbuirt here in the office with the oem remote, and the fireplace out in the living room.  My (very wrong) assumption was that the red light would flash on the usbuirt indicating IR command sent.  I didn't see a flash so I tried something else.  Yeah I know that's pretty dumb, why would anyone want a flashing red light accompanying an IR signal?  Not sure what I was thinking.

I do have a question on IR devices though.  The wiki instructions on setting up USB UIRT are instructions on adding a remote.  To build this correctly should I build two templates?  One for the device that is activated by IR and another that is the remote which is a child device of the USB UIRT?  When I did build this as two devices (a light and a remote) it produced two devices under the lighting scenes on my orbiters.

There are a lot of IR controlled little lights available, I am trying to plan ahead on the template and make it as generic as possible so that other users with a USB UIRT can add "generic IR accent light (USBUIRT) and only have to input their codes to get basic on/off.
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: tschak909 on August 21, 2012, 09:22:16 pm
the UIRT _does_ flash its LED indicator when sending IR pulses.

-Thom
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: Armor Gnome on August 21, 2012, 09:26:15 pm
the UIRT _does_ flash its LED indicator when sending IR pulses.

-Thom

Okay cool, that helps when trying to build this.  I can test at my desk until I get a LED blast, and then verify the correct command was sent by testing at the unit.  The log errors I am seeing are pretty descriptive and it doesn't seem like I am that far off.  If I get to the point I see no errors and still don't have it working I will assume I am close and might need some small help getting it operational from there.
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: tschak909 on August 21, 2012, 09:47:38 pm
Can you please detail your current approach?

-Thom
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: Armor Gnome on August 21, 2012, 10:23:46 pm
Certainly.

Though I am slowly adding my working devices back to LMCE now that I am on beta as well as working on other projects and schoolwork, so I might not be able to devote time to this until later this week.  Because I am still very new to template creation I normally jack up a few command groups and templates in the process of getting something working, then restore (hdd) to a state prior to my changes and then create a new template cleanly.  I could simplify this learning process by using web-admin backup or using diff. in sqlCVS but haven't went that route yet.

I will modify my first post in this thread with my creation attempts/process and bump this thread for you to check out.
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: Armor Gnome on August 26, 2012, 11:38:32 pm
I got around to spending some time on this today.  Here is an overview of what I attempted this time and my result.


Typing this mostly from memory so if you need specifics I will get back with you.

Compared the templates for Z-Wave Light and Generic AV equipment controlled with IR.  Using these two types of device templates I created a new template.

Generic IR Light (USBUIRT)
controlled via category:
  Generic IO
  Lighting
  Infrared
  Specialized
  Other

Comm Method:
  Infrared

I then had to add a custom command group:
 IR LIGHTING
  192: Turn IR Light On:  power  430A014555F0 430A014555F0    : note here the wiki uses 2 spaces after power
  193: Turn IR Light Off:  power  430A014555F0 430A014555F0    : question, should I list two codes when they are the same?
  - with the device data listing all codes, could I change these to "Turn IR Light On: power" ?
   *These were renamed?  When I went back to commands to edit them they were 1117 and 1118?

Device Data:
 PK_FloorplanObjectType: allowed to modify, use master device list
 Capabilities:  (copied from Z-Wave light, not sure what they were)
 - I believe I missed a String ... something IR here to iput the code list?
   * Configuration(string) : power  430A014555F0 430A014555F0
   * Remote Layout : W    - no idea why I did this but it was in the wiki for adding support for new remote

Things that went well: and I hope let me know I am getting close.  No screaming errors from any of the plugins or DCERouter after reload router.  After creating the template I then selected "add a new top level device" and Generic IR Light was automatically made a child of the USBUIRT 0038.  On UI2, the light was added to the floorplan area and I was given the options of On or Off.

Things that need work:  The light didn't turn on from orbiter floorplan command.  I went to USBUIRT 0038 and checked for errors in the log, nothing!  I then selected show full log and that is where I found the problem.  
  "Can not get IR code for command 193"
  "Ignoring command 193, it is useless"
  "Can not get IR code for command 193"
  "Ignoring command 193, it is useless"


At this point I am now focusing in on one thing.  Regardless of what the device is called I need to know how to pin a IR code to a command.  I can then test this in the web-admin by selecting send command to device.  Once the code works and I know how to throw the code then I can tie that command to the IR controlled light and have access to it under lighting.

I hope this is on the correct track.  At this point it would appear that my input makes it to the correct device to send the signal.  I assume that once I have the orbiter controls (via lighting menu) knowing that the USBUIRT is the proper channel to get a signal out and the USBUIRT knows to throw code X when command X is received then the basic part of my template is correct.  I can worry about adding a possible saved state and other functions later.  Interestingly while looking through existing commands I found color under lighting.  I may get into this and add my flame effect controls through IR as well.  Other users wishing to control color changing string lights or similar could use the field to input their effect codes.

**Edit, The wall I am finding now and this may be the difficult part of getting Lighting and Infrared playing nice is I can't seem to edit "Command 192" that the lighting plugin sends to the USBUIRT.  My new created command is #11xx and points to the configuration(string).  Perhaps the editing I need to do doesn't lie with the Lighting Plugin or the new device, but instead in the command groups for USBUIRT.  This is a much broader template change that adding a new device and has the potential to break a lot of setups. 

Potential additions to USBUIRT 0038 would be "if command X is received from device Y, execute IR Remote Control command from device Z's device data" - stating that logically is obviously different than knowing how to state it in device data or writing a small executable...  Let me see what I can break.
Title: Re: New Template [IR Controlled Electronic Fireplace]
Post by: Armor Gnome on August 27, 2012, 12:49:18 am
Code: [Select]
05 08/26/12 18:41:27.642 Infrared Code not found for Command 192. Will not be processed by IRBase. <0xb58f9b70>
05 08/26/12 18:41:27.642 #### Pre-Process Queue = 1 <0xb58f9b70>
05 08/26/12 18:41:27.660 _QueueProc Pre - 192 : 0 <0xb4ef8b70>
05 08/26/12 18:41:27.660 GSD-Sleep Pre 192 : 0 <0xb4ef8b70>
05 08/26/12 18:41:27.660 Could not find Infrared Code for Command 192. <0xb4ef8b70>
05 08/26/12 18:41:27.660 GSD-Sleep Post 192 : 0 <0xb4ef8b70>
05 08/26/12 18:41:27.660 _QueueProc Post - 192 : 0 <0xb4ef8b70>

I didn't make changes to USBUIRT 0038 yet, but I found where I could add command group Light On/Off to my fireplace template.  When I went to edit those new commands I found 192 and 193.  I still think that USBUIRT 0038 still needs some instruction with what to do with that command.  Adding that command group properly to the device was trivial I would guess unless a GSD IR light was ever applied to this template where it would be responsible for understanding commands.  Fortunately for me this is a child device that only needs to understand it's own IR code.