Page 3 of 4

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 12 September 2016 9:37
by Rivvern
Will do!

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 12 September 2016 12:26
by Rivvern
It worked, as soon as i set the permissions to correctly. Thanks! (Check marked the Execute/Enter on the scripts).

But creating two scripts for each switch is pretty tedious.
Id rather use the script below. Anyone had any luck getting it to work?
Brighthead wrote:In the below script I've taken a slightly different path than in the scripts above: Instead of using the device id I use the device name. This means that the script does not need to be changed whenever I add or remove a device from Domoticz. Obviously tellstick.conf needs to be changed so that the devices have the exact same name in tellstick.conf and Domoticz.

I've also implemented basic DIM functionality in addition to just ON and OFF. This setup works perfectly for me. I'm running Domoticz and tdtool on a Raspberry B (256MB) with a USB-connected Tellstick (original).
Please let me know of any improvements you can see.

Note that the script requires BASH rather than SH as some builtin functionality is used.

Code: Select all

#!/bin/bash

startup_path=$1
hardware_id=$2
device_id=$3
status=$4
status2=$5
devname=$6
LOGFILE=<filename of logfile or /dev/null>

echo "startup_path=${startup_path}, hardware_id=${hardware_id}, device_id=${device_id}, status=${status}, status2=${status2}, devname=${devname}" >>$LOGFILE

# This part of the script interfaces with a Tellstick device via tdtool
#
# Requirements: A working Tellstick installation with tdtool and configured tellstick.conf
#               All controlled devices needs to be defined with exactly the same name in tellstick.conf and Domoticz.
#               The device type in Domoticz can be anything. I use X10 as I am not using that for anything else.
#               To identify Tellstick devices a Dummy virtual device needs to be defined in Domoticz. I named it "Tellstick" and Domoticz
#               assigned it hardware_id "2" which is what the logic below uses to determine if it is a Tellstick device

# Tellstick Hardware has hardware_id=2
if [ "${hardware_id}" = "2" ] ; then

# tdtool commands are always lowercase whereas Domoticz uses mixed case for status. tdcmd is either "on" or "off" after this
  tdcmd=${status2,,}

# if command is to dim device we need to find dimlevel and set that
# Domoticz uses the status "Set Level: [n] %" where n is the dimlevel to use
  tmp="${tdcmd%:*}"
  if [ "$tmp" = "set level" ] ; then
# Get percentage which is found between : and %
    tmp="${tdcmd#*:}"
    dimlevel="${tmp//%/}"
# Tellstick dim level are 0-255 so we need to convert percentage
    dimlevel=$((dimlevel*255/100))
# Set tdtool command to use
    tdcmd="dim"
  fi

# Execute Tellstick command
# We need both command and devname set to execute tdtool
  if [ "${tdcmd}" != "" ] && [ "${tdcmd}" != "" ] ; then
    if [ "${tdcmd}" = "dim" ] ; then
      echo "Setting dim level for" $devname "to" $dimlevel >>$LOGFILE
      tdtool --dimlevel $dimlevel --dim "$devname" >>$LOGFILE
    else
      echo "Changing" "$devname" "to" $tdcmd >>$LOGFILE
      tdtool --$tdcmd "$devname" >>$LOGFILE
    fi
  fi

fi
# End of Tellstick section

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 12 September 2016 12:57
by Flopp
Rivvern wrote:It worked, as soon as i set the permissions to correctly.
Please tell me what you had to do with permission so I can add it to the Guide.

"sudo chmod 777 script.sh" ?
Rivvern wrote:Check marked the Execute/Enter on the scripts.
Please explain

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 12 September 2016 13:13
by Rivvern
Well. I didnt use putty to change the permission so i dont know the syntax.
I was browsing the file structure with WinSCP when i right clicked my scripts noticing the lack of permissions.

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 12 September 2016 13:14
by Flopp
Thanks

Re: Is there interest for Tellstick (Duo) support?

Posted: Sunday 18 September 2016 10:05
by Flopp
Updated 1. with correct link
viewtopic.php?f=17&t=7807&p=95905#p95905

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 13:32
by bjacobse
I am trying to get Tellstick working in Domoticz. And I am unsure which path to follow.
Tellstick is working via command line, amd I have added the tellstick in Hardware - no devices will show up in Devices.
I try to manually add in the switch upper left corner, Manual Light/Switch. I am not able to have the test to switch on my Lamp/switch
tellstick_CMD_ on.png
tellstick_CMD_ on.png (8.33 KiB) Viewed 3470 times
I can se that my lamp is switched on, CMD is working
tell_conf.png
tell_conf.png (15.88 KiB) Viewed 3470 times
hw.png
hw.png (114.61 KiB) Viewed 3470 times

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 13:37
by bjacobse
And then I will add this lamp manually in Domoticz - but I am not able to switch the lamp on?
IS this approach wrong? and I should go and use the "old" way with dummy switches hat are executing shell scripts?
manual_switch.png
manual_switch.png (28.27 KiB) Viewed 3470 times
my system is RPI3
uname -a
Linux bjadomoticz 4.4.26-v7+ #915 SMP Thu Oct 20 17:08:44 BST 2016 armv7l GNU/Linux

