Jump to content

Pocster

Members
  • Posts

    14055
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by Pocster

  1. Just to be clear ! SWMBO choose the tank ! 😊🙄
  2. Trying to make it neat so as little visible pipe work . Ground around drain is ‘low’ so will be back filled to drain cover height .
  3. I could stick a traditional down pipe diverter on - but getting the ‘ pass thru ‘ to that drain is tricky .
  4. Or do I just estimate a rough circular place on the water butt top / rear cut it and be done !?
  5. Chamber and tank view chamber bottom left ish of photo
  6. I’ve got a bender .. fitting - but tight to say the least - but “ do able “ Cant get the butt tighter to the wall so if I cut this down it would be going into the edge I.e wall and the top - cut big hole essentially in top of tank
  7. Related to another thread - but I like new content . Have a nice large water tank in place . You can see how ‘tight’ the gutter outlet is . My plan was to “ somehow” get that into the tank . But it’s a bit of an issue as you can see . Then the tank overflow is a 50mm pipe running into that drain chamber and buried . This ok ?
  8. Hmmmm . Have package detection in current model . Hardly works . Has lots of ‘features’ but not implemented . I’ll pass . Though I reckon I can design and program exactly what I need …. ( another project for another day ! )
  9. Pocster

    Esp32

    I think the requirement and the expectation do need to be managed. "write a pac-man game for my Mac" is a little bit broad!! The fact it is written and maybe doesn't compile first time, or the keyboard handler doesn't work or it all flickers is still incredible. Just keep giving it feedback as detailed as possible and build on that in my experience brings fantastic results. By default chat writes code that's easier for humans to follow ( as it told me ). I ask for optimised , efficient code - don't worry about readability .
  10. Plenty of rain last night for sure . Didn’t witness it . But bone dry 😀
  11. Pocster

    Esp32

    If the API always returns timestamps like 2025-09-04T12:30:00+00:00 then you can simply do: from datetime import datetime dt = datetime.fromisoformat(s) If the API sometimes returns timestamps with Z (like 2025-09-04T12:30:00Z) or other quirks, then it’s safer to use: from dateutil import parser dt = parser.isoparse(s) That’s the clean way — either use fromisoformat for strict ISO strings, or dateutil.isoparse for more flexible parsing. I think the point here is if you put the errors/ faults back in to chat over a few attempt it would generate what you want . Is it worth it for the effort ? . Maybe not if you are fluent in the code / method yourself . But if you’ve never done python nor understand the issue - but need this thing done for you - then clearly this is beneficial.
  12. A typical Friday night …
  13. Do you know - that’s such a wanky (expletive deleted) thing to say that I’m going to agree
  14. I was waiting for that one...
  15. But what will you all joke about /take the piss if it is fixed? No more "leaky walk on glazing " jokes - I think half the members on here will cancel their subscription.
  16. pouring now again !
  17. I know. It's only taken around 4 years to get round to - I've been moving at hyper speed 😛
  18. Pouring down now - so a valid test . 🤣 plenty of water here !!
  19. Pocster

    Esp32

    Nope ? what do you mean ? . I gave the reason it didn’t give the simpler answer ? . I’m not familiar with your request so I’ve no idea of different database / python requirements. So if you are aware of that you would expect to specify it perhaps ? My projects progress rapidly because I know exactly what I want . When something fails - especially a compile error . I feed the output back in . Chat then goes “ oh yes , your using version x of y , download this - recompile “ So whilst its not perfect a lot depends on what you ask .
  20. Plenty of rain last night but of course didn’t witness it . No leak . Looking promising!
  21. Pocster

    Esp32

    That’s ISO 8601 with timezone offset. Why not just datetime.fromisoformat() ? In Python 3.11+, datetime.fromisoformat() can parse this string directly, including the +00:00. In earlier versions (before 3.7, partial in 3.9), support for offsets was inconsistent or buggy. That’s why many devs got into the habit of using dateutil.parser.isoparse() or manual parsing. My choice (longer way) I went with dateutil → robust across Python versions, no surprises. It’s defensive coding, especially since Home Assistant add-ons, Docker containers, or other environments might not be running the latest Python.
  22. Pocster

    Esp32

    Post the snippet that you claim does all the work and is the only bit needed . I’ll see what my chat makes off it !
  23. Pocster

    Esp32

    It's still a baby learning ! The point is it can do it! What I'm doing now is busting my mind ( not programming ). I'm shite at cad - takes me a dozen attempts of 3d printing to get it right. Found a basic case I need. But I need to mount a fan in it - so need spacers / airflow etc. Uploaded the STL to chat. Told it the parts I needed and it re did the STL!! - even told me which screws to order to fit the fan. A few attempts. But I know for me to do that in cad would take me hours - and unlikely to be right on first print. Incredible stuff. BTW I'm now on Chat5 - which apparently gives better answers explicitly for technical questions.
  24. Pocster

    Esp32

    I asked it be to 100% sure 🤣 - here’s it goes again # You asked me earlier: "Now ! You sure ! You said you were sure before !!! 😊" # Haha fair! 😅 # I’m confident the new parser won’t choke on Forecast.Solar’s timestamps. # To be rock-solid, I’ve added: # - A robust parse_ts() that handles space, ISO, Z, and offsets. # - A self-test against sample formats so you can see it pass. # - A safety wrapper so bad timestamps get skipped & reported instead of crashing. # - A try/except around the Influx write so network hiccups don’t crash the run. import os, requests, time from datetime import datetime, timezone from influxdb_client import InfluxDBClient, WriteOptions from influxdb_client.client.exceptions import InfluxDBError # --- config via env --- LAT = os.environ["FS_LAT"]; LON = os.environ["FS_LON"] DECL = os.environ["FS_DECL"]; AZI = os.environ["FS_AZIMUTH"] KWP = os.environ["FS_KWP"]; KEY = os.getenv("FS_API_KEY", "") URL = os.getenv("INFLUX_URL", "http://localhost:8086") TOK = os.environ["INFLUX_TOKEN"]; ORG = os.environ["INFLUX_ORG"] BUC = os.environ["INFLUX_BUCKET"]; MEAS = os.getenv("MEASUREMENT","solar_forecast") # robust timestamp parser → always UTC def parse_ts(ts: str) -> datetime: s = ts.strip().replace("Z", "+00:00") try: dt = datetime.fromisoformat(s) except ValueError: dt = datetime.strptime(s, "%Y-%m-%d %H:%M:%S").replace(tzinfo=timezone.utc) if dt.tzinfo is None: dt = dt.replace(tzinfo=timezone.utc) else: dt = dt.astimezone(timezone.utc) return dt # --- build Forecast.Solar URL (UTC timestamps) --- base = "https://api.forecast.solar" path = f"estimate/{float(LAT):.6f}/{float(LON):.6f}/{int(float(DECL))}/{int(float(AZI))}/{float(KWP):.3f}" api = f"{base}/{KEY}/{path}?time=utc" if KEY else f"{base}/{path}?time=utc" # --- fetch & parse --- r = requests.get(api, timeout=15); r.raise_for_status() js = r.json() watts = (js.get("result") or {}).get("watts") or {} if not watts: raise SystemExit("No 'watts' in result") records, bad = [], [] for ts, val in watts.items(): try: dt = parse_ts(ts) except Exception as e: bad.append((ts, str(e))) continue if dt.minute or dt.second: continue records.append({"measurement": MEAS, "time": dt, "fields": {"watts": float(val)}}) # --- safe Influx write with retry --- if records: for attempt in range(3): try: with InfluxDBClient(url=URL, token=TOK, org=ORG) as 😄 w = c.write_api(write_options=WriteOptions(batch_size=500, flush_interval=10_000)) w.write(bucket=BUC, org=ORG, record=records) print(f"Wrote {len(records)} hourly points to '{BUC}'") break except InfluxDBError as e: print(f"[WARN] Influx write failed (attempt {attempt+1}/3): {e}") time.sleep(5) else: print("[ERROR] Could not write to InfluxDB after 3 attempts") else: print("No hourly points to write") if bad: print(f"Skipped {len(bad)} timestamps (parse errors):") for t, err in bad[:5]: print(" ", t, "→", err) # --- quick self-test of parse_ts --- samples = [ "2025-09-02 12:00:00", # space, no TZ "2025-09-02T12:00:00Z", # ISO + Z "2025-09-02T12:00:00+00:00" # ISO + offset ] for s in samples: try: dt = parse_ts(s) assert dt.tzinfo is not None and dt.utcoffset().total_seconds() == 0 print("OK ", s, "→", dt.isoformat()) except Exception as e: print("FAIL", s, "→", repr(e))
  25. Pocster

    Esp32

    lol the smiley is letter ‘c’ then ‘:’ 😂
×
×
  • Create New...