PowerShell based cmdlets / Commands

Moderator: Telldus

Masonit
Posts: 75
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

Hi

I am using your powershell models and they work great. Big thanks for sharing! :)

\Masonit

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

Re: PowerShell based cmdlets / Commands

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

So glad to hear that, thanks for telling me :-)

Feel free to post any feature requests you might want in this thread and I'll try to take a look at them when I get some time.

ArneG
Posts: 28
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

Will there be any Get-TDSensorHistory soon ? The data from Telldus Live may be available now like it is with the Device-History ?

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

Re: PowerShell based cmdlets / Commands

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

ArneG wrote:Will there be any Get-TDSensorHistory soon ? The data from Telldus Live may be available now like it is with the Device-History ?
Sadly, there is no function to call for sensor history afaik, I have made a cmdlet/function for the detvice history though, the full module is available at github:
https://github.com/AWahlqvist/powershel ... lldus.psm1

ArneG
Posts: 28
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

I know. I''m collecting devicehistory via that cmdlet on a regular basis. I also do poll the sensors via TD-GetSensor every 15 minutes or so, and that way collecting/storing my own sensorhistory locally via a simple Delphi-application that I've hacked together...But it would be nice to get this historical data directly from the Live-server the same way as for the device-history, and they are indeed betatesting this now. (http://live.telldus.com/sensor/index2). So Telldus Live server IS indeed storing such sensorhistory (You have to enabled the storing of historydata per device via 'Edit sensor'). Is there any way to pull off this history from the Live-server via a cmdlet?

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

Re: PowerShell based cmdlets / Commands

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

ArneG wrote:I know. I''m collecting devicehistory via that cmdlet on a regular basis. I also do poll the sensors via TD-GetSensor every 15 minutes or so, and that way collecting/storing my own sensorhistory locally via a simple Delphi-application that I've hacked together...But it would be nice to get this historical data directly from the Live-server the same way as for the device-history, and they are indeed betatesting this now. (http://live.telldus.com/sensor/index2). So Telldus Live server IS indeed storing such sensorhistory (You have to enabled the storing of historydata per device via 'Edit sensor'). Is there any way to pull off this history from the Live-server via a cmdlet?
Hey, look at that! Cool :)

I've now updated the module with Get-TDSensorHistoryData!

It's available at:
https://github.com/AWahlqvist/powershel ... lldus.psm1

ArneG
Posts: 28
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

Got it :)
Thanx!

ArneG
Posts: 28
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

The cmdlet for the sensorhistory data is collecting the complete history available on the telldusserver each time. This results in a lot of duplicate sensordata when the cmdlet is uses to poll the telldus server on a regular basis. Of course it is no problem handling/filtering out duplicate sensordata-reading/entries when dealing with the data locally afterwards.
But maybe you could modify the Cmdlet a bit so that the script using the sensorhistory-cmdlet can pass along a date/time-stamp along with the sensor-id to the cmdlet to only pull the sensorreadings on and after that given datestamp? Like pseudocode: "no need for getting those data I've already got, I only need the last few NEW entries since last poll"

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

Re: PowerShell based cmdlets / Commands

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

I'll look into it and get back to you!

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

Re: PowerShell based cmdlets / Commands

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

ArneG wrote:The cmdlet for the sensorhistory data is collecting the complete history available on the telldusserver each time. This results in a lot of duplicate sensordata when the cmdlet is uses to poll the telldus server on a regular basis. Of course it is no problem handling/filtering out duplicate sensordata-reading/entries when dealing with the data locally afterwards.
But maybe you could modify the Cmdlet a bit so that the script using the sensorhistory-cmdlet can pass along a date/time-stamp along with the sensor-id to the cmdlet to only pull the sensorreadings on and after that given datestamp? Like pseudocode: "no need for getting those data I've already got, I only need the last few NEW entries since last poll"
Sorry for taking so long... I started this and then sadly forgot about it... Anyway, new version available at:
https://github.com/AWahlqvist/powershel ... lldus.psm1

You can now specify After and Before parameters!

I hope it will be useful :-)

lizardus
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

Great work, thanks!

ArneG
Posts: 28
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

Thanks. Works fine appearanty :P

Btw: maybe the example in the code should reflect that the cmdlet uses UTC times (since the timedata from Telldus live is in UTC, and getdate() returns local time by default)

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

Re: PowerShell based cmdlets / Commands

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

ArneG wrote:Thanks. Works fine appearanty :P

Btw: maybe the example in the code should reflect that the cmdlet uses UTC times (since the timedata from Telldus live is in UTC, and getdate() returns local time by default)
Glad it works! :)

Hmm... I think I see your point. The way it works now will make sure the user will get the expected data back from Telldus Live (converts the date you add to UTC). What I really should do though is convert the returned dates to the local time for the whole thing to make more sense (or the time zone of the tellstick really). It's supported in the API but I've been a bit lazy...

Did I understand you correctly? That it's a bit inconsistent currently? :-)

Would returning the local time or just ask for UTC time as input be preferred?

ArneG
Posts: 28
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

c8h10n4o2 wrote:
Glad it works! :)

Hmm... I think I see your point. The way it works now will make sure the user will get the expected data back from Telldus Live (converts the date you add to UTC). What I really should do though is convert the returned dates to the local time for the whole thing to make more sense (or the time zone of the tellstick really). It's supported in the API but I've been a bit lazy...

Did I understand you correctly? That it's a bit inconsistent currently? :-)

Would returning the local time or just ask for UTC time as input be preferred?
Same thing different wrapping? :) I
I guess UTC as preffered input is ok, as long as the we/the script knows that the cmdlet expects UTC.
For me personally is doesn't matter really, since I will do my own handling/converting of dates&times as/if needed both when I use the cmdlet and when I processing the returned data afterwards :)

Masonit
Posts: 75
Joined: Thu Jan 18, 2018 11:08 am

Re: PowerShell based cmdlets / Commands

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

Hi

Since yesterday I get a certificate warning when running get-tdsensor. Never seen this before. Certificate is issued to *.ballou.se. Anyone else with the same problem? My powershell scripts isen't working correctly because of this.


\Masonit

Post Reply