Domoticz ver 3.5837 updated a few days ago with /domoticz/updaterelease script
(I have not tried Tellstick with older Domoticz variants)

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 15:45
by Flopp
bjacobse wrote:And then I will add this lamp manually in Domoticz - but I am not able to switch the lamp on?
IS this approach wrong? and I should go and use the "old" way with dummy switches hat are executing shell scripts?
manual_switch.png
my system is RPI3
uname -a
Linux bjadomoticz 4.4.26-v7+ #915 SMP Thu Oct 20 17:08:44 BST 2016 armv7l GNU/Linux

Domoticz ver 3.5837 updated a few days ago with /domoticz/updaterelease script
(I have not tried Tellstick with older Domoticz variants)
See my post above(number 36), my guide should be ok if not please tell me and I will change any faults.
Yes, use old way with dummy and script

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 18:28
by bjacobse
Ok,
Then I will make an update guide

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 18:41
by bjacobse
Create a dummy device: Setup->Hardware
hw_dummy_device.png
hw_dummy_device.png (150.18 KiB) Viewed 3450 times
Create a dummy device: Click on "Create virtual Sensors" and add a device name that makes sense for you. Mine is a Kitchen Pouls Henningsen 43cm lamp
dummy_sw.png
dummy_sw.png (14.2 KiB) Viewed 3450 times
goto your "Switch" tab that contains all your switches, and search in the bottom at the page
Click "Edit" and add your stuff like I did (My device id is 5 in etc/tellstick.conf)
edit_dummy_sw.png
edit_dummy_sw.png (118.56 KiB) Viewed 3450 times
You shall use the device id that you have in your /etc/tellstick.conf

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 18:46
by bjacobse
place this script here: /domoticz/scripts

Code: Select all

 touch tellstick_script
chmod a+x tellstick_script

to create and make it executeable

My script:

Code: Select all

#!/bin/bash
# Domoticz Script to execute tellstick commands via dummy device
# Created 2016,by Brian Jacobsen, [email protected]
# execute command like below, action is "on" or "off" device id is from etc/tellstick.conf
# tellstick_script action  device id
# example:
# tellstick_script off 5
# tellstick_script on 2

tdtool  --$1 $2

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 04 November 2016 18:48
by bjacobse
Then the script is used for all your Tellstick dummy devices, add a device switch for each device id that you have in your /etc/tellstick.conf (read: replace "5" with maybe "2" or "3" )

Re: Is there interest for Tellstick (Duo) support?

Posted: Sunday 04 December 2016 22:11
by Lillios
Where should the script be placed.
You have two scripts, one "to make it executeable"?

For me it is not working.
If i use Putty i can send command tdtool -n 1 or tdtool --on 1 and it is working.
But cant get it working in Domoticz.

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 05 December 2016 11:57
by Melotron
Can you add Telldus live support this way, or do I need to have a usb stick ?

Regards Magnus Svensson

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 03 February 2017 12:38
by bjacobse
Lillios wrote:Where should the script be placed.
You have two scripts, one "to make it executeable"?

For me it is not working.
If i use Putty i can send command tdtool -n 1 or tdtool --on 1 and it is working.
But cant get it working in Domoticz.
I have only 1 script and it's placed in your home folder/pi and then : /domoticz/scripts

Re: Is there interest for Tellstick (Duo) support?

Posted: Friday 03 February 2017 12:39
by bjacobse
Melotron wrote:Can you add Telldus live support this way, or do I need to have a usb stick ?

Regards Magnus Svensson
Sorry I'm not able to support/add Telldus live

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 06 February 2017 21:08
by Uffe
Is the only way to get Tellstick DUO support to use this Dummy hardware and Virtual Devices?

I use an RPI2
I downloaded the latest version of Domoticz
Downloaded and compiled Telldus Core. Telldus core works and I can turn on and off lamps using tdtool
I can also receive my sensors

When I start Domoticz and select add HW I can see Tellstick as an option, but when added I can see no devices. Shouldn't this list be populated from tellsick.conf?

If I have to use virtual devices how do I recieve my sensor signals?

I've been running HA for a long time and is already automating alot, but this is my first attempt with Domoticz.
I'm planning on adding z-wave support on my RPI, but I wanted to make sure I can use my old Tellstick DUO as well since I have over 20 devices connected.

Thanks for all help I can get.

/Uffe

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 06 February 2017 22:02
by PeGe
I don't know if it helps you at all, but I recently posted the following:

http://www.domoticz.com/forum/viewtopic ... 06#p118006

It might be somewhat useful, when/if you want to grab and replicate the sensor values from your Tellstick Duo.

/P-G

Re: Is there interest for Tellstick (Duo) support?

Posted: Monday 06 February 2017 22:23
by Uffe
Thanks, but not really what I was after. My main concern is if it's possible to use the Tellstick without using Dummy hardware and virtual devices