PowerShell based cmdlets / Commands

Moderator: Telldus

Masonit
Posts: 79
Joined: Fri Mar 17, 2023 9:45 am

Re: PowerShell based cmdlets / Commands

Post by Masonit »

Hi

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

\Masonit
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

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.
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

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
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

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
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

I'll look into it and get back to you!
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

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: Fri Mar 17, 2023 9:45 am

Re: PowerShell based cmdlets / Commands

Post by lizardus »

Great work, thanks!
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

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?
Masonit
Posts: 79
Joined: Fri Mar 17, 2023 9:45 am

Re: PowerShell based cmdlets / Commands

Post by Masonit »

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
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

Masonit wrote: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
Hmm... I'm getting the same error. It seems Telldus is moving some stuff around (like this forum), which could be the cause of this.

I'll look into to it as soon as a can!
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

Updated version available!

Get it at:
https://github.com/AWahlqvist/powershel ... lldus.psm1


@Masonit: Could you verify if this version works for you? Thanks in advance!
Masonit
Posts: 79
Joined: Fri Mar 17, 2023 9:45 am

Re: PowerShell based cmdlets / Commands

Post by Masonit »

Works just fine again. Thanks for quick response! :clap:

\Masonit
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

Awesome! :D

Thanks for reporting the issue!
c8h10n4o2
Posts: 86
Joined: Fri Mar 17, 2023 9:45 am
Contact:

Re: PowerShell based cmdlets / Commands

Post by c8h10n4o2 »

Just wanted to give you a small update.

I've updated the module to include some changes:
  • It's available at the PowerShell Gallery. If you run Windows 10 (or PowerShell 5) this means you can install it by simply running "Install-Module Telldus". You can also update to the latest version at any time by running "Update-Module Telldus" in a PowerShell prompt.
  • You can now save your credentials really simply by executing: Connect-TelldusLive -SaveCredential. After you've done this once, you can reuse those by running "Connect-TelldusLive -UseSavedCredential". The credentials are saved encrypted using your logon session (in windows).
  • Bell support for Set-TDDevice
  • If you specify a date/time when fetching sensor history, the cmdlet wont change it to UTC automtically.

Link to PowerShell Gallery:
https://www.powershellgallery.com/packages/Telldus
Masonit
Posts: 79
Joined: Fri Mar 17, 2023 9:45 am

Re: PowerShell based cmdlets / Commands

Post by Masonit »

Thanks for keeping it up to date. :) Are you planning to support local api?

https://developer.telldus.com/blog/2016 ... ublic-beta

\Masonit
Post Reply