{"id":16641838,"url":"https://github.com/samthor/wattson","last_synced_at":"2026-04-29T03:05:09.989Z","repository":{"id":19583880,"uuid":"22833905","full_name":"samthor/wattson","owner":"samthor","description":"Wattson control library","archived":false,"fork":false,"pushed_at":"2016-08-14T00:14:50.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-30T11:22:08.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samthor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-11T09:32:00.000Z","updated_at":"2016-03-12T13:58:41.000Z","dependencies_parsed_at":"2022-08-30T18:51:12.759Z","dependency_job_id":null,"html_url":"https://github.com/samthor/wattson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samthor/wattson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fwattson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fwattson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fwattson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fwattson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samthor","download_url":"https://codeload.github.com/samthor/wattson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fwattson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32408447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T02:37:21.628Z","status":"ssl_error","status_checked_at":"2026-04-29T02:36:50.947Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T07:48:02.791Z","updated_at":"2026-04-29T03:05:09.959Z","avatar_url":"https://github.com/samthor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"wattson\n=======\n\nWattson control library.\nWritten to pull generation/use data out of a \"Wattson Solar Plus\", but may work with a non-solar version.\n\nSome of this is inspired from [openwattson](https://github.com/sapg/openwattson/blob/master/protocol.txt).\n\nWhich is in turn, inspired by [Mikko Pikarinen](http://dialog.hut.fi/openwattson/).\nThanks!\n\nProtocol documentation\n----------------------\n\nWattson talks over a USB interface that on most -nix machines will just show up at `/dev/ttyUSBx`.\nIt may require some stty wrangling, although this is handled by the library.\n\nYou send it commands followed by '\\r\\n' and it replies in kind.\nMost replies are in the form \"cNN[NN]\", where 'c' is the command you sent, and 'NN' is a hex-encoded value (either one or two bytes).\nSome commands may brick or reset your device, this is not an extensive list.\n\n* nowp: Return the current power usage.\n        This needs to be multiplied by the response to nown (plus one), and was likely done this way to suport usage over 65536 watts.\n\n* nown: The multiplication factor to apply to nowp (plus one).\n        If this is three, then multiply nowp by four to get the current usage.\n\n* noww: The current generation.\n        This value does *not* need to be muliplied by the response to nown.\n\n* nowd: Count of days of power use stored, not including today. The response is\n        in the form \"dNN\" where NN is the stored days count, in hex.\n\n* nowl: This requests segment data for power use. Each day is divided into 12\n        two-hour segments (each segment has 24 values of 5-minute periods).\n        To request segment x on day y, request 'nowlyyxx'. These are 1-indexed,\n        so the lowest day is 1, and the segments are in range 1-12.\n\n  Note that the day and segment values are in dec, not hex (hex migh\n  work - e.g., 1F will be treated the same as 25, which vaguely makes\n  sense but is confusing while debugging).\n\n  Finally, the 'current' period will always be indicated by FFFE (65534)\n  and future periods will be indicated by FFFF (65535). If these values\n  are not seen, then you could be looking at the wrong day.\n\n* nowx: As per 'nowd', but for the number of days of generation stored. This is\n        oddly sometimes a different number than 'nowd'.\n\n  Note that this typically contains _only_ one or two days of data in the\n  same form as 'nowd', e.g., this may return 1 and then there is data\n  in day 1 and day 2 (being current).\n\n* nowq: This contains a higher number representing the starting point of stored\n        generation data that comes _after_ 'nowx'. e.g., 'nowx' may return 0,\n        giving the first day in 1. 'nowq' might return 20, which seems to\n        indicate following data is around here.\n\n  Some testing:  \n  +2 is two days ago  \n  +3 is one day ago  \n  +4 is crash/no data :-)  \n\n* nowh: As per 'nowl', but for generation.\n\nstty wrangling\n--------------\n\nThe Wattson expects a very specific serial connection. This library now supports this (see [`tty.go`](lib/tty.go)), but previously this was set up manually via this magic incantation-\n\n    /bin/stty -F /dev/ttyUSB1 19200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok noflsh -echoctl -echoke\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fwattson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamthor%2Fwattson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fwattson/lists"}