chore(plating): de-dash fusion_plating_iot too
Same em-dash -> hyphen sweep applied to fusion_plating_iot (lives under fusion_iot/ so the main commit missed it). Comments/strings only; no functional dashes in this module. Keeps git in sync with the in-place de-dash already applied to entech. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,7 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _parse_read_at(raw):
|
||||
"""Best-effort ISO-8601 parse — fall back to 'now' on garbage input."""
|
||||
"""Best-effort ISO-8601 parse - fall back to 'now' on garbage input."""
|
||||
from odoo.fields import Datetime as OdooDatetime
|
||||
if not raw:
|
||||
return OdooDatetime.now()
|
||||
@@ -62,20 +62,20 @@ class FpIotIngestController(http.Controller):
|
||||
methods=['POST'], csrf=False, save_session=False)
|
||||
def ingest(self, **_kwargs):
|
||||
"""Accept one-or-many sensor readings and land them in fp.tank.reading."""
|
||||
# Pull the shared secret from config — configured at install via
|
||||
# Pull the shared secret from config - configured at install via
|
||||
# data/ir_config_parameter_data.xml, but admins can rotate it
|
||||
# in Settings → Technical → System Parameters.
|
||||
expected = request.env['ir.config_parameter'].sudo().get_param(
|
||||
'fusion_plating_iot.ingest_token', ''
|
||||
)
|
||||
if not expected:
|
||||
_logger.warning('fp.iot.ingest: token not configured — all requests rejected')
|
||||
_logger.warning('fp.iot.ingest: token not configured - all requests rejected')
|
||||
return Response(
|
||||
json.dumps({'ok': False, 'error': 'token_not_configured'}),
|
||||
status=503, content_type='application/json',
|
||||
)
|
||||
|
||||
# Accept token via either header or payload body — some simple
|
||||
# Accept token via either header or payload body - some simple
|
||||
# sensors can't easily set custom headers.
|
||||
header_token = request.httprequest.headers.get('X-FP-IOT-Token', '')
|
||||
raw = request.httprequest.get_data(as_text=True) or ''
|
||||
@@ -124,10 +124,10 @@ class FpIotIngestController(http.Controller):
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
|
||||
# Sub 7 — per-sensor rate-limit. Drop readings that arrive
|
||||
# Sub 7 - per-sensor rate-limit. Drop readings that arrive
|
||||
# inside the sensor's effective polling interval so the Pi
|
||||
# agent can happily poll every 30 s while the log only
|
||||
# retains a row every 15–30 min. Inactive sensors also
|
||||
# retains a row every 15-30 min. Inactive sensors also
|
||||
# dropped so disabled tanks don't clutter the log.
|
||||
if not sensor.active:
|
||||
skipped_interval += 1
|
||||
|
||||
Reference in New Issue
Block a user