[PLUGIN] SUS (SysLog UDP Sender)

Moderator: Telldus

Post Reply
kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

[PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

I've got what I believe might be a fully functional syslog client for Telldus but I don't know how to test it.
I've formated the entire thing in the same way as the Pushover plugin and ziped the entire thing.
When I upload the plugin to my Tellstick it just keep loading and I get no hint of what's wrong.

In the zip file provided in the link below you'll also find a lua script that you need to add to get the plugin to work.
http://kamsvag.com/SUS.zip

Anyone who knows where I'm failing?

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

and the Lua scripts seem to disappear for a while after I've tried to upload my package "manual upload"...

I would guess the Tellstick is occupied unzipping the package or something but knowing there is linux under the hood I guess it might prefer a tar ball or something. :/

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

No One who knows how the plugin should be packed for uploading?

I wanna wrap this plugin up so I can move on to the next challange and write a plugin to control IKEA Trådfri from within the Telldus Interface.

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

Ok, so I've got a little bit further now.

When I try to build my plugin i get the following response.

Code: Select all

ubuntu@ubuntu-Latitude-E6320:~/tellstick-server-master$ ./tellstick.sh build-plugin ./SUS
Building plugin /home/ubuntu/tellstick-server-master/SUS
zip_safe flag not set; analyzing archive contents...
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    extras_require = dict(cREQ = 'Base>=0.1\nTelldus>=0.1'),
  File "/usr/lib/python2.7/distutils/core.py", line 166, in setup
    raise SystemExit, "error: " + str(msg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 356-357: ordinal not in range(128)
running telldus_plugin running bdist_egg running egg_info writing requirements to SUS.egg-info/requires.txt writing SUS.egg-info/PKG-INFO writing top-level names to SUS.egg-info/top_level.txt writing dependency_links to SUS.egg-info/dependency_links.txt writing entry points to SUS.egg-info/entry_points.txt reading manifest file 'SUS.egg-info/SOURCES.txt' writing manifest file 'SUS.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/SUS copying build/lib.linux-x86_64-2.7/SUS/__init__.py -> build/bdist.linux-x86_64/egg/SUS copying build/lib.linux-x86_64-2.7/SUS/Client.py -> build/bdist.linux-x86_64/egg/SUS byte-compiling build/bdist.linux-x86_64/egg/SUS/__init__.py to __init__.pyc byte-compiling build/bdist.linux-x86_64/egg/SUS/Client.py to Client.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying SUS.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying SUS.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying SUS.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying SUS.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying SUS.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying SUS.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO Removing .py files from temporary directory creating '/home/ubuntu/tellstick-server-master/SUS/package/SUS-1.0-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Could not build plugin
ubuntu@ubuntu-Latitude-E6320:~/tellstick-server-master$ 
Here's a link to a folder on google Drive where the code is.
https://drive.google.com/open?id=0B1Fae ... DFqUHhqSUE

The 'SUS - LUA all devices.lua' is a complimentary LUA-script that utilize the SUS-plugin to send devicestatus updates.

This plugin is untested and so is the LUA-script. I haven't figured out how to deploy the plugin yet for testing.

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

The plugin is now compiled and I realy do thank the support staff at Telldus for all the excellent support they have provided setting up my development environment.
After my public GPG key has been deployed I'll be beta testing the plugin for a couple of days.

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

Ok, so there's a delay. I lost access to the local API and the device shows as offline on telldus Live, however I can ping the device and it responds to SSH.

I hope to get this resolved on tuesday as monday is a holliday. Telldus support has been nothing but excellent as they've helped me setup my computer for developing plugins for the Tellstick.

Cheers!

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

My event sender plugin for the Tellstick finaly works in Beta version.
Right now it's compiled with static IP address and Port number for the listener but once it's out of beta it will have configurable peer IP and Port number.

:)

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

Configuration now works as well. I'll look into if Telldus wants to put the plugin available for anyone to use now that it works in every aspect as it was intended.

kamsvag
Posts: 63
Joined: Thu Jan 18, 2018 11:08 am

Re: [PLUGIN] SUS (SysLog UDP Sender)

Post by kamsvag » Thu Jan 18, 2018 11:08 am

The plugin has now been submit to Telldus for them to make public.

Below is a LUA script that on device status change sends a message to the plugin. The message contains the name and status of the device.
I can't take full credit for the script since I'm not strong at LUA. I found a script earlier which I've modified to my needs.

Code: Select all

function onInit()
	local sus = require 'sus.Client'
	if sus == nil then
		print("Initcheck: SUS plugin is not installed")
		return
	else
		print("Initcheck: SUS plugin is loaded")
		sus:send{msg='Telldus LUA SUS is loaded'}
	end
	return
end

function onDeviceStateChanged(device, state, stateValue)
	local sus = require 'sus.Client'
	if state == 1 then
		status = "ON"
	elseif state == 2 then
		status = "OFF"
	end
	report = device:name() .. " " .. status
	print("Report: " .. report)
	local ret = sus:send{msg="SUS " .. report}
end

Post Reply