The submodule collapse was only half applied: .gitmodules was deleted but backend/ and frontend/ were still recorded as gitlinks, so none of their files were tracked. Replace the gitlinks with the real trees. Also untrack .env (it carried placeholder secrets) in favour of a tracked .env.example, drop the committed __pycache__, and narrow the blanket *.png ignore that would have swallowed design assets.
30 lines
770 B
Python
30 lines
770 B
Python
"""
|
|
Example trigger node: Humidity Sensor
|
|
|
|
Another trigger node that simulates a humidity sensor.
|
|
"""
|
|
|
|
from nodes import Node
|
|
from util import Message
|
|
|
|
|
|
def create_node(params: dict) -> Node:
|
|
"""Create the humidity sensor node."""
|
|
|
|
def read_humidity(params, **kwargs):
|
|
"""Simulate reading humidity from a sensor."""
|
|
import random
|
|
|
|
humidity = 50.0 + random.gauss(0, 10) # 50% ± 10%
|
|
humidity = max(0, min(100, humidity)) # Clamp to [0, 100]
|
|
print(f"[humidity_sensor] Read humidity: {humidity:.1f}%")
|
|
return {"humidity": humidity}
|
|
|
|
return Node(
|
|
f=read_humidity,
|
|
requires=[],
|
|
provides=[Message(name="humidity", dtype=float)],
|
|
params=params,
|
|
name="humidity_sensor",
|
|
)
|