PHP interface for TellStick, HomeAutomation v2.0.2 released!

Moderator: Telldus

ltpitt
Posts: 18
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by ltpitt »

Here I am again...

1) The script is already there and I'm trying your previous suggestion:

"What you need to do from your python script is to call the following url:

Code: Select all

http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=X&deviceid=Y
where Y is the detected status and X is the ID of the dummy device which you have to add to HA under Configuration \ Devices (just add a new device, use type dummy and name it "Phone" or likewise). This url requires that your script is run on same machine as HA (security issue)."

So if I put in my browser:

Code: Select all

http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=1&deviceid=1
It works perfectly...

If I try to use wget:

Code: Select all

wget -O /dev/null -q http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=1&deviceid=1
It will not work...

So I tried python:

Code: Select all

import urllib2
urllib2.urlopen("http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=1&deviceid=1")
still nothing...

The code ran on the raspberry PI itself, as requested...

What can I try?

2) I am trying to find a similar service to display my home city temperature but I can't seem to find any


3) sure:

Code: Select all

6f 01 4b 46 7f ff 01 10 67 : crc=67 YES
6f 01 4b 46 7f ff 01 10 67 t=22937
:)
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

ltpitt wrote:Here I am again...

1) The script is already there and I'm trying your previous suggestion:

"What you need to do from your python script is to call the following url:

Code: Select all

http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=X&deviceid=Y
where Y is the detected status and X is the ID of the dummy device which you have to add to HA under Configuration \ Devices (just add a new device, use type dummy and name it "Phone" or likewise). This url requires that your script is run on same machine as HA (security issue)."

So if I put in my browser:

Code: Select all

http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=1&deviceid=1
It works perfectly...

If I try to use wget:

Code: Select all

wget -O /dev/null -q http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=1&deviceid=1
It will not work...

So I tried python:

Code: Select all

import urllib2
urllib2.urlopen("http://mypc/automation/ajaxinterface.php?do=toggleStatus&status=1&deviceid=1")
still nothing...

The code ran on the raspberry PI itself, as requested...

What can I try?

2) I am trying to find a similar service to display my home city temperature but I can't seem to find any


3) sure:

Code: Select all

6f 01 4b 46 7f ff 01 10 67 : crc=67 YES
6f 01 4b 46 7f ff 01 10 67 t=22937
:)
1. This should work as long as you are calling ajaxinterface.php locally (given that you have configured local IPs correctly under Settings). If this doesn´t work you need to get a new version of ajaxinterface.php from me that allows passing in login details too.
2. If you can´t find any site that can provide the temperature of your city in the expected format you probably need to make a parser yourself (I can help you out if you want). How you could do this is to create a new file in the HA directory named getexternaltemperature.php This file the does the parsing for you, you the enter the path to this file under Settings instead and you should be good to go.
3. To me this doesn´t seem like correct OWFS output, are you sure this is the path to parse?
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
ltpitt
Posts: 18
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by ltpitt »

1) The strange thing is that if I open a browser from another pc it works without problems. If I use the same url with python or wget directly from Raspberry PI it won't work. If you can provide me the new ajaxinterface.php I'd be glad
2) No bother: I give up on this (it won't be greatly useful for now)
3) _Maybe_ I got the wrong sensor then? What I'm using is a 1-wire dallas sensor like this: http://www.cl.cam.ac.uk/freshers/raspbe ... mperature/
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

ltpitt wrote:1) The strange thing is that if I open a browser from another pc it works without problems. If I use the same url with python or wget directly from Raspberry PI it won't work. If you can provide me the new ajaxinterface.php I'd be glad
2) No bother: I give up on this (it won't be greatly useful for now)
3) _Maybe_ I got the wrong sensor then? What I'm using is a 1-wire dallas sensor like this: http://www.cl.cam.ac.uk/freshers/raspbe ... mperature/
1. Yes that is because neither of python or wget will have a valid session to be able to do the toggling. Send me an email an I will provide you with the file you need.
2. Ok.
3. Oh now I see. You are using a sensor which is known to be used in 1-wire networks. However it is not used in a 1-wire network. I can update the weather parser to support this if you want.
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
polarbearNO
Posts: 11
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by polarbearNO »

I take it that HomeAutomation does not work with the Tellstick NET? Any plans to make a NET version?

Kind regards,
Anders
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

polarbearNO wrote:I take it that HomeAutomation does not work with the Tellstick NET? Any plans to make a NET version?

Kind regards,
Anders
With the coming release of 3.0 there will be a possiblity for users to program their own system plugins more easily than before. This will allow the usage of NET version, however, someone need to create that plugin... :D
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
polarbearNO
Posts: 11
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by polarbearNO »

tom_rosenback wrote:With the coming release of 3.0 there will be a possiblity for users to program their own system plugins more easily than before. This will allow the usage of NET version, however, someone need to create that plugin... :D
That's fairly good news :) When do you expect to release 3.0?
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

polarbearNO wrote:
tom_rosenback wrote:With the coming release of 3.0 there will be a possiblity for users to program their own system plugins more easily than before. This will allow the usage of NET version, however, someone need to create that plugin... :D
That's fairly good news :) When do you expect to release 3.0?
I would love to say soon but I can´t make any promises or give any exact ETAs. Sry.
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
asjmcguire
Posts: 3
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by asjmcguire »

Tom,
Thank you so much for your amazing coding - I'm loving Home Automation.
I was hoping to get a peek at v3 but the SVN link you provided at the beginning seems to be protected now.

Will v3 be using mysqli instead of mysql as mysql has been deprecated?
I'd done some hacking of the code to make it a bit more flexible - both display wise and function wise.

I have written a "synchroniser" script that will (every 5 minutes) periodically query tdtool to check that Home Automation and Telldus are in sync (this copes with devices being controlled from different sources - like Telldus Live).

(and as you can see in the screenshot - I made it talk to my multicast notification system that notifies about heating, earthquakes, weather reports etc)

Thanks again - and please let me know if I can be of any help with the next version :D

Andy

(PS - yes a donation will be forthcoming when I have the cash)
Attachments
Screenshot
Screenshot
homeauto.jpg (192.9 KiB) Viewed 17039 times
tbrg78
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tbrg78 »

I'm new here, hello everybody!.. o)

I'm glad I found the english version of the "HomeAutomation" thread.
I first messed with google translator to get some understanding of the swedisch version, but somewhat hard times I had.. o)

I have a small question, maybe somebody is able to help out. I'd like to know how exactly the scheduling part works on a windows machine (2003 + IIS6).
I setup HA and got it working to some point, but wonder where the scheduled tasks end up I entered. There must be something like a process/thread etc. running in the background, to run the tasks at given times. In the windows task-scheduler, there's nothing to be seen which might came from HA, just some entries from Telldus Center Scheduler.

Thanks!.. o)
tb
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

tbrg78 wrote:I'm new here, hello everybody!.. o)

I'm glad I found the english version of the "HomeAutomation" thread.
I first messed with google translator to get some understanding of the swedisch version, but somewhat hard times I had.. o)

I have a small question, maybe somebody is able to help out. I'd like to know how exactly the scheduling part works on a windows machine (2003 + IIS6).
I setup HA and got it working to some point, but wonder where the scheduled tasks end up I entered. There must be something like a process/thread etc. running in the background, to run the tasks at given times. In the windows task-scheduler, there's nothing to be seen which might came from HA, just some entries from Telldus Center Scheduler.

Thanks!.. o)
tb
Hi and Welcome,

HA uses scheduled tasks to put up the events for the schedules, to make this work your computer needs to have a password set and then you need to enter this password and username into the HA settings. Please check this and come back with the results.
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
tbrg78
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tbrg78 »

Thanks Tom!.. o)
I just checked my settings and there is my admin-username and password already set, so this might be some different permission problem or something.
But now that I know how this should work, I have a much better chance to look into it.

ps: I did not receive a notification about your reply, that's way I did not come back here earlier.
(I just saw, there is a checkbox to enable below the posting textarea.. doh!.. o)
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

tbrg78 wrote:Thanks Tom!.. o)
I just checked my settings and there is my admin-username and password already set, so this might be some different permission problem or something.
But now that I know how this should work, I have a much better chance to look into it.

ps: I did not receive a notification about your reply, that's way I did not come back here earlier.
(I just saw, there is a checkbox to enable below the posting textarea.. doh!.. o)
Great, note that you need to have COMPUTERNAME\USERNAME.
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
tbrg78
Posts: 4
Joined: Fri Mar 17, 2023 9:45 am

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tbrg78 »

Mhh, so I double checked the username and password and added the "computername\.." like its written, if you add/edit tasks in the win-scheduler itself, but..
There is no new scheduled task created, whenever I use HA. The task is listed in HA, but it does not show up in the scheduled tasks list.

I guess you make use of some windows commandline tool from the php-side ?! Using exec() or system() or something ?! I seeked through the scripts to find a place to add some debugging information, but searching for exec/system did not bring up any hits.. and so - I'm stuck again o) Do you have any ideas, are there any more places for me to have a look at ?!

thank you!
tom_rosenback
Posts: 779
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PHP interface for TellStick, HomeAutomation v2.0.2 relea

Post by tom_rosenback »

tbrg78 wrote:Mhh, so I double checked the username and password and added the "computername\.." like its written, if you add/edit tasks in the win-scheduler itself, but..
There is no new scheduled task created, whenever I use HA. The task is listed in HA, but it does not show up in the scheduled tasks list.

I guess you make use of some windows commandline tool from the php-side ?! Using exec() or system() or something ?! I seeked through the scripts to find a place to add some debugging information, but searching for exec/system did not bring up any hits.. and so - I'm stuck again o) Do you have any ideas, are there any more places for me to have a look at ?!

thank you!
HA uses 'schtasks' as command line tool executed by exec method. schtasks should be bundled with your Windows installation.
//Tom

Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Post Reply