Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Create and set a sensor #426

Unanswered
noname9312 asked this question in Q&A
Discussion options

Im trying to create a new sensor and set the data. Unfortunatly I cant figure it out and cant find any examples.

Here is the code of what I want to achieve:
(sensor.mysensor doesnt exists yet)

import requests
import json
import time
def update_sensor():
 # scraping website and filling data
 data = "dummy content"
 state.setattr("sensor.mysensor", data)
while True:
 time.sleep(600)
 update_sensor()

This is only one of many different tries.

Could someone please help me?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /