npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rign/sh-weather-stations

v1.2.0

Published

Library which allows to display information about temperature and humidity from multiple weather stations in different period of times: day, week, month, year

Downloads

1

Readme

WeatherStation

This library provides simple solution to display temperature and humidity for any number of weather stations in your smart home.

Functionality

  • system displays list of weather stations with current temperature and humidity
  • for each weather station system is able to display chart of temperature and humidity change in different period of time (day, 7 days, month, year)
  • system allows to move forward and backward in any period of time

ToDo

  • possibility to change weather station name
  • possibility to compare two weather station results in period of time

How to use it

Installation

npm i --save @rign/sh-weathe-stations

Import module

The simplest way to use that library is to create Wrapper module, which will import WeatherStationsModule

@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    WeatherStationsModule,
  ],
})
export class WeatherStationsWrapperModule { }

API

To use this module with your ecosystem you need provide data for it.

API Models

API has two different models to communicate:

export interface WeatherStationDto {
  id: number;           // id of weather station
  name: string;         // name of weather station
  humidity: number;     // last known humidity (float)
  temperature: number;  // last known temperature (float)
  timestamp: number;    // timestamp of last data read (in miliseconds)
}

export interface WeatherStationDataDto {
  id: number;           // id of weather station data record
  timestamp: number;    // timestamp of reading data (in miliseconds)
  humidity: number;     // humidity value (float)
  temperature: number;  // temperature value (float)
}

API service interface

You need to implement service based on below interface.

export interface WeatherStationsApi {
  getList(): Observable<WeatherStationDto[]>;

  getAggregateDataForWeek(id: number, year: number, month: number, day: number): Observable<WeatherStationDataDto[]>;

  getAggregateDataForDay(id: number, year: number, month: number, day: number): Observable<WeatherStationDataDto[]>;

  getAggregateDataForMonth(id: number, year: number, month: number): Observable<WeatherStationDataDto[]>;

  getAggregateDataForYear(id: number, year: number): Observable<WeatherStationDataDto[]>;
}

And provide it in your AppModule

@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    WeatherStationsModule,
  ],
  providers: [
    {provide: WEATHER_STATIONS_API, useClass: WeatherStationsApiService},
  ],
})
export class WeatherStationsWrapperModule { }

Routing

Finally you have to add your Wrapped module to routing. You can do it in such way:

const routes: Routes = [
  ... 
  {
    path: 'weather-stations',
    loadChildren: './modules/weather-stations-wrapper/weather-stations-wrapper.module#WeatherStationsWrapperModule'
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {
}

That's all now you are able to enter weather station module.

Change Log

v1.2.0

  • remove manual sync (now Weather Station is send data to server, they are not connected to network full time)
  • fix: weather station Week Title range
  • fix: go to next/prev in Month Chart

v1.1.0

  • possibility to manually synchronize data
  • change API interface

v1.0.0

  • list of weather stations with current temperature and humidity
  • each weather station is able to display chart of its temperature and humidity change in different period of time (day, 7 days, month, year)
  • move period of time backward and forward