Sending ASCII Messages to Web-Connected Devices

I posted a similar query at the end of a thread I've been following, but I think this may be more appropriate in the Rule Machine category.

Anyway... I am considering a major "smart-lighting" upgrade to my home, and it includes a controller that can accept ASCII text commands via tcp/ip. Is the rule machine capable of generating these messages that would be transmitted over my local network? If yes, how would I go about learning how to accomplish this?

Primarily, I would want this to allow a sensor monitored by the HE hub to then trigger a change in lighting status. It can be done within the smart-lighting system I am looking at, but would require a rather expensive, hard-wired motion sensor, and the wireless sensors that work with HE are much cheaper and work rather well.

You want to write a driver for the tcp/ip (telnet) commands.

The driver converts higher level commands: On, Off, Dim... to the codes needed by each device type. Then RuleMachine simply tells the device to turn On and the driver does the busy work.

Here's a possibly useful example:

1 Like

Thanks for the info...

Looks like I need to study up on how to code a simple driver. :roll_eyes:

The very first Iā€™d do is try using a Telnet Client program like PuTTY to try to connect to the device in question using the Telnet protocol. You can then simply type in ASCII text to see of the device responds correctly or not. If you cannot get this working, then you may need to use a different method other than Telnet in the driver to communicate with the device.

Do you have a link to the device in question? A manual that explains the communications protocol would help immensely is the communityā€™s ability to provide proper guidance.

Sounds like a ā€˜funā€™ project!

1 Like

The system I'm looking at right now is the "Touch-Plate" Lighting Control, specifically their "Time-Keeper" module, which will accept system commands via an RS232 port, via TCP/IP through their own web interface, or what they call a "standard" Serial-to-Ethernet device server.

The following is an example of a dimmer control command that would be sent to the system (from their ASCII Command Protocol Manual):

Ascii Commands: Set Output Command (cont.)
Send the Following Command:
<SET OUTPUT OUT LV RATE />
Example:
Relay 2 ON = <SET OUTPUT 04A 64 0000 />
Dimmer 1 ON 75% = <SET OUTPUT 001 4B 0000 />
Dimmer 2 Dim To 100% over 10 Seconds(RATE) = <SET OUTPUT 002 64 000A />
- OR-
<SET OUTPUT OUT LV RATE BLKT OFFT 0000 BDLY />
Dimmer 1 ON 57% Auto-Off (OFFT) af ter 30 seconds =
<SET OUTPUT 001 39 0000 0000 001E 0000 0000 />
Receive the following:
<LENGTH ERROR /> (Command string too long or short)
<SPACE ERROR /> (Command missing a space between parameters)
<INVALID HEX DATA /> (One of the Hex values arenā€™t within acceptable range)
Or None if message OK

Is this a local web interface? or a cloud web interface? If local, using a 'web-style' interface may be simpler than sending straight ASCII commands. Most modern devices utilize what is know as a RESTful interface, where one device can communicate with another using http commands. This is how most Hubitat Ethernet interfaces/drivers are written.

This sounds like a 'terminal server' device, which converts an RS232 port into an interactive Telnet Session. This may be fairly simple to support using Hubitat's Telnet integration. It still requires a custom driver, but at least the communications interface exists.

3 Likes

Yes, the web interface is "local", as I understand it, and that's one of the reasons I'm giving it very serious consideration.

I'm rather a long way from undertaking this project, as it isn't trivially inexpensive, and will result in at least a few days of no lighting in the house while the re-wiring is done, and the system is brought back on-line for basic functioning. That being said, I do plan to move forward on this, and the Touch-Plate system is easily less costly than going with something like Control-4 or Crestron.

1 Like